From d0bffc800a50305315a0d7cf37140291ef5b1b61 Mon Sep 17 00:00:00 2001 From: Ansuel Smith Date: Thu, 27 May 2021 03:52:47 +0200 Subject: [PATCH] treewide: hack support for mismatched firmware Make new qsdk feature configurable to support old half compatible firmware. Signed-off-by: Ansuel Smith --- exports/nss_fw_version.h | 11 +++++++++++ exports/nss_ipv4.h | 8 ++++++++ exports/nss_ipv6.h | 7 +++++++ exports/nss_wifi_vdev.h | 14 ++++++++++++++ exports/nss_wifili_if.h | 8 ++++++++ nss_ipv4_stats.c | 2 ++ nss_ipv4_strings.c | 2 ++ nss_ipv6_stats.c | 2 ++ nss_ipv6_strings.c | 2 ++ 9 files changed, 56 insertions(+) create mode 100644 exports/nss_fw_version.h diff --git a/exports/nss_fw_version.h b/exports/nss_fw_version.h new file mode 100644 index 0000000..895d523 --- /dev/null +++ b/exports/nss_fw_version.h @@ -0,0 +1,11 @@ +#ifndef __NSS_FW_VERSION_H +#define __NSS_FW_VERSION_H + +#define NSS_FW_VERSION_MAJOR 11 +#define NSS_FW_VERSION_MINOR 4 + +#define NSS_FW_VERSION(a,b) (((a) << 8) + (b)) + +#define NSS_FW_VERSION_CODE NSS_FW_VERSION(NSS_FW_VERSION_MAJOR, NSS_FW_VERSION_MINOR) + +#endif /* __NSS_FW_VERSION_H */ \ No newline at end of file diff --git a/exports/nss_ipv4.h b/exports/nss_ipv4.h index ee3a552..25c4d82 100644 --- a/exports/nss_ipv4.h +++ b/exports/nss_ipv4.h @@ -26,6 +26,8 @@ #include "nss_stats_public.h" #endif +#include "nss_fw_version.h" + /** * @addtogroup nss_ipv4_subsystem * @{ @@ -216,12 +218,14 @@ enum nss_ipv4_stats_types { /**< Number of IPv4 multicast connection destroy requests that missed the cache. */ NSS_IPV4_STATS_MC_CONNECTION_FLUSHES, /**< Number of IPv4 multicast connection flushes. */ +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) NSS_IPV4_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFNUM, /**< Number of IPv4 mirror connection requests with an invalid interface number. */ NSS_IPV4_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFTYPE, /**< Number of IPv4 mirror connection requests with an invalid interface type. */ NSS_IPV4_STATS_MIRROR_FAILURES, /**< Number of IPv4 mirror failures. */ +#endif NSS_IPV4_STATS_MAX, /**< Maximum message type. */ }; @@ -609,8 +613,10 @@ struct nss_ipv4_rule_create_msg { /**< Ingress shaping related accleration parameters. */ struct nss_ipv4_identifier_rule identifier; /**< Rule for adding identifier. */ +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) struct nss_ipv4_mirror_rule mirror_rule; /**< Mirror rule parameter. */ +#endif }; /** @@ -955,6 +961,7 @@ struct nss_ipv4_node_sync { uint32_t ipv4_mc_connection_flushes; /**< Number of multicast connection flushes. */ +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) uint32_t ipv4_connection_create_invalid_mirror_ifnum; /**< Number of create request failed with an invalid mirror interface number. */ @@ -963,6 +970,7 @@ struct nss_ipv4_node_sync { uint32_t ipv4_mirror_failures; /**< Mirror packet failed. */ +#endif uint32_t exception_events[NSS_IPV4_EXCEPTION_EVENT_MAX]; /**< Number of exception events. */ diff --git a/exports/nss_ipv6.h b/exports/nss_ipv6.h index 930e74c..a21f939 100644 --- a/exports/nss_ipv6.h +++ b/exports/nss_ipv6.h @@ -195,6 +195,8 @@ enum nss_ipv6_stats_types { /**< Number of IPv6 multicast connection destroy requests that missed the cache. */ NSS_IPV6_STATS_MC_CONNECTION_FLUSHES, /**< Number of IPv6 multicast connection flushes. */ + +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) NSS_IPV6_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFNUM, /**< Number of IPv6 mirror connection requests with an invalid interface number. */ NSS_IPV6_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFTYPE, @@ -202,6 +204,7 @@ enum nss_ipv6_stats_types { NSS_IPV6_STATS_MIRROR_FAILURES, /**< Number of IPv6 mirror failures. */ +#endif NSS_IPV6_STATS_MAX, /**< Maximum message type. */ @@ -702,8 +705,10 @@ struct nss_ipv6_rule_create_msg { /**< Ingress shaping related accleration parameters. */ struct nss_ipv6_identifier_rule identifier; /**< Rule for adding identifier. */ +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) struct nss_ipv6_mirror_rule mirror_rule; /**< Mirror rule parameter. */ +#endif }; /** @@ -950,6 +955,7 @@ struct nss_ipv6_node_sync { uint32_t ipv6_mc_connection_flushes; /**< Number of multicast connection flushes. */ +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) uint32_t ipv6_connection_create_invalid_mirror_ifnum; /**< Number of create request failed with an invalid mirror interface number. */ @@ -958,6 +964,7 @@ struct nss_ipv6_node_sync { uint32_t ipv6_mirror_failures; /**< Mirror packet failed. */ +#endif uint32_t exception_events[NSS_IPV6_EXCEPTION_EVENT_MAX]; /**< Number of exception events. */ diff --git a/exports/nss_wifi_vdev.h b/exports/nss_wifi_vdev.h index 1b52f66..da91b56 100644 --- a/exports/nss_wifi_vdev.h +++ b/exports/nss_wifi_vdev.h @@ -74,8 +74,10 @@ enum nss_wifi_vdev_msg_types { NSS_WIFI_VDEV_INTERFACE_RECOVERY_RESET_MSG, NSS_WIFI_VDEV_INTERFACE_RECOVERY_RECONF_MSG, NSS_WIFI_VDEV_SET_GROUP_KEY, +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) NSS_WIFI_VDEV_HMMC_MEMBER_ADD_MSG, NSS_WIFI_VDEV_HMMC_MEMBER_DEL_MSG, +#endif NSS_WIFI_VDEV_MAX_MSG }; @@ -130,6 +132,7 @@ enum nss_wifi_vdev_err_types { NSS_WIFI_VDEV_VLAN_MODE_CONFIG_FAIL, NSS_WIFI_VDEV_RECOVERY_RESET_FAIL, NSS_WIFI_VDEV_RECOVERY_RECONF_FAIL, +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) NSS_WIFI_VDEV_CONFIG_GROUP_KEY_FAIL, NSS_WIFI_VDEV_MULTIPASS_NOT_ENABLED, NSS_WIFI_VDEV_ALLOC_VLAN_MAP_FAILED, @@ -139,6 +142,7 @@ enum nss_wifi_vdev_err_types { NSS_WIFI_VDEV_PPE_PORT_DESTROY_FAIL, NSS_WIFI_VDEV_PPE_VSI_ASSIGN_FAIL, NSS_WIFI_VDEV_PPE_VSI_UNASSIGN_FAIL, +#endif NSS_WIFI_VDEV_EINV_MAX_CFG }; @@ -161,11 +165,13 @@ enum nss_wifi_vdev_ext_data_pkt_type { NSS_WIFI_VDEV_EXT_TX_COMPL_PKT_TYPE = 11, /**< Tx completion. */ NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_WDS_LEARN = 12, /**< WDS source port learning command. */ NSS_WIFI_VDEV_EXT_DATA_PPDU_INFO = 13, /**< PPDU metadata information. */ +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_MCBC_RX = 14, /**< Multicast/broadcast packet received. */ NSS_WIFI_VDEV_MESH_EXT_DATA_PKT_TYPE_RX_SPL_PACKET = 15, /**< Mesh link VAP special packet. */ NSS_WIFI_VDEV_MESH_EXT_DATA_PKT_TYPE_RX_MCAST_EXC = 16, /**< Mesh link VAP multicast packet. */ +#endif NSS_WIFI_VDEV_EXT_DATA_PKT_TYPE_MAX }; @@ -201,9 +207,11 @@ enum nss_wifi_vdev_cmd { NSS_WIFI_VDEV_ENABLE_IGMP_ME_CMD, /**< Configuration to set IGMP multicast enhancement on VAP. */ NSS_WIFI_VDEV_CFG_WDS_BACKHAUL_CMD, /**< Configuration to set WDS backhaul extension on VAP. */ +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) NSS_WIFI_VDEV_CFG_MCBC_EXC_TO_HOST_CMD, /**< Configuration to set multicast/broadcast exception to host on VAP. */ NSS_WIFI_VDEV_CFG_PEER_AUTHORIZE_CMD, /**< Configuration to enable peer authorization on VAP. */ +#endif NSS_WIFI_VDEV_MAX_CMD }; @@ -271,7 +279,9 @@ struct nss_wifi_vdev_config_msg { uint8_t is_nss_qwrap_en; /**< VAP is configured for NSS firmware QWRAP logic. */ uint8_t tx_per_pkt_vdev_id_check; /**< Transmit per-packet virtual device ID check. */ uint8_t align_pad; /**< Reserved field. */ +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) uint32_t vap_ext_mode; /**< Different VAP extended modes. */ +#endif }; /** @@ -1037,8 +1047,10 @@ struct nss_wifi_vdev_stats_sync_msg { uint32_t rx_mcast_bytes; /**< Receive multicast bytes count. */ uint32_t rx_decrypt_err; /**< Receive decryption error */ uint32_t rx_mic_err; /**< Receive MIC error */ +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) uint32_t mcbc_exc_host_fail_cnt; /**< Number of multicast/broadcast packets failed to send to host through exception path. */ +#endif }; /** @@ -1070,6 +1082,7 @@ struct nss_wifi_vdev_msg { /**< Updates a snooplist group member. */ struct nss_wifi_vdev_me_snptbl_deny_grp_add_msg vdev_deny_member_add; /**< Add a snooplist member to the deny list. */ +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) struct nss_wifi_vdev_me_hmmc_add_msg vdev_hmmc_member_add; /**< Adds a new member into the HMMC list. */ struct nss_wifi_vdev_me_hmmc_del_msg vdev_hmmc_member_del; @@ -1078,6 +1091,7 @@ struct nss_wifi_vdev_msg { /**< Adds a new member into the deny list. */ struct nss_wifi_vdev_me_deny_ip_del_msg vdev_deny_list_member_del; /**< Delete a member from the deny list. */ +#endif struct nss_wifi_vdev_txmsg vdev_txmsgext; /**< Transmits special data. */ struct nss_wifi_vdev_vow_dbg_cfg_msg vdev_vow_dbg_cfg; diff --git a/exports/nss_wifili_if.h b/exports/nss_wifili_if.h index fce20fd..1f26d67 100644 --- a/exports/nss_wifili_if.h +++ b/exports/nss_wifili_if.h @@ -62,8 +62,12 @@ /**< Maximum number of bandwidth supported. */ #define NSS_WIFILI_REPT_MU_MIMO 1 #define NSS_WIFILI_REPT_MU_OFDMA_MIMO 3 +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) +#define NSS_WIFILI_MAX_RESERVED_TYPE 3 +#else #define NSS_WIFILI_MAX_RESERVED_TYPE 2 /**< Maximum reserved type. */ +#endif #define NSS_WIFILI_SOC_PER_PACKET_METADATA_SIZE 60 /**< Metadata area total size. */ #define NSS_WIFILI_MEC_PEER_ID 0xDEAD @@ -1333,7 +1337,9 @@ struct nss_wifili_rx_err { struct nss_wifili_rx_ctrl_stats { struct nss_wifili_rx_err err; /**< Rx peer errors. */ uint32_t multipass_rx_pkt_drop; /**< Total number of multipass packets without a VLAN header. */ +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) uint32_t peer_unauth_rx_pkt_drop; /**< Number of receive packets dropped due to an authorized peer. */ +#endif uint32_t reserved_type[NSS_WIFILI_MAX_RESERVED_TYPE]; /**< Reserved type for future use. */ uint32_t non_amsdu_cnt; /**< Number of MSDUs with no MSDU level aggregation. */ uint32_t amsdu_cnt; /**< Number of MSDUs part of AMSDU. */ @@ -1810,10 +1816,12 @@ struct nss_wifili_msg { /**< Peer four-address event message. */ struct nss_wifili_dbdc_repeater_loop_detection_msg wdrldm; /**< Wifili DBDC repeater loop detection message. */ +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) struct nss_wifili_peer_update_auth_flag peer_auth; /**< Peer authentication flag message. */ struct nss_wifili_mesh_capability_info cap_info; /**< Mesh capability flag. */ +#endif } msg; /**< Message payload. */ }; diff --git a/nss_ipv4_stats.c b/nss_ipv4_stats.c index 39b162c..c875a63 100644 --- a/nss_ipv4_stats.c +++ b/nss_ipv4_stats.c @@ -177,9 +177,11 @@ void nss_ipv4_stats_node_sync(struct nss_ctx_instance *nss_ctx, struct nss_ipv4_ nss_ipv4_stats[NSS_IPV4_STATS_MC_CONNECTION_DESTROY_REQUESTS] += nins->ipv4_mc_connection_destroy_requests; nss_ipv4_stats[NSS_IPV4_STATS_MC_CONNECTION_DESTROY_MISSES] += nins->ipv4_mc_connection_destroy_misses; nss_ipv4_stats[NSS_IPV4_STATS_MC_CONNECTION_FLUSHES] += nins->ipv4_mc_connection_flushes; +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) nss_ipv4_stats[NSS_IPV4_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFNUM] += nins->ipv4_connection_create_invalid_mirror_ifnum; nss_ipv4_stats[NSS_IPV4_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFTYPE] += nins->ipv4_connection_create_invalid_mirror_iftype; nss_ipv4_stats[NSS_IPV4_STATS_MIRROR_FAILURES] += nins->ipv4_mirror_failures; +#endif for (i = 0; i < NSS_IPV4_EXCEPTION_EVENT_MAX; i++) { nss_ipv4_exception_stats[i] += nins->exception_events[i]; diff --git a/nss_ipv4_strings.c b/nss_ipv4_strings.c index 77ff352..ce4c249 100644 --- a/nss_ipv4_strings.c +++ b/nss_ipv4_strings.c @@ -137,9 +137,11 @@ struct nss_stats_info nss_ipv4_strings_stats[NSS_IPV4_STATS_MAX] = { {"mc_destroy_requests" , NSS_STATS_TYPE_SPECIAL}, {"mc_destroy_misses" , NSS_STATS_TYPE_SPECIAL}, {"mc_flushes" , NSS_STATS_TYPE_SPECIAL}, +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) {"mirror_invalid_ifnum_conn_create_req" , NSS_STATS_TYPE_SPECIAL}, {"mirror_invalid_iftype_conn_create_req" , NSS_STATS_TYPE_SPECIAL}, {"mirror_failures" , NSS_STATS_TYPE_SPECIAL}, +#endif }; /* diff --git a/nss_ipv6_stats.c b/nss_ipv6_stats.c index 617f55b..a492a6c 100644 --- a/nss_ipv6_stats.c +++ b/nss_ipv6_stats.c @@ -180,9 +180,11 @@ void nss_ipv6_stats_node_sync(struct nss_ctx_instance *nss_ctx, struct nss_ipv6_ nss_ipv6_stats[NSS_IPV6_STATS_MC_CONNECTION_DESTROY_REQUESTS] += nins->ipv6_mc_connection_destroy_requests; nss_ipv6_stats[NSS_IPV6_STATS_MC_CONNECTION_DESTROY_MISSES] += nins->ipv6_mc_connection_destroy_misses; nss_ipv6_stats[NSS_IPV6_STATS_MC_CONNECTION_FLUSHES] += nins->ipv6_mc_connection_flushes; +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) nss_ipv6_stats[NSS_IPV6_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFNUM] += nins->ipv6_connection_create_invalid_mirror_ifnum; nss_ipv6_stats[NSS_IPV6_STATS_CONNECTION_CREATE_INVALID_MIRROR_IFTYPE] += nins->ipv6_connection_create_invalid_mirror_iftype; nss_ipv6_stats[NSS_IPV6_STATS_MIRROR_FAILURES] += nins->ipv6_mirror_failures; +#endif for (i = 0; i < NSS_IPV6_EXCEPTION_EVENT_MAX; i++) { nss_ipv6_exception_stats[i] += nins->exception_events[i]; diff --git a/nss_ipv6_strings.c b/nss_ipv6_strings.c index 57b100f..29df9c9 100644 --- a/nss_ipv6_strings.c +++ b/nss_ipv6_strings.c @@ -115,9 +115,11 @@ struct nss_stats_info nss_ipv6_strings_stats[NSS_IPV6_STATS_MAX] = { {"mc_destroy_requests" ,NSS_STATS_TYPE_SPECIAL}, {"mc_destroy_misses" ,NSS_STATS_TYPE_SPECIAL}, {"mc_flushes" ,NSS_STATS_TYPE_SPECIAL}, +#if (NSS_FW_VERSION_CODE > NSS_FW_VERSION(11,3)) {"mirror_invalid_ifnum_conn_create_req" ,NSS_STATS_TYPE_SPECIAL}, {"mirror_invalid_iftype_conn_create_req" ,NSS_STATS_TYPE_SPECIAL}, {"mirror_failures" ,NSS_STATS_TYPE_SPECIAL}, +#endif }; /* -- 2.31.1