common/sfc_efx/base: fix code analysis issues
cover common/sfc_efx/base: fix code analysis issues
This series addresses code analysis defects in the common/sfc_efx/base library.
The first four patches fix excessive stack consumption in MCDI helper functions, each exceeding 1 KB on-stack, by switching to heap-allocated payload buffers.
The remaining ten patches correct SAL annotations, add NULL checks across netport and filter helpers, resolving uninitialised memory, buffer overrun, and potential dereference issues. The final patch widens loop variable types to address a CodeQL warning.
Andy Moreton (14):
common/sfc_efx/base: reduce stack in RSS context table write common/sfc_efx/base: reduce stack in get addr regions MCDI common/sfc_efx/base: reduce stack in set addr regions MCDI common/sfc_efx/base: reduce stack in netport stat describe common/sfc_efx/base: fix filter saved spec handling common/sfc_efx/base: fix annotations in client MAC addr get common/sfc_efx/base: fix annotations in HW-SW mask converter common/sfc_efx/base: fix annotations in get fixed port props common/sfc_efx/base: fix annotations in SW-HW enum converter common/sfc_efx/base: fix annotation in netport stat describe common/sfc_efx/base: fix flex array in netport stat describe common/sfc_efx/base: fix filter in SW-HW mask converter common/sfc_efx/base: rework SW mask to HW enum converter common/sfc_efx/base: cleanup wider type comparisons in loops
drivers/common/sfc_efx/base/ef10_filter.c | 11 +- drivers/common/sfc_efx/base/ef10_mcdi.c | 2 +- drivers/common/sfc_efx/base/ef10_nvram.c | 4 +- drivers/common/sfc_efx/base/ef10_rx.c | 22 +++- drivers/common/sfc_efx/base/efx.h | 3 +- drivers/common/sfc_efx/base/efx_bootcfg.c | 2 +- drivers/common/sfc_efx/base/efx_mcdi.c | 50 +++++-- drivers/common/sfc_efx/base/efx_np.c | 152 ++++++++++++---------- drivers/common/sfc_efx/base/mcdi_mon.c | 2 +- 9 files changed, 155 insertions(+), 93 deletions(-)
Signature · 1 line
2.47.3
PATCH 1/14 common/sfc_efx/base: reduce stack in RSS context table write
From: Andy Moreton <[email protected]>
Code analysis reports an error for excessive stack consumption (over 1KB). Use a heap allocated payload buffer instead.
--- drivers/common/sfc_efx/base/ef10_rx.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/common/sfc_efx/base/ef10_rx.c +17 -5
@@ -394,11 +394,10 @@ efx_mcdi_rss_context_write_table( __in unsigned int nentries) {const efx_nic_cfg_t *encp =efx_nic_cfg_get (enp); +uint8_t *payload =NULL ;efx_mcdi_req_t req; -EFX_MCDI_DECLARE_BUF (payload, -MC_CMD_RSS_CONTEXT_WRITE_TABLE_IN_LENMAX_MCDI2 , -MC_CMD_RSS_CONTEXT_WRITE_TABLE_OUT_LEN );unsigned int i; +size_t size;int rc; if (nentries >
@@ -413,6 +412,15 @@ efx_mcdi_rss_context_write_table( goto fail2; } + size =MAX (MC_CMD_RSS_CONTEXT_WRITE_TABLE_IN_LEN (nentries), +MC_CMD_RSS_CONTEXT_WRITE_TABLE_OUT_LEN ); + +EFSYS_KMEM_ALLOC (enp->en_esip, size, payload); +if (payload ==NULL ) { + rc =ENOMEM ; + goto fail3; + } + req.emr_cmd =MC_CMD_RSS_CONTEXT_WRITE_TABLE ; req.emr_in_buf = payload; req.emr_in_length =MC_CMD_RSS_CONTEXT_WRITE_TABLE_IN_LEN (nentries);
@@ -425,7 +433,7 @@ efx_mcdi_rss_context_write_table(for (i =0 ; i < nentries; ++i) {if (table[i] >= encp->enc_rx_scale_indirection_max_nqueues) { rc =EINVAL ; - goto fail3; + goto fail4; } MCDI_IN_POPULATE_INDEXED_DWORD_2(req,
@@ -437,13 +445,17 @@ efx_mcdi_rss_context_write_table(efx_mcdi_execute (enp, &req);if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail4; + goto fail5; } +EFSYS_KMEM_FREE (enp->en_esip, size, payload);return (0 ); +fail5: +EFSYS_PROBE (fail5); fail4:EFSYS_PROBE (fail4); +EFSYS_KMEM_FREE (enp->en_esip, size, payload); fail3:EFSYS_PROBE (fail3); fail2:
Signature · 1 line
2.47.3
PATCH 2/14 common/sfc_efx/base: reduce stack in get addr regions MCDI
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports an error for excessive stack consumption (over 1KB). Use a heap allocated payload buffer instead.
--- drivers/common/sfc_efx/base/efx_mcdi.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/common/sfc_efx/base/efx_mcdi.c +20 -6
@@ -3439,15 +3439,24 @@ efx_mcdi_get_nic_addr_regions( __in efx_nic_t *enp, __out efx_nic_dma_region_info_t *endrip) { -EFX_MCDI_DECLARE_BUF (payload ,MC_CMD_GET_DESC_ADDR_REGIONS_IN_LEN , -MC_CMD_GET_DESC_ADDR_REGIONS_OUT_LENMAX_MCDI2 ); + uint8_t *payload = NULL;efx_xword_t *regions;efx_mcdi_req_t req; +size_t size;efx_rc_t rc;size_t alloc_size;unsigned int nregions;unsigned int i; + size =MAX (MC_CMD_GET_DESC_ADDR_REGIONS_IN_LEN , +MC_CMD_GET_DESC_ADDR_REGIONS_OUT_LENMAX_MCDI2 ); + +EFSYS_KMEM_ALLOC (enp->en_esip, size, payload); +if (payload ==NULL ) { + rc =ENOMEM ; + goto fail1; + } + req.emr_cmd =MC_CMD_GET_DESC_ADDR_REGIONS ; req.emr_in_buf = payload; req.emr_in_length =MC_CMD_GET_DESC_ADDR_REGIONS_IN_LEN ;
@@ -3458,13 +3467,13 @@ efx_mcdi_get_nic_addr_regions(if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail1; + goto fail2; }if (req.emr_out_length_used <MC_CMD_GET_DESC_ADDR_REGIONS_OUT_LENMIN ) { rc =EMSGSIZE ; - goto fail2; + goto fail3; } nregions = MC_CMD_GET_DESC_ADDR_REGIONS_OUT_REGIONS_NUM(
@@ -3477,7 +3486,7 @@ efx_mcdi_get_nic_addr_regions( alloc_size = nregions *sizeof (endrip->endri_regions[0 ]);if (alloc_size /sizeof (endrip->endri_regions[0 ]) != nregions) { rc =ENOMEM ; - goto fail3; + goto fail4; } EFSYS_KMEM_ALLOC(enp->en_esip,
@@ -3485,7 +3494,7 @@ efx_mcdi_get_nic_addr_regions( endrip->endri_regions);if (endrip->endri_regions ==NULL ) { rc =ENOMEM ; - goto fail4; + goto fail5; } endrip->endri_count = nregions;
@@ -3517,14 +3526,19 @@ efx_mcdi_get_nic_addr_regions( DESC_ADDR_REGION_TRGT_ADDR_ALIGN_LOG2); } +EFSYS_KMEM_FREE (enp->en_esip, size, payload); +return (0 ); +fail5: +EFSYS_PROBE (fail5); fail4:EFSYS_PROBE (fail4); fail3:EFSYS_PROBE (fail3); fail2:EFSYS_PROBE (fail2); +EFSYS_KMEM_FREE (enp->en_esip, size, payload); fail1:EFSYS_PROBE1 (fail1, efx_rc_t, rc);
Signature · 1 line
2.47.3
PATCH 3/14 common/sfc_efx/base: reduce stack in set addr regions MCDI
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports an error for excessive stack consumption (over 1KB). Use a heap allocated payload buffer instead.
--- drivers/common/sfc_efx/base/efx_mcdi.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/common/sfc_efx/base/efx_mcdi.c +17 -4
@@ -3550,12 +3550,11 @@ efx_mcdi_set_nic_addr_regions( __in efx_nic_t *enp, __in const efx_nic_dma_region_info_t *endrip) { -EFX_MCDI_DECLARE_BUF (payload , -MC_CMD_SET_DESC_ADDR_REGIONS_IN_LENMAX_MCDI2 , -MC_CMD_SET_DESC_ADDR_REGIONS_OUT_LEN ); efx_qword_t *trgt_addr_base; +uint8_t *payload =NULL ;efx_mcdi_req_t req;unsigned int i; +size_t size;efx_rc_t rc; if (endrip->endri_count >
@@ -3564,6 +3563,15 @@ efx_mcdi_set_nic_addr_regions( goto fail1; } + size =MAX (MC_CMD_SET_DESC_ADDR_REGIONS_IN_LEN (endrip->endri_count), +MC_CMD_SET_DESC_ADDR_REGIONS_OUT_LEN ); + +EFSYS_KMEM_ALLOC (enp->en_esip, size, payload); +if (payload ==NULL ) { + rc =ENOMEM ; + goto fail2; + } + req.emr_cmd =MC_CMD_SET_DESC_ADDR_REGIONS ; req.emr_in_buf = payload; req.emr_in_length =
@@ -3598,11 +3606,16 @@ efx_mcdi_set_nic_addr_regions(if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail2; + goto fail3; } +EFSYS_KMEM_FREE (enp->en_esip, size, payload); +return (0 ); +fail3: +EFSYS_PROBE (fail3); +EFSYS_KMEM_FREE (enp->en_esip, size, payload); fail2:EFSYS_PROBE (fail2); fail1:
Signature · 1 line
2.47.3
PATCH 4/14 common/sfc_efx/base: reduce stack in netport stat describe
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports an error for excessive stack consumption (over 1KB). Use a heap allocated payload buffer instead.
--- drivers/common/sfc_efx/base/efx_np.c | 37 +++++++++++++++++++--------- 1 file changed, 25 insertions(+), 12 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +25 -12
@@ -778,22 +778,30 @@ efx_np_stats_describe( __out_opt uint32_t *nprocessedp, __out_opt uint32_t *nstats_maxp) { -EFX_MCDI_DECLARE_BUF (payload , -MC_CMD_MAC_STATISTICS_DESCRIPTOR_IN_LEN , -MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMAX_MCDI2 ); + uint8_t *payload = NULL;uint32_t nprocessed;efx_mcdi_req_t req;uint8_t *entries;uint32_t stride;unsigned int i;size_t out_sz; +size_t size;efx_rc_t rc; - req.emr_out_length =MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMAX_MCDI2 ; - req.emr_in_length =MC_CMD_MAC_STATISTICS_DESCRIPTOR_IN_LEN ; + size =MAX (MC_CMD_MAC_STATISTICS_DESCRIPTOR_IN_LEN , +MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMAX_MCDI2 ); + +EFSYS_KMEM_ALLOC (enp->en_esip, size, payload); +if (payload ==NULL ) { + rc =ENOMEM ; + goto fail1; + } + req.emr_cmd =MC_CMD_MAC_STATISTICS_DESCRIPTOR ; - req.emr_out_buf = payload; req.emr_in_buf = payload; + req.emr_in_length =MC_CMD_MAC_STATISTICS_DESCRIPTOR_IN_LEN ; + req.emr_out_buf = payload; + req.emr_out_length =MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMAX_MCDI2 ;MCDI_IN_SET_DWORD (req,MAC_STATISTICS_DESCRIPTOR_IN_PORT_HANDLE , nph);MCDI_IN_SET_DWORD (req,MAC_STATISTICS_DESCRIPTOR_IN_OFFSET , req_ofst);
@@ -802,13 +810,13 @@ efx_np_stats_describe(if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail1; + goto fail2; } out_sz = req.emr_out_length_used;if (out_sz <MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMIN ) { rc =EMSGSIZE ; - goto fail2; + goto fail3; }if (nstats_maxp !=NULL ) {
@@ -818,13 +826,13 @@ efx_np_stats_describe( }if (lut_nentries ==0 || lut ==NULL || nprocessedp ==NULL ) -return (0 ); + goto out; stride =MCDI_OUT_DWORD (req,MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_SIZE ); nprocessed =MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES_NUM (out_sz);if (nprocessed ==0 ) { rc =EMSGSIZE ; - goto fail3; + goto fail4; } entries = MCDI_OUT2(req, uint8_t,
@@ -834,14 +842,19 @@ efx_np_stats_describe(efx_np_stat_describe (entries + i * stride, lut_nentries, lut); *nprocessedp = nprocessed; + +out: +EFSYS_KMEM_FREE (enp->en_esip, size, payload); +return (0 ); +fail4: +EFSYS_PROBE (fail4); fail3:EFSYS_PROBE (fail3); - fail2:EFSYS_PROBE (fail2); - +EFSYS_KMEM_FREE (enp->en_esip, size, payload); fail1:EFSYS_PROBE1 (fail1, efx_rc_t, rc);return (rc);
Signature · 1 line
2.47.3
PATCH 5/14 common/sfc_efx/base: fix filter saved spec handling
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code Analysis notes that saved_spec can be NULL when passed into ef10_filter_add_select_action and ef10_filter_add_execute_action from ef10_filter_add_internal.
Fix the annotations to show that the saved_spec is optional, and add NULL checks before dereferencing it.
--- drivers/common/sfc_efx/base/ef10_filter.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/common/sfc_efx/base/ef10_filter.c +5 -4
@@ -690,7 +690,7 @@ ef10_filter_add_lookup_equal_spec(static void ef10_filter_add_select_action ( - __in efx_filter_spec_t *saved_spec, + __in_opt efx_filter_spec_t *saved_spec, __in efx_filter_spec_t *spec, __out enum ef10_filter_add_action_e *action, __out efx_filter_spec_t **overridden_spec)
@@ -752,7 +752,7 @@ ef10_filter_add_select_action( static __checkReturn efx_rc_t ef10_filter_add_execute_action( __in efx_nic_t *enp, - __in efx_filter_spec_t *saved_spec, + __in_opt efx_filter_spec_t *saved_spec, __in efx_filter_spec_t *spec, __in efx_filter_spec_t *overridden_spec, __in enum ef10_filter_add_action_e action,
@@ -769,7 +769,8 @@ ef10_filter_add_execute_action( goto out_unlock; }else if (action ==EF10_FILTER_ADD_STORE ) {EFSYS_ASSERT (overridden_spec !=NULL ); - saved_spec->efs_overridden_spec = overridden_spec; +if (saved_spec !=NULL ) + saved_spec->efs_overridden_spec = overridden_spec; goto out_unlock; }
@@ -806,7 +807,7 @@ ef10_filter_add_execute_action(EFSYS_LOCK (enp->en_eslp, state); -if (action ==EF10_FILTER_ADD_REPLACE ) { +if ((action ==EF10_FILTER_ADD_REPLACE ) && (saved_spec !=NULL )) {/* Update the fields that may differ */ saved_spec->efs_priority = spec->efs_priority; saved_spec->efs_flags = spec->efs_flags;
Signature · 1 line
2.47.3
PATCH 6/14 common/sfc_efx/base: fix annotations in client MAC addr get
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Fix annotations to show the size written to addr_bytes.
--- drivers/common/sfc_efx/base/efx.h | 3 ++- drivers/common/sfc_efx/base/efx_mcdi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/common/sfc_efx/base/efx.h +2 -1
@@ -439,7 +439,8 @@ extern __checkReturn efx_rc_tefx_mcdi_client_mac_addr_get ( __in efx_nic_t *enp, __in uint32_t client_handle, - __out uint8_t addr_bytes[EFX_MAC_ADDR_LEN]); +__out_bcount (EFX_MAC_ADDR_LEN ) + uint8_t addr_bytes[EFX_MAC_ADDR_LEN]);LIBEFX_API extern __checkReturn efx_rc_t
drivers/common/sfc_efx/base/efx_mcdi.c +2 -1
@@ -737,7 +737,8 @@ efx_mcdi_get_own_client_handle(efx_mcdi_client_mac_addr_get ( __in efx_nic_t *enp, __in uint32_t client_handle, - __out uint8_t addr_bytes[EFX_MAC_ADDR_LEN]) +__out_bcount (EFX_MAC_ADDR_LEN ) + uint8_t addr_bytes[EFX_MAC_ADDR_LEN]) { efx_mcdi_req_t req; EFX_MCDI_DECLARE_BUF(payload,
Signature · 1 line
2.47.3
PATCH 7/14 common/sfc_efx/base: fix annotations in HW-SW mask converter
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports that efx_np_cap_mask_hw_to_sw does not always write to sw_cap_maskp. Fix the annotation to show it is valid on input, and initialise the mask in efx_np_cap_hw_data_to_sw_mask.
--- drivers/common/sfc_efx/base/efx_np.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +8 -6
@@ -190,7 +190,7 @@ efx_np_cap_mask_hw_to_sw( __in unsigned int hw_sw_map_nentries, __in_bcount(hw_cap_data_nbytes) const uint8_t *hw_cap_data, __in size_t hw_cap_data_nbytes, - __out uint32_t *sw_cap_maskp) + __inout uint32_t *sw_cap_maskp) { FOREACH_SUP_CAP(hw_sw_map, hw_sw_map_nentries, hw_cap_data, hw_cap_data_nbytes) {
@@ -216,6 +216,8 @@ efx_np_cap_hw_data_to_sw_mask( __in const uint8_t *hw_data, __out uint32_t *sw_maskp) { + *sw_maskp =0 ; +EFX_NP_CAP_MASK_HW_TO_SW (efx_np_cap_map_tech,ETH_AN_FIELDS_TECH_MASK , hw_data, sw_maskp);
@@ -429,21 +431,21 @@ efx_np_link_state( _NOTE(ARGUNUSED(lbp))#endif /* EFSYS_OPT_LOOPBACK */ -if (lsp->enls_an_supported !=B_FALSE ) - lsp->enls_adv_cap_mask |=1U <<EFX_PHY_CAP_AN ; -efx_np_cap_hw_data_to_sw_mask ( MCDI_OUT2(req, const uint8_t, LINK_STATE_OUT_ADVERTISED_ABILITIES), &lsp->enls_adv_cap_mask); -if (status_flags & (1U <<MC_CMD_LINK_STATUS_FLAGS_AN_ABLE )) - lsp->enls_lp_cap_mask |=1U <<EFX_PHY_CAP_AN ; +if (lsp->enls_an_supported !=B_FALSE ) + lsp->enls_adv_cap_mask |=1U <<EFX_PHY_CAP_AN ;efx_np_cap_hw_data_to_sw_mask (MCDI_OUT2 (req ,const uint8_t , LINK_STATE_OUT_LINK_PARTNER_ABILITIES), &lsp->enls_lp_cap_mask); +if (status_flags & (1U <<MC_CMD_LINK_STATUS_FLAGS_AN_ABLE )) + lsp->enls_lp_cap_mask |=1U <<EFX_PHY_CAP_AN ; + tech =MCDI_OUT_WORD (req,LINK_STATE_OUT_LINK_TECHNOLOGY );if (tech <EFX_ARRAY_SIZE (efx_np_tech_to_lane_count))
Signature · 1 line
2.47.3
PATCH 8/14 common/sfc_efx/base: fix annotations in get fixed port props
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports a buffer overrun for the sup_cap_rawp argument. Fix the annotation to show the writable buffer size.
--- drivers/common/sfc_efx/base/efx_np.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/common/sfc_efx/base/efx_np.c +2 -1
@@ -235,7 +235,8 @@ static __checkReturn efx_rc_tefx_np_get_fixed_port_props ( __in efx_nic_t *enp, __in efx_np_handle_t nph, - __out_opt uint8_t *sup_cap_rawp, + __out_bcount_opt(MC_CMD_ETH_AN_FIELDS_LEN) + uint8_t *sup_cap_rawp, __out_opt uint32_t *sup_cap_maskp, __out_opt efx_qword_t *loopback_cap_maskp) {
Signature · 1 line
2.47.3
PATCH 9/14 common/sfc_efx/base: fix annotations in SW-HW enum converter
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports returning uninitialised memory in *enum_hwp. Fix the annotations to show that the write only occurs on successful return.
--- drivers/common/sfc_efx/base/efx_np.c | 1 + 1 file changed, 1 insertion(+)
drivers/common/sfc_efx/base/efx_np.c +1 -0
@@ -504,6 +504,7 @@ efx_np_sw_link_mode_to_cap(return (0 ); } +__success(*supportedp != 0) static void efx_np_cap_enum_sw_to_hw( __in_ecount(hw_sw_map_nentries) const struct efx_np_cap_map *hw_sw_map,
Signature · 1 line
2.47.3
PATCH 10/14 common/sfc_efx/base: fix annotation in netport stat describe
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reported a NULL dereference of the lut parameter. Fix the annotation to show it is not optional (must be non-NULL).
--- drivers/common/sfc_efx/base/efx_np.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/sfc_efx/base/efx_np.c +1 -1
@@ -734,7 +734,7 @@ static voidefx_np_stat_describe ( __in uint8_t *hw_entry_buf, __in unsigned int lut_nentries, - __out_ecount_opt(lut_nentries) efx_np_stat_t *lut) + __out_ecount(lut_nentries) efx_np_stat_t *lut) { const efx_np_stat_t *map;efx_mac_stat_t sw_id;
Signature · 1 line
2.47.3
PATCH 11/14 common/sfc_efx/base: fix flex array in netport stat describe
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reported returning uninitialised memory at *lut and *nprocessedp. Refactor to ensure these parameters are only used when non-NULL.
This function should also be using the ENTRY_COUNT field for the number of descriptors returned, as the descriptor size is not known statically (they are extensible). Also use the MORE_ENTRIES flag to determine if all of the descriptors have been fetched.
--- drivers/common/sfc_efx/base/efx_np.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +16 -12
@@ -783,10 +783,11 @@ efx_np_stats_describe( __out_opt uint32_t *nstats_maxp) {uint8_t *payload =NULL ; -uint32_t nprocessed;efx_mcdi_req_t req;uint8_t *entries;uint32_t stride; +uint32_t count; +uint32_t more;unsigned int i;size_t out_sz;size_t size;
@@ -829,25 +830,28 @@ efx_np_stats_describe(sizeof (efx_qword_t); } -if (lut_nentries ==0 || lut ==NULL || nprocessedp ==NULL ) - goto out; - stride =MCDI_OUT_DWORD (req,MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_SIZE ); - nprocessed =MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES_NUM (out_sz); -if (nprocessed ==0 ) { + count =MCDI_OUT_DWORD (req,MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_COUNT ); + more =MCDI_OUT_DWORD (req,MAC_STATISTICS_DESCRIPTOR_OUT_MORE_ENTRIES ); + +if ((count ==0 ) && (more !=0 )) { rc =EMSGSIZE ; goto fail4; } - entries =MCDI_OUT2 (req, uint8_t, -MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES ); +if (lut !=NULL ) { + entries =MCDI_OUT2 (req, uint8_t, +MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES ); -for (i =0 ; i < nprocessed; ++i) -efx_np_stat_describe (entries + i * stride, lut_nentries, lut); +for (i =0 ; i < count; ++i) { +efx_np_stat_describe (entries + i * stride, + lut_nentries, lut); + } + } - *nprocessedp = nprocessed; +if (nprocessedp !=NULL ) + *nprocessedp = count; -out:EFSYS_KMEM_FREE (enp->en_esip, size, payload);return (0 );
Signature · 1 line
2.47.3
PATCH 12/14 common/sfc_efx/base: fix filter in SW-HW mask converter
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports that the optional filter_arg could be used to invoke the callback, but that function has type efx_np_cap_filter_cb, where the argument is required. Add a NULL check to ensure that the filter_arg is valid when invoking the callback.
--- drivers/common/sfc_efx/base/efx_np.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +3 -3
@@ -1160,7 +1160,7 @@ efx_np_cap_mask_sw_to_hw( __in uint32_t mask_sw, __in_opt efx_np_cap_filter_cb *filter_cb, __in_opt void *filter_arg, - __out uint8_t *mask_hwp) + __inout uint8_t *mask_hwp) { FOREACH_SUP_CAP(hw_sw_map, hw_sw_map_nentries, hw_cap_data, hw_cap_data_nbytes) {
@@ -1169,8 +1169,8 @@ efx_np_cap_mask_sw_to_hw(if ((mask_sw & flag_sw) != flag_sw)continue ; -if (filter_cb !=NULL && -filter_cb (hw_sw_map->encm_hw, filter_arg) ==B_FALSE ) +if ((filter_cb !=NULL ) && (filter_arg !=NULL ) && + (filter_cb (hw_sw_map->encm_hw, filter_arg) ==B_FALSE ))continue ; mask_hwp[CAP_BYTE (hw_sw_map)] |=CAP_FLAG (hw_sw_map);
Signature · 1 line
2.47.3
PATCH 13/14 common/sfc_efx/base: rework SW mask to HW enum converter
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports that *enum_hwp is not written on successful return on some paths through this function. Refactor to simplify the code, and adjust the annotations so it is clear that *enum_hwp is only written on successful return. Adjust FEC handling in efx_np_link_ctrl to allow for *supportedp always being updated.
Code analysis also reports that the optional filter_arg can be NULL when invoking filter_cb, but the callback argument is not optional. Check that filter_arg is non-NULL to ensure correct usage.
--- drivers/common/sfc_efx/base/efx_np.c | 65 ++++++++++++++-------------- 1 file changed, 32 insertions(+), 33 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +32 -33
@@ -1202,59 +1202,57 @@ efx_np_cap_mask_sw_to_hw( (_filter_cb), (_filter_arg), (_mask_hwp))static void +__success(*supportedp != 0)efx_np_cap_sw_mask_to_hw_enum ( __in_ecount(hw_sw_map_nentries) const struct efx_np_cap_map *hw_sw_map, __in unsigned int hw_sw_map_nentries, __in_bcount(hw_cap_data_nbytes) const uint8_t *hw_cap_data, __in size_t hw_cap_data_nbytes, __in uint32_t mask_sw, + __in uint16_t enum_hw_def, __in_opt efx_np_cap_filter_cb *filter_cb, __in_opt void *filter_arg, __out boolean_t *supportedp, __out_opt uint16_t *enum_hwp) { -unsigned int sw_nflags_req =0 ; -uint32_t sw_check_mask =0 ; + boolean_t supported = B_FALSE; +uint32_t flags_seen =0 ;unsigned int i; for (i = 0; i < hw_sw_map_nentries; ++i) { -uint32_t flag_sw =1U << hw_sw_map->encm_sw; -unsigned int byte_idx =CAP_BYTE (hw_sw_map); -uint8_t flag_hw =CAP_FLAG (hw_sw_map); +uint32_t flag_sw =1U << hw_sw_map[i].encm_sw; +unsigned int byte_idx =CAP_BYTE (&hw_sw_map[i]); +uint8_t flag_hw =CAP_FLAG (&hw_sw_map[i]); -if (byte_idx >= hw_cap_data_nbytes) { - ++(hw_sw_map); +if (byte_idx >= hw_cap_data_nbytes)continue ; - } -if ((mask_sw & flag_sw) == flag_sw) { -if ((sw_check_mask & flag_sw) ==0 ) - ++(sw_nflags_req); +if ((mask_sw & flag_sw) != flag_sw) +continue ; - sw_check_mask |= flag_sw; + flags_seen |= flag_sw; -if ((hw_cap_data[byte_idx] & flag_hw) == flag_hw) { -if (filter_cb ==NULL || -filter_cb (hw_sw_map->encm_hw, filter_arg) != -B_FALSE ) { - mask_sw &= ~(flag_sw); +if ((hw_cap_data[byte_idx] & flag_hw) != flag_hw) +continue ; -if (enum_hwp !=NULL ) - *enum_hwp = hw_sw_map->encm_hw; - } - } - } +if ((filter_cb !=NULL ) && (filter_arg !=NULL ) && + (filter_cb (hw_sw_map[i].encm_hw, filter_arg) ==B_FALSE )) +continue ; + +if (enum_hwp !=NULL ) + *enum_hwp = hw_sw_map[i].encm_hw; - ++(hw_sw_map); + supported =B_TRUE ; } -if (sw_check_mask !=0 && (mask_sw & sw_check_mask) == sw_check_mask) { -/* Failed to select the enum by at least one capability bit. */ - *supportedp =B_FALSE ; -return ; +if (flags_seen ==0 ) { +if (enum_hwp !=NULL ) + *enum_hwp = enum_hw_def; + + supported =B_TRUE ; } - *supportedp =B_TRUE ; + *supportedp = supported; }/*
@@ -1266,12 +1264,13 @@ efx_np_cap_sw_mask_to_hw_enum(*/ #define EFX_NP_CAP_SW_MASK_TO_HW_ENUM ( \ _hw_sw_cap_map, _hw_cap_section, _hw_cap_data, \ - _mask_sw, _filter_cb, _filter_arg, _supportedp, _enum_hwp) \ + _mask_sw, _enum_hw_def, _filter_cb, _filter_arg, \ + _supportedp, _enum_hwp) \ efx_np_cap_sw_mask_to_hw_enum((_hw_sw_cap_map), \ EFX_ARRAY_SIZE(_hw_sw_cap_map), \ MCDI_STRUCT_MEMBER((_hw_cap_data), const uint8_t, \ MC_CMD_##_hw_cap_section), \ - MC_CMD_##_hw_cap_section##_LEN, (_mask_sw), \ + MC_CMD_##_hw_cap_section##_LEN, (_mask_sw), (_enum_hw_def), \ (_filter_cb), (_filter_arg), \ (_supportedp), (_enum_hwp))
@@ -1386,6 +1385,7 @@ efx_np_link_ctrl( }else {EFX_NP_CAP_SW_MASK_TO_HW_ENUM (efx_np_cap_map_tech,ETH_AN_FIELDS_TECH_MASK , cap_data_raw, cap_mask_sw, +MC_CMD_ETH_TECH_AUTO , efx_np_filter_tech_by_lane_count_cb, &lane_count, &supported, &link_tech);
@@ -1414,10 +1414,9 @@ efx_np_link_ctrl(*/ EFX_NP_CAP_SW_MASK_TO_HW_ENUM (efx_np_cap_map_fec_req,ETH_AN_FIELDS_FEC_MASK , cap_data_raw, cap_mask_sw, -NULL ,NULL , &supported, &cap_enum_hw); +MC_CMD_FEC_AUTO ,NULL ,NULL , &supported, &cap_enum_hw); -if ((cap_mask_sw &EFX_PHY_CAP_FEC_MASK ) !=0 - && supported ==B_FALSE ) { +if (supported ==B_FALSE ) { rc =ENOTSUP ; goto fail5; }
Signature · 1 line
2.47.3
PATCH 14/14 common/sfc_efx/base: cleanup wider type comparisons in loops
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
CodeQL reports errors for comparisons between narrow and wider types in loop conditions [cpp/infiniteloop]. Use the wider types to fix that.
--- drivers/common/sfc_efx/base/ef10_filter.c | 2 +- drivers/common/sfc_efx/base/ef10_mcdi.c | 2 +- drivers/common/sfc_efx/base/ef10_nvram.c | 4 ++-- drivers/common/sfc_efx/base/efx_bootcfg.c | 2 +- drivers/common/sfc_efx/base/mcdi_mon.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/common/sfc_efx/base/ef10_filter.c +1 -1
@@ -1300,7 +1300,7 @@ ef10_filter_supported_filters(size_t mcdi_list_length;size_t mcdi_encap_list_length;size_t list_length; -uint32_t i; +size_t i;uint32_t next_buf_idx;size_t next_buf_length;efx_rc_t rc;
drivers/common/sfc_efx/base/ef10_mcdi.c +1 -1
@@ -140,7 +140,7 @@ ef10_mcdi_send_request(const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;efsys_mem_t *esmp = emtp->emt_dma_mem;efx_dword_t dword; -unsigned int pos; +size_t pos;EFSYS_ASSERT (EFX_FAMILY_IS_EF100 (enp) ||EFX_FAMILY_IS_EF10 (enp));
drivers/common/sfc_efx/base/ef10_nvram.c +2 -2
@@ -2386,7 +2386,7 @@ ef10_nvram_type_to_partn(efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);ef10_parttbl_entry_t *parttbl =NULL ;size_t parttbl_rows =0 ; -unsigned int i; +size_t i; EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID); EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
@@ -2418,7 +2418,7 @@ ef10_nvram_partn_to_type(efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);ef10_parttbl_entry_t *parttbl =NULL ;size_t parttbl_rows =0 ; -unsigned int i; +size_t i;EFSYS_ASSERT (typep !=NULL );
drivers/common/sfc_efx/base/efx_bootcfg.c +1 -1
@@ -140,8 +140,8 @@ efx_dhcp_csum( __in_bcount(size) uint8_t const *data, __in size_t size) { -unsigned int pos; uint8_t checksum = 0; +size_t pos;for (pos =0 ; pos < size; pos++) checksum += data[pos];
drivers/common/sfc_efx/base/mcdi_mon.c +1 -1
@@ -30,7 +30,7 @@ mcdi_mon_decode_stats( {efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);efx_mon_stat_portmask_t port_mask; -uint16_t sensor; +size_t sensor;size_t sensor_max;uint32_t stat_mask[(EFX_MON_NSTATS +31 ) /32 ];uint32_t idx =0 ;
Signature · 1 line
2.47.3
Quoted 29 lines · On Tue, 11 Aug 2026 21:48:07 +0400 Ivan Malov <[email protected]> wrote:
This series addresses code analysis defects in the common/sfc_efx/base library.
The first four patches fix excessive stack consumption in MCDI helper functions, each exceeding 1 KB on-stack, by switching to heap-allocated payload buffers.
The remaining ten patches correct SAL annotations, add NULL checks across netport and filter helpers, resolving uninitialised memory, buffer overrun, and potential dereference issues. The final patch widens loop variable types to address a CodeQL warning.
Andy Moreton (14):
common/sfc_efx/base: reduce stack in RSS context table write common/sfc_efx/base: reduce stack in get addr regions MCDI common/sfc_efx/base: reduce stack in set addr regions MCDI common/sfc_efx/base: reduce stack in netport stat describe common/sfc_efx/base: fix filter saved spec handling common/sfc_efx/base: fix annotations in client MAC addr get common/sfc_efx/base: fix annotations in HW-SW mask converter common/sfc_efx/base: fix annotations in get fixed port props common/sfc_efx/base: fix annotations in SW-HW enum converter common/sfc_efx/base: fix annotation in netport stat describe common/sfc_efx/base: fix flex array in netport stat describe common/sfc_efx/base: fix filter in SW-HW mask converter common/sfc_efx/base: rework SW mask to HW enum converter common/sfc_efx/base: cleanup wider type comparisons in loops
Quoted 11 lines
drivers/common/sfc_efx/base/ef10_filter.c | 11 +- drivers/common/sfc_efx/base/ef10_mcdi.c | 2 +- drivers/common/sfc_efx/base/ef10_nvram.c | 4 +- drivers/common/sfc_efx/base/ef10_rx.c | 22 +++- drivers/common/sfc_efx/base/efx.h | 3 +- drivers/common/sfc_efx/base/efx_bootcfg.c | 2 +- drivers/common/sfc_efx/base/efx_mcdi.c | 50 +++++-- drivers/common/sfc_efx/base/efx_np.c | 152 ++++++++++++---------- drivers/common/sfc_efx/base/mcdi_mon.c | 2 +- 9 files changed, 155 insertions(+), 93 deletions(-)
Since AI review by CI is limited. Went with more detailed review and it spotted lots of issues.
Reviewed the series applied on top of c1a46b9 ("doc: remove unreferenced KNI and examples figures"). All 14 patches apply cleanly.
Patch 01-04: common/sfc_efx/base: reduce stack in ...
Info: All four conversions replace EFX_MCDI_DECLARE_BUF() with a plain MAX(IN_LEN, OUT_LEN) size for EFSYS_KMEM_ALLOC. That drops the two guarantees the macro provides:
#define EFX_MCDI_BUF_SIZE(_in_len, _out_len) \
EFX_P2ROUNDUP(size_t, \
MAX(MAX(_in_len, _out_len), (2 * sizeof (efx_dword_t))),\
sizeof (efx_dword_t))The dword rounding is not cosmetic: ef10_mcdi_send_request() reads the payload a full dword at a time
for (pos = 0; pos < sdu_len; pos += sizeof (efx_dword_t))
dword = *(efx_dword_t *)((uint8_t *)sdup + pos);so a non-dword-multiple allocation would be read past its end. For these four call sites the lengths happen to be dword multiples (4+4*n, 992, 8+8*n, 1020), so there is no defect today, but open-coding MAX() removes the property for future length changes. Suggest
size = EFX_MCDI_BUF_SIZE(MC_CMD_..._IN_LEN(n), MC_CMD_..._OUT_LEN);
which is a drop-in and keeps the invariant documented in efx_mcdi.h.
Error path handling in all four is correct: the ENOMEM label sits below the EFSYS_KMEM_FREE so the failed allocation is not freed, and every later label falls through to it.
Patch 05: common/sfc_efx/base: fix filter saved spec handling
Info: The two added NULL checks are unreachable. In ef10_filter_add_select_action(), saved_spec == NULL forces *action = EF10_FILTER_ADD_NEW; every path that yields ADD_STORE, ADD_REPLACE or ADD_REFRESH is inside the else branch where saved_spec is non-NULL. So in ef10_filter_add_execute_action() both
} else if (action == EF10_FILTER_ADD_STORE) {
EFSYS_ASSERT(overridden_spec != NULL);
if (saved_spec != NULL)and
if ((action == EF10_FILTER_ADD_REPLACE) && (saved_spec != NULL)) {test an invariant that already holds. The __in_opt annotations are accurate and worth keeping, but the STORE branch already asserts its sibling invariant one line above; an EFSYS_ASSERT(saved_spec != NULL) would match local style and keep the invariant explicit rather than silently skipping the efs_overridden_spec assignment if it were ever violated.
Patch 09: common/sfc_efx/base: fix annotations in SW-HW enum converter
Info: __success() is placed above "static void" here, but in patch 13 it is placed between "static void" and the function name. Every existing use in the tree puts it on the return type line, e.g. ef10_nvram.c:941
__checkReturn __success(return != B_FALSE) boolean_t
ef10_nvram_buffer_find_item(Please pick one placement for both patches, preferably the existing one.
Patch 11: common/sfc_efx/base: fix flex array in netport stat describe
Error: count and stride are firmware-supplied and are now used to index the response buffer with no bound derived from the response length:
stride = MCDI_OUT_DWORD(req, MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_SIZE);
count = MCDI_OUT_DWORD(req, MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_COUNT);
...
for (i = 0; i < count; ++i) {
efx_np_stat_describe(entries + i * stride,entries points at payload + 20 in a 1020-byte allocation, and efx_np_stat_describe() reads 8 bytes at each entry. Any count beyond (out_sz - 20) / stride reads response bytes that were never written, and count * stride above 1000 reads past the end of the heap allocation.
The old code derived the iteration count from out_sz via MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES_NUM(out_sz), which was wrong for stride > 8 as the commit message says, but it did bound the loop by the data actually received. The replacement needs to validate both fields, e.g. after reading them:
if (stride < MC_CMD_STAT_DESC_LEN ||
count > (out_sz -
MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES_OFST) /
stride) {
rc = EMSGSIZE;
goto fail4;
}The stride test must come first, since stride == 0 is otherwise a division by zero.
Warning: MORE_ENTRIES is a one-bit field inside FLAGS:
MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_FLAGS_OFST 8 MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_MORE_ENTRIES_OFST 8 MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_MORE_ENTRIES_LBN 0 MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_MORE_ENTRIES_WIDTH 1
but the patch reads the whole 32-bit FLAGS dword and tests it against zero. Any future flag bit added to FLAGS makes (count == 0 && more != 0) fail a legitimate final response with EMSGSIZE, which fails efx_np_stats_assign() and therefore probe. Use the field accessor:
more = MCDI_OUT_DWORD_FIELD(req,
MAC_STATISTICS_DESCRIPTOR_OUT_FLAGS, MAC_STATISTICS_DESCRIPTOR_OUT_MORE_ENTRIES);
Patch 13: common/sfc_efx/base: rework SW mask to HW enum converter
Error: The FEC default overwrites the deliberate MC_CMD_FEC_NONE choice. Just above the call, efx_np_link_ctrl() computes
if ((cap_mask_sw & EFX_PHY_CAP_FEC_MASK) == 0)
cap_enum_hw = MC_CMD_FEC_NONE;
else
cap_enum_hw = MC_CMD_FEC_AUTO;and the comment below it still says "If the mask has got no 'FEC_REQUESTED' bits, use 'NONE' or 'AUTO' from above." Before this patch that worked because *enum_hwp was left untouched when nothing matched. Now the flags_seen == 0 path unconditionally assigns the default, and the call passes a hardcoded MC_CMD_FEC_AUTO:
EFX_NP_CAP_SW_MASK_TO_HW_ENUM(efx_np_cap_map_fec_req,
ETH_AN_FIELDS_FEC_MASK, cap_data_raw, cap_mask_sw,
MC_CMD_FEC_AUTO, NULL, NULL, &supported, &cap_enum_hw);So a request with no FEC bits at all now programs FEC_MODE = AUTO instead of NONE, i.e. a user asking for no FEC gets negotiated FEC. Passing cap_enum_hw itself as the default preserves the intent.
Error: The selection order changes from first supported HW enum to last. The old loop cleared the matched bit
mask_sw &= ~(flag_sw);
if (enum_hwp != NULL)
*enum_hwp = hw_sw_map->encm_hw;so later map entries carrying the same encm_sw failed the (mask_sw & flag_sw) == flag_sw test and could not overwrite *enum_hwp. The new loop has no clearing, so every match overwrites and the last entry wins. efx_np_cap_map_tech is one-to-many: EFX_PHY_CAP_100000FDX maps to fifteen MC_CMD_ETH_TECH_* values, so with the default lane count (filter returns B_TRUE for everything) a fixed-link 100G request now programs 100GBASE_CR10 where it previously programmed 100GBASE_KR4. That is a functional change, not a simplification. If the previous selection is intended, break out of the loop on the first match.
Warning: In the fixed-link branch the default changes the programmed technology as well. link_tech is initialised to MC_CMD_ETH_TECH_NONE, and previously stayed NONE when no requested tech bit was present in the map; it is now overwritten with MC_CMD_ETH_TECH_AUTO. This may well be the desired fix, but it is not mentioned in the commit message and should be.
Info: __success() placement differs from patch 09 and from the rest of the tree; see the note on patch 09.
Patches 06, 07, 08, 10, 12 and 14 look correct to me.
For 07, the added "*sw_maskp = 0" is safe: efx_np_link_state() memsets *lsp before the calls, and the AN bit reordering keeps both masks correct. For 08, MC_CMD_ETH_AN_FIELDS_LEN and MC_CMD_GET_FIXED_PORT_PROPERTIES_OUT_ABILITIES_LEN are both 25, and ep_np_cap_data_raw is declared with the former, so the annotation matches the memcpy. For 12, both existing callers pass either a non-NULL filter_arg or NULL for both, so the added check is inert today.
Not build tested on my side.
v2 cover common/sfc_efx/base: fix code analysis issues
In reply to Ivan MalovThis series addresses code analysis defects in the common/sfc_efx/base library.
The first four patches fix excessive stack consumption in MCDI helper functions, each exceeding 1 KB on-stack, by switching to heap-allocated payload buffers.
The remaining ten patches correct SAL annotations, add NULL checks across netport and filter helpers, resolving uninitialised memory, buffer overrun, and potential dereference issues. The final patch widens loop variable types to address a CodeQL warning.
v2:
- note for the future AI reviews: apply this on top of the 'next-net-main' branch
- addressed https://mails.dpdk.org/archives/dev/2026-August/343072.html
-- fixed the MAC_STATISTICS_DESCRIPTOR_OUT_MORE_ENTRIES accessor -- fixed the FEC hardware enum selection from the software mask -- remaining notes do not seem to point at factual defects
Andy Moreton (14):
common/sfc_efx/base: reduce stack in RSS context table write common/sfc_efx/base: reduce stack in get addr regions MCDI common/sfc_efx/base: reduce stack in set addr regions MCDI common/sfc_efx/base: reduce stack in netport stat describe common/sfc_efx/base: fix filter saved spec handling common/sfc_efx/base: fix annotations in client MAC addr get common/sfc_efx/base: fix annotations in HW-SW mask converter common/sfc_efx/base: fix annotations in get fixed port props common/sfc_efx/base: fix annotations in SW-HW enum converter common/sfc_efx/base: fix annotation in netport stat describe common/sfc_efx/base: fix flex array in netport stat describe common/sfc_efx/base: fix filter in SW-HW mask converter common/sfc_efx/base: rework SW mask to HW enum converter common/sfc_efx/base: cleanup wider type comparisons in loops
drivers/common/sfc_efx/base/ef10_filter.c | 11 +- drivers/common/sfc_efx/base/ef10_mcdi.c | 2 +- drivers/common/sfc_efx/base/ef10_nvram.c | 4 +- drivers/common/sfc_efx/base/ef10_rx.c | 22 ++- drivers/common/sfc_efx/base/efx.h | 3 +- drivers/common/sfc_efx/base/efx_bootcfg.c | 2 +- drivers/common/sfc_efx/base/efx_mcdi.c | 50 +++++-- drivers/common/sfc_efx/base/efx_np.c | 156 +++++++++++++--------- drivers/common/sfc_efx/base/mcdi_mon.c | 2 +- 9 files changed, 159 insertions(+), 93 deletions(-)
Signature · 1 line
2.47.3
PATCH v2 1/14 common/sfc_efx/base: reduce stack in RSS context table write
From: Andy Moreton <[email protected]>
Code analysis reports an error for excessive stack consumption (over 1KB). Use a heap allocated payload buffer instead.
--- drivers/common/sfc_efx/base/ef10_rx.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/common/sfc_efx/base/ef10_rx.c +17 -5
@@ -394,11 +394,10 @@ efx_mcdi_rss_context_write_table( __in unsigned int nentries) {const efx_nic_cfg_t *encp =efx_nic_cfg_get (enp); +uint8_t *payload =NULL ;efx_mcdi_req_t req; -EFX_MCDI_DECLARE_BUF (payload, -MC_CMD_RSS_CONTEXT_WRITE_TABLE_IN_LENMAX_MCDI2 , -MC_CMD_RSS_CONTEXT_WRITE_TABLE_OUT_LEN );unsigned int i; +size_t size;int rc; if (nentries >
@@ -413,6 +412,15 @@ efx_mcdi_rss_context_write_table( goto fail2; } + size =MAX (MC_CMD_RSS_CONTEXT_WRITE_TABLE_IN_LEN (nentries), +MC_CMD_RSS_CONTEXT_WRITE_TABLE_OUT_LEN ); + +EFSYS_KMEM_ALLOC (enp->en_esip, size, payload); +if (payload ==NULL ) { + rc =ENOMEM ; + goto fail3; + } + req.emr_cmd =MC_CMD_RSS_CONTEXT_WRITE_TABLE ; req.emr_in_buf = payload; req.emr_in_length =MC_CMD_RSS_CONTEXT_WRITE_TABLE_IN_LEN (nentries);
@@ -425,7 +433,7 @@ efx_mcdi_rss_context_write_table(for (i =0 ; i < nentries; ++i) {if (table[i] >= encp->enc_rx_scale_indirection_max_nqueues) { rc =EINVAL ; - goto fail3; + goto fail4; } MCDI_IN_POPULATE_INDEXED_DWORD_2(req,
@@ -437,13 +445,17 @@ efx_mcdi_rss_context_write_table(efx_mcdi_execute (enp, &req);if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail4; + goto fail5; } +EFSYS_KMEM_FREE (enp->en_esip, size, payload);return (0 ); +fail5: +EFSYS_PROBE (fail5); fail4:EFSYS_PROBE (fail4); +EFSYS_KMEM_FREE (enp->en_esip, size, payload); fail3:EFSYS_PROBE (fail3); fail2:
Signature · 1 line
2.47.3
PATCH v2 2/14 common/sfc_efx/base: reduce stack in get addr regions MCDI
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports an error for excessive stack consumption (over 1KB). Use a heap allocated payload buffer instead.
--- drivers/common/sfc_efx/base/efx_mcdi.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/common/sfc_efx/base/efx_mcdi.c +20 -6
@@ -3439,15 +3439,24 @@ efx_mcdi_get_nic_addr_regions( __in efx_nic_t *enp, __out efx_nic_dma_region_info_t *endrip) { -EFX_MCDI_DECLARE_BUF (payload ,MC_CMD_GET_DESC_ADDR_REGIONS_IN_LEN , -MC_CMD_GET_DESC_ADDR_REGIONS_OUT_LENMAX_MCDI2 ); + uint8_t *payload = NULL;efx_xword_t *regions;efx_mcdi_req_t req; +size_t size;efx_rc_t rc;size_t alloc_size;unsigned int nregions;unsigned int i; + size =MAX (MC_CMD_GET_DESC_ADDR_REGIONS_IN_LEN , +MC_CMD_GET_DESC_ADDR_REGIONS_OUT_LENMAX_MCDI2 ); + +EFSYS_KMEM_ALLOC (enp->en_esip, size, payload); +if (payload ==NULL ) { + rc =ENOMEM ; + goto fail1; + } + req.emr_cmd =MC_CMD_GET_DESC_ADDR_REGIONS ; req.emr_in_buf = payload; req.emr_in_length =MC_CMD_GET_DESC_ADDR_REGIONS_IN_LEN ;
@@ -3458,13 +3467,13 @@ efx_mcdi_get_nic_addr_regions(if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail1; + goto fail2; }if (req.emr_out_length_used <MC_CMD_GET_DESC_ADDR_REGIONS_OUT_LENMIN ) { rc =EMSGSIZE ; - goto fail2; + goto fail3; } nregions = MC_CMD_GET_DESC_ADDR_REGIONS_OUT_REGIONS_NUM(
@@ -3477,7 +3486,7 @@ efx_mcdi_get_nic_addr_regions( alloc_size = nregions *sizeof (endrip->endri_regions[0 ]);if (alloc_size /sizeof (endrip->endri_regions[0 ]) != nregions) { rc =ENOMEM ; - goto fail3; + goto fail4; } EFSYS_KMEM_ALLOC(enp->en_esip,
@@ -3485,7 +3494,7 @@ efx_mcdi_get_nic_addr_regions( endrip->endri_regions);if (endrip->endri_regions ==NULL ) { rc =ENOMEM ; - goto fail4; + goto fail5; } endrip->endri_count = nregions;
@@ -3517,14 +3526,19 @@ efx_mcdi_get_nic_addr_regions( DESC_ADDR_REGION_TRGT_ADDR_ALIGN_LOG2); } +EFSYS_KMEM_FREE (enp->en_esip, size, payload); +return (0 ); +fail5: +EFSYS_PROBE (fail5); fail4:EFSYS_PROBE (fail4); fail3:EFSYS_PROBE (fail3); fail2:EFSYS_PROBE (fail2); +EFSYS_KMEM_FREE (enp->en_esip, size, payload); fail1:EFSYS_PROBE1 (fail1, efx_rc_t, rc);
Signature · 1 line
2.47.3
PATCH v2 3/14 common/sfc_efx/base: reduce stack in set addr regions MCDI
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports an error for excessive stack consumption (over 1KB). Use a heap allocated payload buffer instead.
--- drivers/common/sfc_efx/base/efx_mcdi.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
drivers/common/sfc_efx/base/efx_mcdi.c +17 -4
@@ -3550,12 +3550,11 @@ efx_mcdi_set_nic_addr_regions( __in efx_nic_t *enp, __in const efx_nic_dma_region_info_t *endrip) { -EFX_MCDI_DECLARE_BUF (payload , -MC_CMD_SET_DESC_ADDR_REGIONS_IN_LENMAX_MCDI2 , -MC_CMD_SET_DESC_ADDR_REGIONS_OUT_LEN ); efx_qword_t *trgt_addr_base; +uint8_t *payload =NULL ;efx_mcdi_req_t req;unsigned int i; +size_t size;efx_rc_t rc; if (endrip->endri_count >
@@ -3564,6 +3563,15 @@ efx_mcdi_set_nic_addr_regions( goto fail1; } + size =MAX (MC_CMD_SET_DESC_ADDR_REGIONS_IN_LEN (endrip->endri_count), +MC_CMD_SET_DESC_ADDR_REGIONS_OUT_LEN ); + +EFSYS_KMEM_ALLOC (enp->en_esip, size, payload); +if (payload ==NULL ) { + rc =ENOMEM ; + goto fail2; + } + req.emr_cmd =MC_CMD_SET_DESC_ADDR_REGIONS ; req.emr_in_buf = payload; req.emr_in_length =
@@ -3598,11 +3606,16 @@ efx_mcdi_set_nic_addr_regions(if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail2; + goto fail3; } +EFSYS_KMEM_FREE (enp->en_esip, size, payload); +return (0 ); +fail3: +EFSYS_PROBE (fail3); +EFSYS_KMEM_FREE (enp->en_esip, size, payload); fail2:EFSYS_PROBE (fail2); fail1:
Signature · 1 line
2.47.3
PATCH v2 4/14 common/sfc_efx/base: reduce stack in netport stat describe
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports an error for excessive stack consumption (over 1KB). Use a heap allocated payload buffer instead.
--- drivers/common/sfc_efx/base/efx_np.c | 37 +++++++++++++++++++--------- 1 file changed, 25 insertions(+), 12 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +25 -12
@@ -778,22 +778,30 @@ efx_np_stats_describe( __out_opt uint32_t *nprocessedp, __out_opt uint32_t *nstats_maxp) { -EFX_MCDI_DECLARE_BUF (payload , -MC_CMD_MAC_STATISTICS_DESCRIPTOR_IN_LEN , -MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMAX_MCDI2 ); + uint8_t *payload = NULL;uint32_t nprocessed;efx_mcdi_req_t req;uint8_t *entries;uint32_t stride;unsigned int i;size_t out_sz; +size_t size;efx_rc_t rc; - req.emr_out_length =MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMAX_MCDI2 ; - req.emr_in_length =MC_CMD_MAC_STATISTICS_DESCRIPTOR_IN_LEN ; + size =MAX (MC_CMD_MAC_STATISTICS_DESCRIPTOR_IN_LEN , +MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMAX_MCDI2 ); + +EFSYS_KMEM_ALLOC (enp->en_esip, size, payload); +if (payload ==NULL ) { + rc =ENOMEM ; + goto fail1; + } + req.emr_cmd =MC_CMD_MAC_STATISTICS_DESCRIPTOR ; - req.emr_out_buf = payload; req.emr_in_buf = payload; + req.emr_in_length =MC_CMD_MAC_STATISTICS_DESCRIPTOR_IN_LEN ; + req.emr_out_buf = payload; + req.emr_out_length =MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMAX_MCDI2 ;MCDI_IN_SET_DWORD (req,MAC_STATISTICS_DESCRIPTOR_IN_PORT_HANDLE , nph);MCDI_IN_SET_DWORD (req,MAC_STATISTICS_DESCRIPTOR_IN_OFFSET , req_ofst);
@@ -802,13 +810,13 @@ efx_np_stats_describe(if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail1; + goto fail2; } out_sz = req.emr_out_length_used;if (out_sz <MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMIN ) { rc =EMSGSIZE ; - goto fail2; + goto fail3; }if (nstats_maxp !=NULL ) {
@@ -818,13 +826,13 @@ efx_np_stats_describe( }if (lut_nentries ==0 || lut ==NULL || nprocessedp ==NULL ) -return (0 ); + goto out; stride =MCDI_OUT_DWORD (req,MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_SIZE ); nprocessed =MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES_NUM (out_sz);if (nprocessed ==0 ) { rc =EMSGSIZE ; - goto fail3; + goto fail4; } entries = MCDI_OUT2(req, uint8_t,
@@ -834,14 +842,19 @@ efx_np_stats_describe(efx_np_stat_describe (entries + i * stride, lut_nentries, lut); *nprocessedp = nprocessed; + +out: +EFSYS_KMEM_FREE (enp->en_esip, size, payload); +return (0 ); +fail4: +EFSYS_PROBE (fail4); fail3:EFSYS_PROBE (fail3); - fail2:EFSYS_PROBE (fail2); - +EFSYS_KMEM_FREE (enp->en_esip, size, payload); fail1:EFSYS_PROBE1 (fail1, efx_rc_t, rc);return (rc);
Signature · 1 line
2.47.3
PATCH v2 5/14 common/sfc_efx/base: fix filter saved spec handling
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code Analysis notes that saved_spec can be NULL when passed into ef10_filter_add_select_action and ef10_filter_add_execute_action from ef10_filter_add_internal.
Fix the annotations to show that the saved_spec is optional, and add NULL checks before dereferencing it.
--- drivers/common/sfc_efx/base/ef10_filter.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/common/sfc_efx/base/ef10_filter.c +5 -4
@@ -690,7 +690,7 @@ ef10_filter_add_lookup_equal_spec(static void ef10_filter_add_select_action ( - __in efx_filter_spec_t *saved_spec, + __in_opt efx_filter_spec_t *saved_spec, __in efx_filter_spec_t *spec, __out enum ef10_filter_add_action_e *action, __out efx_filter_spec_t **overridden_spec)
@@ -752,7 +752,7 @@ ef10_filter_add_select_action( static __checkReturn efx_rc_t ef10_filter_add_execute_action( __in efx_nic_t *enp, - __in efx_filter_spec_t *saved_spec, + __in_opt efx_filter_spec_t *saved_spec, __in efx_filter_spec_t *spec, __in efx_filter_spec_t *overridden_spec, __in enum ef10_filter_add_action_e action,
@@ -769,7 +769,8 @@ ef10_filter_add_execute_action( goto out_unlock; }else if (action ==EF10_FILTER_ADD_STORE ) {EFSYS_ASSERT (overridden_spec !=NULL ); - saved_spec->efs_overridden_spec = overridden_spec; +if (saved_spec !=NULL ) + saved_spec->efs_overridden_spec = overridden_spec; goto out_unlock; }
@@ -806,7 +807,7 @@ ef10_filter_add_execute_action(EFSYS_LOCK (enp->en_eslp, state); -if (action ==EF10_FILTER_ADD_REPLACE ) { +if ((action ==EF10_FILTER_ADD_REPLACE ) && (saved_spec !=NULL )) {/* Update the fields that may differ */ saved_spec->efs_priority = spec->efs_priority; saved_spec->efs_flags = spec->efs_flags;
Signature · 1 line
2.47.3
PATCH v2 6/14 common/sfc_efx/base: fix annotations in client MAC addr get
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Fix annotations to show the size written to addr_bytes.
--- drivers/common/sfc_efx/base/efx.h | 3 ++- drivers/common/sfc_efx/base/efx_mcdi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/common/sfc_efx/base/efx.h +2 -1
@@ -439,7 +439,8 @@ extern __checkReturn efx_rc_tefx_mcdi_client_mac_addr_get ( __in efx_nic_t *enp, __in uint32_t client_handle, - __out uint8_t addr_bytes[EFX_MAC_ADDR_LEN]); +__out_bcount (EFX_MAC_ADDR_LEN ) + uint8_t addr_bytes[EFX_MAC_ADDR_LEN]);LIBEFX_API extern __checkReturn efx_rc_t
drivers/common/sfc_efx/base/efx_mcdi.c +2 -1
@@ -737,7 +737,8 @@ efx_mcdi_get_own_client_handle(efx_mcdi_client_mac_addr_get ( __in efx_nic_t *enp, __in uint32_t client_handle, - __out uint8_t addr_bytes[EFX_MAC_ADDR_LEN]) +__out_bcount (EFX_MAC_ADDR_LEN ) + uint8_t addr_bytes[EFX_MAC_ADDR_LEN]) { efx_mcdi_req_t req; EFX_MCDI_DECLARE_BUF(payload,
Signature · 1 line
2.47.3
PATCH v2 7/14 common/sfc_efx/base: fix annotations in HW-SW mask converter
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports that efx_np_cap_mask_hw_to_sw does not always write to sw_cap_maskp. Fix the annotation to show it is valid on input, and initialise the mask in efx_np_cap_hw_data_to_sw_mask.
--- drivers/common/sfc_efx/base/efx_np.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +8 -6
@@ -190,7 +190,7 @@ efx_np_cap_mask_hw_to_sw( __in unsigned int hw_sw_map_nentries, __in_bcount(hw_cap_data_nbytes) const uint8_t *hw_cap_data, __in size_t hw_cap_data_nbytes, - __out uint32_t *sw_cap_maskp) + __inout uint32_t *sw_cap_maskp) { FOREACH_SUP_CAP(hw_sw_map, hw_sw_map_nentries, hw_cap_data, hw_cap_data_nbytes) {
@@ -216,6 +216,8 @@ efx_np_cap_hw_data_to_sw_mask( __in const uint8_t *hw_data, __out uint32_t *sw_maskp) { + *sw_maskp =0 ; +EFX_NP_CAP_MASK_HW_TO_SW (efx_np_cap_map_tech,ETH_AN_FIELDS_TECH_MASK , hw_data, sw_maskp);
@@ -429,21 +431,21 @@ efx_np_link_state( _NOTE(ARGUNUSED(lbp))#endif /* EFSYS_OPT_LOOPBACK */ -if (lsp->enls_an_supported !=B_FALSE ) - lsp->enls_adv_cap_mask |=1U <<EFX_PHY_CAP_AN ; -efx_np_cap_hw_data_to_sw_mask ( MCDI_OUT2(req, const uint8_t, LINK_STATE_OUT_ADVERTISED_ABILITIES), &lsp->enls_adv_cap_mask); -if (status_flags & (1U <<MC_CMD_LINK_STATUS_FLAGS_AN_ABLE )) - lsp->enls_lp_cap_mask |=1U <<EFX_PHY_CAP_AN ; +if (lsp->enls_an_supported !=B_FALSE ) + lsp->enls_adv_cap_mask |=1U <<EFX_PHY_CAP_AN ;efx_np_cap_hw_data_to_sw_mask (MCDI_OUT2 (req ,const uint8_t , LINK_STATE_OUT_LINK_PARTNER_ABILITIES), &lsp->enls_lp_cap_mask); +if (status_flags & (1U <<MC_CMD_LINK_STATUS_FLAGS_AN_ABLE )) + lsp->enls_lp_cap_mask |=1U <<EFX_PHY_CAP_AN ; + tech =MCDI_OUT_WORD (req,LINK_STATE_OUT_LINK_TECHNOLOGY );if (tech <EFX_ARRAY_SIZE (efx_np_tech_to_lane_count))
Signature · 1 line
2.47.3
PATCH v2 8/14 common/sfc_efx/base: fix annotations in get fixed port props
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports a buffer overrun for the sup_cap_rawp argument. Fix the annotation to show the writable buffer size.
--- drivers/common/sfc_efx/base/efx_np.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/common/sfc_efx/base/efx_np.c +2 -1
@@ -235,7 +235,8 @@ static __checkReturn efx_rc_tefx_np_get_fixed_port_props ( __in efx_nic_t *enp, __in efx_np_handle_t nph, - __out_opt uint8_t *sup_cap_rawp, + __out_bcount_opt(MC_CMD_ETH_AN_FIELDS_LEN) + uint8_t *sup_cap_rawp, __out_opt uint32_t *sup_cap_maskp, __out_opt efx_qword_t *loopback_cap_maskp) {
Signature · 1 line
2.47.3
PATCH v2 9/14 common/sfc_efx/base: fix annotations in SW-HW enum converter
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports returning uninitialised memory in *enum_hwp. Fix the annotations to show that the write only occurs on successful return.
--- drivers/common/sfc_efx/base/efx_np.c | 1 + 1 file changed, 1 insertion(+)
drivers/common/sfc_efx/base/efx_np.c +1 -0
@@ -504,6 +504,7 @@ efx_np_sw_link_mode_to_cap(return (0 ); } +__success(*supportedp != 0) static void efx_np_cap_enum_sw_to_hw( __in_ecount(hw_sw_map_nentries) const struct efx_np_cap_map *hw_sw_map,
Signature · 1 line
2.47.3
PATCH v2 10/14 common/sfc_efx/base: fix annotation in netport stat describe
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reported a NULL dereference of the lut parameter. Fix the annotation to show it is not optional (must be non-NULL).
--- drivers/common/sfc_efx/base/efx_np.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/sfc_efx/base/efx_np.c +1 -1
@@ -734,7 +734,7 @@ static voidefx_np_stat_describe ( __in uint8_t *hw_entry_buf, __in unsigned int lut_nentries, - __out_ecount_opt(lut_nentries) efx_np_stat_t *lut) + __out_ecount(lut_nentries) efx_np_stat_t *lut) { const efx_np_stat_t *map;efx_mac_stat_t sw_id;
Signature · 1 line
2.47.3
PATCH v2 11/14 common/sfc_efx/base: fix flex array in netport stat describe
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reported returning uninitialised memory at *lut and *nprocessedp. Refactor to ensure these parameters are only used when non-NULL.
This function should also be using the ENTRY_COUNT field for the number of descriptors returned, as the descriptor size is not known statically (they are extensible). Also use the MORE_ENTRIES flag to determine if all of the descriptors have been fetched.
--- drivers/common/sfc_efx/base/efx_np.c | 30 +++++++++++++++++----------- 1 file changed, 18 insertions(+), 12 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +18 -12
@@ -783,10 +783,11 @@ efx_np_stats_describe( __out_opt uint32_t *nstats_maxp) {uint8_t *payload =NULL ; -uint32_t nprocessed;efx_mcdi_req_t req;uint8_t *entries;uint32_t stride; +uint32_t count; +uint32_t more;unsigned int i;size_t out_sz;size_t size;
@@ -829,25 +830,30 @@ efx_np_stats_describe(sizeof (efx_qword_t); } -if (lut_nentries ==0 || lut ==NULL || nprocessedp ==NULL ) - goto out; - stride =MCDI_OUT_DWORD (req,MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_SIZE ); - nprocessed =MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES_NUM (out_sz); -if (nprocessed ==0 ) { + count =MCDI_OUT_DWORD (req,MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_COUNT ); + more =MCDI_OUT_DWORD_FIELD (req, +MAC_STATISTICS_DESCRIPTOR_OUT_FLAGS , +MAC_STATISTICS_DESCRIPTOR_OUT_MORE_ENTRIES ); + +if ((count ==0 ) && (more !=0 )) { rc =EMSGSIZE ; goto fail4; } - entries =MCDI_OUT2 (req, uint8_t, -MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES ); +if (lut !=NULL ) { + entries =MCDI_OUT2 (req, uint8_t, +MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES ); -for (i =0 ; i < nprocessed; ++i) -efx_np_stat_describe (entries + i * stride, lut_nentries, lut); +for (i =0 ; i < count; ++i) { +efx_np_stat_describe (entries + i * stride, + lut_nentries, lut); + } + } - *nprocessedp = nprocessed; +if (nprocessedp !=NULL ) + *nprocessedp = count; -out:EFSYS_KMEM_FREE (enp->en_esip, size, payload);return (0 );
Signature · 1 line
2.47.3
PATCH v2 12/14 common/sfc_efx/base: fix filter in SW-HW mask converter
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports that the optional filter_arg could be used to invoke the callback, but that function has type efx_np_cap_filter_cb, where the argument is required. Add a NULL check to ensure that the filter_arg is valid when invoking the callback.
--- drivers/common/sfc_efx/base/efx_np.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +3 -3
@@ -1162,7 +1162,7 @@ efx_np_cap_mask_sw_to_hw( __in uint32_t mask_sw, __in_opt efx_np_cap_filter_cb *filter_cb, __in_opt void *filter_arg, - __out uint8_t *mask_hwp) + __inout uint8_t *mask_hwp) { FOREACH_SUP_CAP(hw_sw_map, hw_sw_map_nentries, hw_cap_data, hw_cap_data_nbytes) {
@@ -1171,8 +1171,8 @@ efx_np_cap_mask_sw_to_hw(if ((mask_sw & flag_sw) != flag_sw)continue ; -if (filter_cb !=NULL && -filter_cb (hw_sw_map->encm_hw, filter_arg) ==B_FALSE ) +if ((filter_cb !=NULL ) && (filter_arg !=NULL ) && + (filter_cb (hw_sw_map->encm_hw, filter_arg) ==B_FALSE ))continue ; mask_hwp[CAP_BYTE (hw_sw_map)] |=CAP_FLAG (hw_sw_map);
Signature · 1 line
2.47.3
PATCH v2 13/14 common/sfc_efx/base: rework SW mask to HW enum converter
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports that *enum_hwp is not written on successful return on some paths through this function. Refactor to simplify the code, and adjust the annotations so it is clear that *enum_hwp is only written on successful return. Adjust FEC handling in efx_np_link_ctrl to allow for *supportedp always being updated.
Code analysis also reports that the optional filter_arg can be NULL when invoking filter_cb, but the callback argument is not optional. Check that filter_arg is non-NULL to ensure correct usage.
--- drivers/common/sfc_efx/base/efx_np.c | 67 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 33 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +34 -33
@@ -1203,6 +1203,7 @@ efx_np_cap_mask_sw_to_hw( MC_CMD_##_hw_cap_section##_LEN, (_mask_sw), \ (_filter_cb), (_filter_arg), (_mask_hwp)) +__success(*supportedp != 0) static void efx_np_cap_sw_mask_to_hw_enum( __in_ecount(hw_sw_map_nentries) const struct efx_np_cap_map *hw_sw_map,
@@ -1210,53 +1211,52 @@ efx_np_cap_sw_mask_to_hw_enum( __in_bcount(hw_cap_data_nbytes) const uint8_t *hw_cap_data, __in size_t hw_cap_data_nbytes, __in uint32_t mask_sw, + __in uint16_t enum_hw_def, __in_opt efx_np_cap_filter_cb *filter_cb, __in_opt void *filter_arg, __out boolean_t *supportedp, __out_opt uint16_t *enum_hwp) { - unsigned int sw_nflags_req = 0; -uint32_t sw_check_mask =0 ; + boolean_t supported = B_FALSE; +uint32_t matched_mask =0 ; +uint32_t flags_seen =0 ;unsigned int i;for (i =0 ; i < hw_sw_map_nentries; ++i) { -uint32_t flag_sw =1U << hw_sw_map->encm_sw; -unsigned int byte_idx =CAP_BYTE (hw_sw_map); -uint8_t flag_hw =CAP_FLAG (hw_sw_map); +uint32_t flag_sw =1U << hw_sw_map[i].encm_sw; +unsigned int byte_idx =CAP_BYTE (&hw_sw_map[i]); +uint8_t flag_hw =CAP_FLAG (&hw_sw_map[i]); -if (byte_idx >= hw_cap_data_nbytes) { - ++(hw_sw_map); +if (byte_idx >= hw_cap_data_nbytes)continue ; - } -if ((mask_sw & flag_sw) == flag_sw) { -if ((sw_check_mask & flag_sw) ==0 ) - ++(sw_nflags_req); +if ((mask_sw & flag_sw) != flag_sw) +continue ; - sw_check_mask |= flag_sw; + flags_seen |= flag_sw; -if ((hw_cap_data[byte_idx] & flag_hw) == flag_hw) { -if (filter_cb ==NULL || -filter_cb (hw_sw_map->encm_hw, filter_arg) != -B_FALSE ) { - mask_sw &= ~(flag_sw); +if ((hw_cap_data[byte_idx] & flag_hw) != flag_hw) +continue ; -if (enum_hwp !=NULL ) - *enum_hwp = hw_sw_map->encm_hw; - } - } - } +if ((filter_cb !=NULL ) && (filter_arg !=NULL ) && + (filter_cb (hw_sw_map[i].encm_hw, filter_arg) ==B_FALSE )) +continue ; + +if (enum_hwp !=NULL && (matched_mask & flag_sw) ==0 ) + *enum_hwp = hw_sw_map[i].encm_hw; - ++(hw_sw_map); + matched_mask |= flag_sw; + supported =B_TRUE ; } -if (sw_check_mask !=0 && (mask_sw & sw_check_mask) == sw_check_mask) { -/* Failed to select the enum by at least one capability bit. */ - *supportedp =B_FALSE ; -return ; +if (flags_seen ==0 ) { +if (enum_hwp !=NULL ) + *enum_hwp = enum_hw_def; + + supported =B_TRUE ; } - *supportedp =B_TRUE ; + *supportedp = supported; }/*
@@ -1268,12 +1268,13 @@ efx_np_cap_sw_mask_to_hw_enum(*/ #define EFX_NP_CAP_SW_MASK_TO_HW_ENUM ( \ _hw_sw_cap_map, _hw_cap_section, _hw_cap_data, \ - _mask_sw, _filter_cb, _filter_arg, _supportedp, _enum_hwp) \ + _mask_sw, _enum_hw_def, _filter_cb, _filter_arg, \ + _supportedp, _enum_hwp) \ efx_np_cap_sw_mask_to_hw_enum((_hw_sw_cap_map), \ EFX_ARRAY_SIZE(_hw_sw_cap_map), \ MCDI_STRUCT_MEMBER((_hw_cap_data), const uint8_t, \ MC_CMD_##_hw_cap_section), \ - MC_CMD_##_hw_cap_section##_LEN, (_mask_sw), \ + MC_CMD_##_hw_cap_section##_LEN, (_mask_sw), (_enum_hw_def), \ (_filter_cb), (_filter_arg), \ (_supportedp), (_enum_hwp))
@@ -1388,6 +1389,7 @@ efx_np_link_ctrl( }else {EFX_NP_CAP_SW_MASK_TO_HW_ENUM (efx_np_cap_map_tech,ETH_AN_FIELDS_TECH_MASK , cap_data_raw, cap_mask_sw, +MC_CMD_ETH_TECH_AUTO , efx_np_filter_tech_by_lane_count_cb, &lane_count, &supported, &link_tech);
@@ -1416,10 +1418,9 @@ efx_np_link_ctrl(*/ EFX_NP_CAP_SW_MASK_TO_HW_ENUM (efx_np_cap_map_fec_req,ETH_AN_FIELDS_FEC_MASK , cap_data_raw, cap_mask_sw, -NULL ,NULL , &supported, &cap_enum_hw); + cap_enum_hw,NULL ,NULL , &supported, &cap_enum_hw); -if ((cap_mask_sw &EFX_PHY_CAP_FEC_MASK ) !=0 - && supported ==B_FALSE ) { +if (supported ==B_FALSE ) { rc =ENOTSUP ; goto fail5; }
Signature · 1 line
2.47.3
PATCH v2 14/14 common/sfc_efx/base: cleanup wider type comparisons in loops
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
CodeQL reports errors for comparisons between narrow and wider types in loop conditions [cpp/infiniteloop]. Use the wider types to fix that.
--- drivers/common/sfc_efx/base/ef10_filter.c | 2 +- drivers/common/sfc_efx/base/ef10_mcdi.c | 2 +- drivers/common/sfc_efx/base/ef10_nvram.c | 4 ++-- drivers/common/sfc_efx/base/efx_bootcfg.c | 2 +- drivers/common/sfc_efx/base/mcdi_mon.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/common/sfc_efx/base/ef10_filter.c +1 -1
@@ -1300,7 +1300,7 @@ ef10_filter_supported_filters(size_t mcdi_list_length;size_t mcdi_encap_list_length;size_t list_length; -uint32_t i; +size_t i;uint32_t next_buf_idx;size_t next_buf_length;efx_rc_t rc;
drivers/common/sfc_efx/base/ef10_mcdi.c +1 -1
@@ -140,7 +140,7 @@ ef10_mcdi_send_request(const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;efsys_mem_t *esmp = emtp->emt_dma_mem;efx_dword_t dword; -unsigned int pos; +size_t pos;EFSYS_ASSERT (EFX_FAMILY_IS_EF100 (enp) ||EFX_FAMILY_IS_EF10 (enp));
drivers/common/sfc_efx/base/ef10_nvram.c +2 -2
@@ -2386,7 +2386,7 @@ ef10_nvram_type_to_partn(efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);ef10_parttbl_entry_t *parttbl =NULL ;size_t parttbl_rows =0 ; -unsigned int i; +size_t i; EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID); EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
@@ -2418,7 +2418,7 @@ ef10_nvram_partn_to_type(efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);ef10_parttbl_entry_t *parttbl =NULL ;size_t parttbl_rows =0 ; -unsigned int i; +size_t i;EFSYS_ASSERT (typep !=NULL );
drivers/common/sfc_efx/base/efx_bootcfg.c +1 -1
@@ -140,8 +140,8 @@ efx_dhcp_csum( __in_bcount(size) uint8_t const *data, __in size_t size) { -unsigned int pos; uint8_t checksum = 0; +size_t pos;for (pos =0 ; pos < size; pos++) checksum += data[pos];
drivers/common/sfc_efx/base/mcdi_mon.c +1 -1
@@ -30,7 +30,7 @@ mcdi_mon_decode_stats( {efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);efx_mon_stat_portmask_t port_mask; -uint16_t sensor; +size_t sensor;size_t sensor_max;uint32_t stat_mask[(EFX_MON_NSTATS +31 ) /32 ];uint32_t idx =0 ;
Signature · 1 line
2.47.3
Quoted 14 lines · On Wed, 12 Aug 2026 21:08:20 +0400 Ivan Malov <[email protected]> wrote:
This series addresses code analysis defects in the common/sfc_efx/base library.
The first four patches fix excessive stack consumption in MCDI helper functions, each exceeding 1 KB on-stack, by switching to heap-allocated payload buffers.
The remaining ten patches correct SAL annotations, add NULL checks across netport and filter helpers, resolving uninitialised memory, buffer overrun, and potential dereference issues. The final patch widens loop variable types to address a CodeQL warning.
Quoted 4 lines
v2:
- note for the future AI reviews: apply this on top of the 'next-net-main' branch
Still has AI review issues.
Reviewed v2 applied on c1a46b9 ("doc: remove unreferenced KNI and examples figures"). All 14 apply cleanly. Comparing commit contents against v1, only patches 11 and 13 have real changes; 12 differs only in hunk offsets.
Addressed since v1, all correct as far as I can tell:
- 11/14 now reads MORE_ENTRIES with MCDI_OUT_DWORD_FIELD against MAC_STATISTICS_DESCRIPTOR_OUT_FLAGS, so only LBN 0 is tested.
- 13/14 adds matched_mask so *enum_hwp is written only on the first match per SW flag. That restores the original selection order that the removed "mask_sw &= ~(flag_sw)" used to provide, including the case where several distinct SW flags are set.
- 13/14 passes cap_enum_hw rather than MC_CMD_FEC_AUTO as the default, so a request with no FEC bits keeps MC_CMD_FEC_NONE.
- __success() placement is now consistent between 09/14 and 13/14.
Patch 11/14: common/sfc_efx/base: fix flex array in netport stat describe
Error: count and stride are still used to index the response buffer with no bound derived from the response length. This was the main finding on v1 and is unchanged:
stride = MCDI_OUT_DWORD(req, MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_SIZE);
count = MCDI_OUT_DWORD(req, MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_COUNT);
...
for (i = 0; i < count; ++i) {
efx_np_stat_describe(entries + i * stride,Both fields come from firmware. entries points at payload + 20 in a 1020-byte allocation and efx_np_stat_describe() reads 8 bytes per entry, so any count above (out_sz - 20) / stride reads bytes that were never written, and count * stride above 1000 reads past the end of the allocation. The old ENTRIES_NUM(out_sz) expression was wrong for stride > 8, as the commit message says, but it did bound the loop by the data actually received; nothing replaces that bound.
if (stride < MC_CMD_STAT_DESC_LEN ||
count > (out_sz -
MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES_OFST) /
stride) {
rc = EMSGSIZE;
goto fail4;
}The stride test has to come first, otherwise stride == 0 divides by zero.
Patch 13/14: common/sfc_efx/base: rework SW mask to HW enum converter
Warning: In the fixed-link branch the programmed technology still changes. link_tech is initialised to MC_CMD_ETH_TECH_NONE and previously stayed NONE when no requested tech bit was present in the map; passing MC_CMD_ETH_TECH_AUTO as enum_hw_def now overwrites it. Unlike the FEC call, which v2 changed to pass the pre-computed value, this one keeps the hardcoded default. That may well be the intent, but the commit message is unchanged from v1 and still describes the patch only as a refactor plus annotation fix; it does not mention the new enum_hw_def parameter or this behaviour change. Please say so in the commit message, or pass link_tech to keep the old value.
Patch 01-04: common/sfc_efx/base: reduce stack in ...
Info: Unchanged from v1, repeating for the record. The four conversions open-code MAX(IN_LEN, OUT_LEN) where EFX_MCDI_BUF_SIZE() exists and also rounds up to a dword multiple and enforces a two-dword minimum. The rounding matters because ef10_mcdi_send_request() reads the payload a full dword at a time. All four current lengths are dword multiples so there is no defect today, but the property is lost for future length changes.
Patch 05/14: common/sfc_efx/base: fix filter saved spec handling
Info: Unchanged from v1. Both added NULL checks are unreachable:saved_spec == NULL forces EF10_FILTER_ADD_NEW in ef10_filter_add_select_action(), so ADD_STORE and ADD_REPLACE both imply a non-NULL saved_spec. The __in_opt annotations are right; the STORE branch already asserts its sibling invariant one line above, so EFSYS_ASSERT(saved_spec != NULL) would match local style rather than silently skipping the efs_overridden_spec assignment.
Patch 09/14 and 13/14
Info: The two are consistent with each other now, but both put __success() on its own line above "static". Existing uses in the tree put it on the return type line, e.g. ef10_nvram.c:941
__checkReturn __success(return != B_FALSE) boolean_t ef10_nvram_buffer_find_item(
Dear Stephen,
If I may, I should like to point out the following:
- Patch 11/14:
The classification of the issue as an 'error' does not hold water. First of all, no real operability issue is observed in practice; hence, this warrants, at most, the status of a warning, not an error. Secondly, the 'count' and 'stride' are fields of the firmware's own response. A successful MCDI response is self-consistent and shall not be treated as adversarial. Furthermore, the MCDI layer explicitly clamps 'emr_out_length_used' to 'emr_out_length', the allocated output buffer size, so a buffer overrun should not be possible. The note thus does not meet the threshold of an actual defect.
- Patch 13/14:
The default of 'TECH_AUTO' when 'flags_seen == 0' is deliberate: it is the correct instruction to the firmware when the capability map yields no technology preference, and 'TECH_NONE' would be semantically incorrect in a fixed-link context. The commit message describes the refactoring; exhaustive documentation of an edge-case path does not belong in such changes. Therefore, the review note does not meet the threshold of an actual defect.
- Patches 01–04:
The comment on 'EFX_MCDI_BUF_SIZE' [1] explains in no uncertain terms that the rounding requirement exists to accommodate Siena on-chip buffers. The note does not apply to the modern adapters currently supported by the DPDK driver. No actual defect.
- Patch 05/14:
In production builds, 'EFSYS_ASSERT' is elided. A NULL check is the correct defensive posture for upstream code and accurately reflects the '__in_opt' semantics at the call site.
- Patches 09/14 and 13/14:
The convention cited applies to 'boolean_t'-returning functions carrying '__checkReturn', where '__success', '__checkReturn', and the return type all annotate the return value and naturally share a line. The functions in question, however, return 'void', carry no '__checkReturn', and express the success condition on an output parameter. The note is thus not valid at all; the placement stands.
On these premises, I respectfully suggest that the series be put forward for reconsideration and integration.
Thank you.
Quoted 116 lines · Stephen Hemminger
Quoted 14 lines · On Wed, 12 Aug 2026 21:08:20 +0400 Ivan Malov <[email protected]> wrote:
This series addresses code analysis defects in the common/sfc_efx/base library.
The first four patches fix excessive stack consumption in MCDI helper functions, each exceeding 1 KB on-stack, by switching to heap-allocated payload buffers.
The remaining ten patches correct SAL annotations, add NULL checks across netport and filter helpers, resolving uninitialised memory, buffer overrun, and potential dereference issues. The final patch widens loop variable types to address a CodeQL warning.
Quoted 4 lines
v2:
- note for the future AI reviews: apply this on top of the 'next-net-main' branch
Still has AI review issues.
Reviewed v2 applied on c1a46b9 ("doc: remove unreferenced KNI and examples figures"). All 14 apply cleanly. Comparing commit contents against v1, only patches 11 and 13 have real changes; 12 differs only in hunk offsets.
Addressed since v1, all correct as far as I can tell:
- 11/14 now reads
MORE_ENTRIESwithMCDI_OUT_DWORD_FIELDagainstMAC_STATISTICS_DESCRIPTOR_OUT_FLAGS, so only LBN 0 is tested.
- 13/14 addsmatched_maskso*enum_hwpis written only on the first match per SW flag. That restores the original selection order that the removed "mask_sw&= ~(flag_sw)" used to provide, including the case where several distinct SW flags are set.
- 13/14 passescap_enum_hwrather thanMC_CMD_FEC_AUTOas the default, so a request with no FEC bits keepsMC_CMD_FEC_NONE.
-__success()placement is now consistent between 09/14 and 13/14.Patch 11/14: common/sfc_efx/base: fix flex array in netport stat describe
Error: count and stride are still used to index the response buffer with no bound derived from the response length. This was the main finding on v1 and is unchanged:
stride = MCDI_OUT_DWORD(req, MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_SIZE); count = MCDI_OUT_DWORD(req, MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_COUNT); ... for (i = 0; i < count; ++i) { efx_np_stat_describe(entries + i * stride,Both fields come from firmware. entries points at payload + 20 in a 1020-byte allocation and
efx_np_stat_describe()reads 8 bytes per entry, so any count above (out_sz- 20) / stride reads bytes that were never written, and count * stride above 1000 reads past the end of the allocation. The oldENTRIES_NUM(out_sz)expression was wrong for stride > 8, as the commit message says, but it did bound the loop by the data actually received; nothing replaces that bound.if (stride < MC_CMD_STAT_DESC_LEN || count > (out_sz - MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES_OFST) / stride) { rc = EMSGSIZE; goto fail4; }The stride test has to come first, otherwise stride == 0 divides by zero.
Patch 13/14: common/sfc_efx/base: rework SW mask to HW enum converter
Warning: In the fixed-link branch the programmed technology still changes.
link_techis initialised toMC_CMD_ETH_TECH_NONEand previously stayed NONE when no requested tech bit was present in the map; passingMC_CMD_ETH_TECH_AUTOasenum_hw_defnow overwrites it. Unlike the FEC call, which v2 changed to pass the pre-computed value, this one keeps the hardcoded default. That may well be the intent, but the commit message is unchanged from v1 and still describes the patch only as a refactor plus annotation fix; it does not mention the newenum_hw_defparameter or this behaviour change. Please say so in the commit message, or passlink_techto keep the old value.Patch 01-04: common/sfc_efx/base: reduce stack in ...
Info: Unchanged from v1, repeating for the record. The four conversions open-code
MAX(IN_LEN, OUT_LEN)whereEFX_MCDI_BUF_SIZE()exists and also rounds up to a dword multiple and enforces a two-dword minimum. The rounding matters becauseef10_mcdi_send_request()reads the payload a full dword at a time. All four current lengths are dword multiples so there is no defect today, but the property is lost for future length changes.Patch 05/14: common/sfc_efx/base: fix filter saved spec handling
Info: Unchanged from v1. Both added NULL checks are unreachable:
saved_spec== NULL forcesEF10_FILTER_ADD_NEWinef10_filter_add_select_action(), soADD_STOREandADD_REPLACEboth imply a non-NULLsaved_spec. The__in_optannotations are right; the STORE branch already asserts its sibling invariant one line above, soEFSYS_ASSERT(saved_spec != NULL)would match local style rather than silently skipping theefs_overridden_specassignment.Patch 09/14 and 13/14
Info: The two are consistent with each other now, but both put
__success()on its own line above "static". Existing uses in the tree put it on the return type line, e.g. ef10_nvram.c:941__checkReturn __success(return != B_FALSE) boolean_t ef10_nvram_buffer_find_item(
v3 cover common/sfc_efx/base: fix code analysis issues
In reply to Ivan MalovThis series addresses code analysis defects in the common/sfc_efx/base library.
The first four patches fix excessive stack consumption in MCDI helper functions, each exceeding 1 KB on-stack, by switching to heap-allocated payload buffers.
The remaining ten patches correct SAL annotations, add assertions and bounds checks across netport and filter helpers to address uninitialised memory, buffer overrun, and potential dereference issues. The final patch widens loop variable types to address a CodeQL warning.
v3:
- addressed https://mails.dpdk.org/archives/dev/2026-August/343201.html
-- patches 01-04: switched to EFX_MCDI_BUF_SIZE
-- patch 05: replaced the unreachable NULL guard with
EFSYS_ASSERT; corrected the commit message
-- patches 09, 13: moved __success to the declaration line -- patch 11: added stride and count bounds check before the loop -- patch 13: documented the TECH_AUTO default behaviour
v2:
- note for the future AI reviews: apply this on top of the 'next-net-main' branch
- addressed https://mails.dpdk.org/archives/dev/2026-August/343072.html
-- fixed the MAC_STATISTICS_DESCRIPTOR_OUT_MORE_ENTRIES accessor -- fixed the FEC hardware enum selection from the software mask -- remaining notes do not seem to point at factual defects
Andy Moreton (14):
common/sfc_efx/base: reduce stack in RSS context table write common/sfc_efx/base: reduce stack in get addr regions MCDI common/sfc_efx/base: reduce stack in set addr regions MCDI common/sfc_efx/base: reduce stack in netport stat describe common/sfc_efx/base: fix filter saved spec handling common/sfc_efx/base: fix annotations in client MAC addr get common/sfc_efx/base: fix annotations in HW-SW mask converter common/sfc_efx/base: fix annotations in get fixed port props common/sfc_efx/base: fix annotations in SW-HW enum converter common/sfc_efx/base: fix annotation in netport stat describe common/sfc_efx/base: fix flex array in netport stat describe common/sfc_efx/base: fix filter in SW-HW mask converter common/sfc_efx/base: rework SW mask to HW enum converter common/sfc_efx/base: cleanup wider type comparisons in loops
drivers/common/sfc_efx/base/ef10_filter.c | 7 +- drivers/common/sfc_efx/base/ef10_mcdi.c | 2 +- drivers/common/sfc_efx/base/ef10_nvram.c | 4 +- drivers/common/sfc_efx/base/ef10_rx.c | 23 ++- drivers/common/sfc_efx/base/efx.h | 3 +- drivers/common/sfc_efx/base/efx_bootcfg.c | 2 +- drivers/common/sfc_efx/base/efx_mcdi.c | 51 +++++-- drivers/common/sfc_efx/base/efx_np.c | 167 +++++++++++++--------- drivers/common/sfc_efx/base/mcdi_mon.c | 2 +- 9 files changed, 168 insertions(+), 93 deletions(-)
Signature · 1 line
2.47.3
PATCH v3 1/14 common/sfc_efx/base: reduce stack in RSS context table write
From: Andy Moreton <[email protected]>
Code analysis reports an error for excessive stack consumption (over 1KB). Use a heap allocated payload buffer instead.
--- drivers/common/sfc_efx/base/ef10_rx.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-)
drivers/common/sfc_efx/base/ef10_rx.c +18 -5
@@ -394,11 +394,10 @@ efx_mcdi_rss_context_write_table( __in unsigned int nentries) {const efx_nic_cfg_t *encp =efx_nic_cfg_get (enp); +uint8_t *payload =NULL ;efx_mcdi_req_t req; -EFX_MCDI_DECLARE_BUF (payload, -MC_CMD_RSS_CONTEXT_WRITE_TABLE_IN_LENMAX_MCDI2 , -MC_CMD_RSS_CONTEXT_WRITE_TABLE_OUT_LEN );unsigned int i; +size_t size;int rc; if (nentries >
@@ -413,6 +412,16 @@ efx_mcdi_rss_context_write_table( goto fail2; } + size =EFX_MCDI_BUF_SIZE ( +MC_CMD_RSS_CONTEXT_WRITE_TABLE_IN_LEN (nentries), +MC_CMD_RSS_CONTEXT_WRITE_TABLE_OUT_LEN ); + +EFSYS_KMEM_ALLOC (enp->en_esip, size, payload); +if (payload ==NULL ) { + rc =ENOMEM ; + goto fail3; + } + req.emr_cmd =MC_CMD_RSS_CONTEXT_WRITE_TABLE ; req.emr_in_buf = payload; req.emr_in_length =MC_CMD_RSS_CONTEXT_WRITE_TABLE_IN_LEN (nentries);
@@ -425,7 +434,7 @@ efx_mcdi_rss_context_write_table(for (i =0 ; i < nentries; ++i) {if (table[i] >= encp->enc_rx_scale_indirection_max_nqueues) { rc =EINVAL ; - goto fail3; + goto fail4; } MCDI_IN_POPULATE_INDEXED_DWORD_2(req,
@@ -437,13 +446,17 @@ efx_mcdi_rss_context_write_table(efx_mcdi_execute (enp, &req);if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail4; + goto fail5; } +EFSYS_KMEM_FREE (enp->en_esip, size, payload);return (0 ); +fail5: +EFSYS_PROBE (fail5); fail4:EFSYS_PROBE (fail4); +EFSYS_KMEM_FREE (enp->en_esip, size, payload); fail3:EFSYS_PROBE (fail3); fail2:
Signature · 1 line
2.47.3
PATCH v3 2/14 common/sfc_efx/base: reduce stack in get addr regions MCDI
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports an error for excessive stack consumption (over 1KB). Use a heap allocated payload buffer instead.
--- drivers/common/sfc_efx/base/efx_mcdi.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
drivers/common/sfc_efx/base/efx_mcdi.c +20 -6
@@ -3439,15 +3439,24 @@ efx_mcdi_get_nic_addr_regions( __in efx_nic_t *enp, __out efx_nic_dma_region_info_t *endrip) { -EFX_MCDI_DECLARE_BUF (payload ,MC_CMD_GET_DESC_ADDR_REGIONS_IN_LEN , -MC_CMD_GET_DESC_ADDR_REGIONS_OUT_LENMAX_MCDI2 ); + uint8_t *payload = NULL;efx_xword_t *regions;efx_mcdi_req_t req; +size_t size;efx_rc_t rc;size_t alloc_size;unsigned int nregions;unsigned int i; + size =EFX_MCDI_BUF_SIZE (MC_CMD_GET_DESC_ADDR_REGIONS_IN_LEN , +MC_CMD_GET_DESC_ADDR_REGIONS_OUT_LENMAX_MCDI2 ); + +EFSYS_KMEM_ALLOC (enp->en_esip, size, payload); +if (payload ==NULL ) { + rc =ENOMEM ; + goto fail1; + } + req.emr_cmd =MC_CMD_GET_DESC_ADDR_REGIONS ; req.emr_in_buf = payload; req.emr_in_length =MC_CMD_GET_DESC_ADDR_REGIONS_IN_LEN ;
@@ -3458,13 +3467,13 @@ efx_mcdi_get_nic_addr_regions(if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail1; + goto fail2; }if (req.emr_out_length_used <MC_CMD_GET_DESC_ADDR_REGIONS_OUT_LENMIN ) { rc =EMSGSIZE ; - goto fail2; + goto fail3; } nregions = MC_CMD_GET_DESC_ADDR_REGIONS_OUT_REGIONS_NUM(
@@ -3477,7 +3486,7 @@ efx_mcdi_get_nic_addr_regions( alloc_size = nregions *sizeof (endrip->endri_regions[0 ]);if (alloc_size /sizeof (endrip->endri_regions[0 ]) != nregions) { rc =ENOMEM ; - goto fail3; + goto fail4; } EFSYS_KMEM_ALLOC(enp->en_esip,
@@ -3485,7 +3494,7 @@ efx_mcdi_get_nic_addr_regions( endrip->endri_regions);if (endrip->endri_regions ==NULL ) { rc =ENOMEM ; - goto fail4; + goto fail5; } endrip->endri_count = nregions;
@@ -3517,14 +3526,19 @@ efx_mcdi_get_nic_addr_regions( DESC_ADDR_REGION_TRGT_ADDR_ALIGN_LOG2); } +EFSYS_KMEM_FREE (enp->en_esip, size, payload); +return (0 ); +fail5: +EFSYS_PROBE (fail5); fail4:EFSYS_PROBE (fail4); fail3:EFSYS_PROBE (fail3); fail2:EFSYS_PROBE (fail2); +EFSYS_KMEM_FREE (enp->en_esip, size, payload); fail1:EFSYS_PROBE1 (fail1, efx_rc_t, rc);
Signature · 1 line
2.47.3
PATCH v3 3/14 common/sfc_efx/base: reduce stack in set addr regions MCDI
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports an error for excessive stack consumption (over 1KB). Use a heap allocated payload buffer instead.
--- drivers/common/sfc_efx/base/efx_mcdi.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/common/sfc_efx/base/efx_mcdi.c +18 -4
@@ -3550,12 +3550,11 @@ efx_mcdi_set_nic_addr_regions( __in efx_nic_t *enp, __in const efx_nic_dma_region_info_t *endrip) { -EFX_MCDI_DECLARE_BUF (payload , -MC_CMD_SET_DESC_ADDR_REGIONS_IN_LENMAX_MCDI2 , -MC_CMD_SET_DESC_ADDR_REGIONS_OUT_LEN ); efx_qword_t *trgt_addr_base; +uint8_t *payload =NULL ;efx_mcdi_req_t req;unsigned int i; +size_t size;efx_rc_t rc; if (endrip->endri_count >
@@ -3564,6 +3563,16 @@ efx_mcdi_set_nic_addr_regions( goto fail1; } + size =EFX_MCDI_BUF_SIZE ( +MC_CMD_SET_DESC_ADDR_REGIONS_IN_LEN (endrip->endri_count), +MC_CMD_SET_DESC_ADDR_REGIONS_OUT_LEN ); + +EFSYS_KMEM_ALLOC (enp->en_esip, size, payload); +if (payload ==NULL ) { + rc =ENOMEM ; + goto fail2; + } + req.emr_cmd =MC_CMD_SET_DESC_ADDR_REGIONS ; req.emr_in_buf = payload; req.emr_in_length =
@@ -3598,11 +3607,16 @@ efx_mcdi_set_nic_addr_regions(if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail2; + goto fail3; } +EFSYS_KMEM_FREE (enp->en_esip, size, payload); +return (0 ); +fail3: +EFSYS_PROBE (fail3); +EFSYS_KMEM_FREE (enp->en_esip, size, payload); fail2:EFSYS_PROBE (fail2); fail1:
Signature · 1 line
2.47.3
PATCH v3 4/14 common/sfc_efx/base: reduce stack in netport stat describe
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports an error for excessive stack consumption (over 1KB). Use a heap allocated payload buffer instead.
--- drivers/common/sfc_efx/base/efx_np.c | 37 +++++++++++++++++++--------- 1 file changed, 25 insertions(+), 12 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +25 -12
@@ -778,22 +778,30 @@ efx_np_stats_describe( __out_opt uint32_t *nprocessedp, __out_opt uint32_t *nstats_maxp) { -EFX_MCDI_DECLARE_BUF (payload , -MC_CMD_MAC_STATISTICS_DESCRIPTOR_IN_LEN , -MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMAX_MCDI2 ); + uint8_t *payload = NULL;uint32_t nprocessed;efx_mcdi_req_t req;uint8_t *entries;uint32_t stride;unsigned int i;size_t out_sz; +size_t size;efx_rc_t rc; - req.emr_out_length =MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMAX_MCDI2 ; - req.emr_in_length =MC_CMD_MAC_STATISTICS_DESCRIPTOR_IN_LEN ; + size =EFX_MCDI_BUF_SIZE (MC_CMD_MAC_STATISTICS_DESCRIPTOR_IN_LEN , +MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMAX_MCDI2 ); + +EFSYS_KMEM_ALLOC (enp->en_esip, size, payload); +if (payload ==NULL ) { + rc =ENOMEM ; + goto fail1; + } + req.emr_cmd =MC_CMD_MAC_STATISTICS_DESCRIPTOR ; - req.emr_out_buf = payload; req.emr_in_buf = payload; + req.emr_in_length =MC_CMD_MAC_STATISTICS_DESCRIPTOR_IN_LEN ; + req.emr_out_buf = payload; + req.emr_out_length =MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMAX_MCDI2 ;MCDI_IN_SET_DWORD (req,MAC_STATISTICS_DESCRIPTOR_IN_PORT_HANDLE , nph);MCDI_IN_SET_DWORD (req,MAC_STATISTICS_DESCRIPTOR_IN_OFFSET , req_ofst);
@@ -802,13 +810,13 @@ efx_np_stats_describe(if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail1; + goto fail2; } out_sz = req.emr_out_length_used;if (out_sz <MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_LENMIN ) { rc =EMSGSIZE ; - goto fail2; + goto fail3; }if (nstats_maxp !=NULL ) {
@@ -818,13 +826,13 @@ efx_np_stats_describe( }if (lut_nentries ==0 || lut ==NULL || nprocessedp ==NULL ) -return (0 ); + goto out; stride =MCDI_OUT_DWORD (req,MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_SIZE ); nprocessed =MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES_NUM (out_sz);if (nprocessed ==0 ) { rc =EMSGSIZE ; - goto fail3; + goto fail4; } entries = MCDI_OUT2(req, uint8_t,
@@ -834,14 +842,19 @@ efx_np_stats_describe(efx_np_stat_describe (entries + i * stride, lut_nentries, lut); *nprocessedp = nprocessed; + +out: +EFSYS_KMEM_FREE (enp->en_esip, size, payload); +return (0 ); +fail4: +EFSYS_PROBE (fail4); fail3:EFSYS_PROBE (fail3); - fail2:EFSYS_PROBE (fail2); - +EFSYS_KMEM_FREE (enp->en_esip, size, payload); fail1:EFSYS_PROBE1 (fail1, efx_rc_t, rc);return (rc);
Signature · 1 line
2.47.3
PATCH v3 5/14 common/sfc_efx/base: fix filter saved spec handling
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code Analysis notes that saved_spec can be NULL when passed into ef10_filter_add_select_action and ef10_filter_add_execute_action from ef10_filter_add_internal.
Fix the annotations to show that the parameter is optional, and assert the invariant at the STORE dereference site.
--- drivers/common/sfc_efx/base/ef10_filter.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/common/sfc_efx/base/ef10_filter.c +3 -2
@@ -690,7 +690,7 @@ ef10_filter_add_lookup_equal_spec(static void ef10_filter_add_select_action ( - __in efx_filter_spec_t *saved_spec, + __in_opt efx_filter_spec_t *saved_spec, __in efx_filter_spec_t *spec, __out enum ef10_filter_add_action_e *action, __out efx_filter_spec_t **overridden_spec)
@@ -752,7 +752,7 @@ ef10_filter_add_select_action( static __checkReturn efx_rc_t ef10_filter_add_execute_action( __in efx_nic_t *enp, - __in efx_filter_spec_t *saved_spec, + __in_opt efx_filter_spec_t *saved_spec, __in efx_filter_spec_t *spec, __in efx_filter_spec_t *overridden_spec, __in enum ef10_filter_add_action_e action,
@@ -769,6 +769,7 @@ ef10_filter_add_execute_action( goto out_unlock; }else if (action ==EF10_FILTER_ADD_STORE ) {EFSYS_ASSERT (overridden_spec !=NULL ); +EFSYS_ASSERT (saved_spec !=NULL ); saved_spec->efs_overridden_spec = overridden_spec; goto out_unlock; }
Signature · 1 line
2.47.3
PATCH v3 6/14 common/sfc_efx/base: fix annotations in client MAC addr get
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Fix annotations to show the size written to addr_bytes.
--- drivers/common/sfc_efx/base/efx.h | 3 ++- drivers/common/sfc_efx/base/efx_mcdi.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/common/sfc_efx/base/efx.h +2 -1
@@ -439,7 +439,8 @@ extern __checkReturn efx_rc_tefx_mcdi_client_mac_addr_get ( __in efx_nic_t *enp, __in uint32_t client_handle, - __out uint8_t addr_bytes[EFX_MAC_ADDR_LEN]); +__out_bcount (EFX_MAC_ADDR_LEN ) + uint8_t addr_bytes[EFX_MAC_ADDR_LEN]);LIBEFX_API extern __checkReturn efx_rc_t
drivers/common/sfc_efx/base/efx_mcdi.c +2 -1
@@ -737,7 +737,8 @@ efx_mcdi_get_own_client_handle(efx_mcdi_client_mac_addr_get ( __in efx_nic_t *enp, __in uint32_t client_handle, - __out uint8_t addr_bytes[EFX_MAC_ADDR_LEN]) +__out_bcount (EFX_MAC_ADDR_LEN ) + uint8_t addr_bytes[EFX_MAC_ADDR_LEN]) { efx_mcdi_req_t req; EFX_MCDI_DECLARE_BUF(payload,
Signature · 1 line
2.47.3
PATCH v3 7/14 common/sfc_efx/base: fix annotations in HW-SW mask converter
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports that efx_np_cap_mask_hw_to_sw does not always write to sw_cap_maskp. Fix the annotation to show it is valid on input, and initialise the mask in efx_np_cap_hw_data_to_sw_mask.
--- drivers/common/sfc_efx/base/efx_np.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +8 -6
@@ -190,7 +190,7 @@ efx_np_cap_mask_hw_to_sw( __in unsigned int hw_sw_map_nentries, __in_bcount(hw_cap_data_nbytes) const uint8_t *hw_cap_data, __in size_t hw_cap_data_nbytes, - __out uint32_t *sw_cap_maskp) + __inout uint32_t *sw_cap_maskp) { FOREACH_SUP_CAP(hw_sw_map, hw_sw_map_nentries, hw_cap_data, hw_cap_data_nbytes) {
@@ -216,6 +216,8 @@ efx_np_cap_hw_data_to_sw_mask( __in const uint8_t *hw_data, __out uint32_t *sw_maskp) { + *sw_maskp =0 ; +EFX_NP_CAP_MASK_HW_TO_SW (efx_np_cap_map_tech,ETH_AN_FIELDS_TECH_MASK , hw_data, sw_maskp);
@@ -429,21 +431,21 @@ efx_np_link_state( _NOTE(ARGUNUSED(lbp))#endif /* EFSYS_OPT_LOOPBACK */ -if (lsp->enls_an_supported !=B_FALSE ) - lsp->enls_adv_cap_mask |=1U <<EFX_PHY_CAP_AN ; -efx_np_cap_hw_data_to_sw_mask ( MCDI_OUT2(req, const uint8_t, LINK_STATE_OUT_ADVERTISED_ABILITIES), &lsp->enls_adv_cap_mask); -if (status_flags & (1U <<MC_CMD_LINK_STATUS_FLAGS_AN_ABLE )) - lsp->enls_lp_cap_mask |=1U <<EFX_PHY_CAP_AN ; +if (lsp->enls_an_supported !=B_FALSE ) + lsp->enls_adv_cap_mask |=1U <<EFX_PHY_CAP_AN ;efx_np_cap_hw_data_to_sw_mask (MCDI_OUT2 (req ,const uint8_t , LINK_STATE_OUT_LINK_PARTNER_ABILITIES), &lsp->enls_lp_cap_mask); +if (status_flags & (1U <<MC_CMD_LINK_STATUS_FLAGS_AN_ABLE )) + lsp->enls_lp_cap_mask |=1U <<EFX_PHY_CAP_AN ; + tech =MCDI_OUT_WORD (req,LINK_STATE_OUT_LINK_TECHNOLOGY );if (tech <EFX_ARRAY_SIZE (efx_np_tech_to_lane_count))
Signature · 1 line
2.47.3
PATCH v3 8/14 common/sfc_efx/base: fix annotations in get fixed port props
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports a buffer overrun for the sup_cap_rawp argument. Fix the annotation to show the writable buffer size.
--- drivers/common/sfc_efx/base/efx_np.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/common/sfc_efx/base/efx_np.c +2 -1
@@ -235,7 +235,8 @@ static __checkReturn efx_rc_tefx_np_get_fixed_port_props ( __in efx_nic_t *enp, __in efx_np_handle_t nph, - __out_opt uint8_t *sup_cap_rawp, + __out_bcount_opt(MC_CMD_ETH_AN_FIELDS_LEN) + uint8_t *sup_cap_rawp, __out_opt uint32_t *sup_cap_maskp, __out_opt efx_qword_t *loopback_cap_maskp) {
Signature · 1 line
2.47.3
PATCH v3 9/14 common/sfc_efx/base: fix annotations in SW-HW enum converter
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports returning uninitialised memory in *enum_hwp. Fix the annotations to show that the write only occurs on successful return.
--- drivers/common/sfc_efx/base/efx_np.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/sfc_efx/base/efx_np.c +1 -1
@@ -504,7 +504,7 @@ efx_np_sw_link_mode_to_cap(return (0 ); } -static void +__success(*supportedp != 0) static void efx_np_cap_enum_sw_to_hw( __in_ecount(hw_sw_map_nentries) const struct efx_np_cap_map *hw_sw_map, __in unsigned int hw_sw_map_nentries,
Signature · 1 line
2.47.3
PATCH v3 10/14 common/sfc_efx/base: fix annotation in netport stat describe
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reported a NULL dereference of the lut parameter. Fix the annotation to show it is not optional (must be non-NULL).
--- drivers/common/sfc_efx/base/efx_np.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/common/sfc_efx/base/efx_np.c +1 -1
@@ -733,7 +733,7 @@ static voidefx_np_stat_describe ( __in uint8_t *hw_entry_buf, __in unsigned int lut_nentries, - __out_ecount_opt(lut_nentries) efx_np_stat_t *lut) + __out_ecount(lut_nentries) efx_np_stat_t *lut) { const efx_np_stat_t *map;efx_mac_stat_t sw_id;
Signature · 1 line
2.47.3
PATCH v3 11/14 common/sfc_efx/base: fix flex array in netport stat describe
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reported returning uninitialised memory at *lut and *nprocessedp. Refactor to ensure these parameters are only used when non-NULL.
This function should also be using the ENTRY_COUNT field for the number of descriptors returned, as the descriptor size is not known statically (they are extensible). Also use the MORE_ENTRIES flag to determine if all of the descriptors have been fetched.
--- drivers/common/sfc_efx/base/efx_np.c | 39 +++++++++++++++++++--------- 1 file changed, 27 insertions(+), 12 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +27 -12
@@ -782,10 +782,11 @@ efx_np_stats_describe( __out_opt uint32_t *nstats_maxp) {uint8_t *payload =NULL ; -uint32_t nprocessed;efx_mcdi_req_t req;uint8_t *entries;uint32_t stride; +uint32_t count; +uint32_t more;unsigned int i;size_t out_sz;size_t size;
@@ -828,29 +829,43 @@ efx_np_stats_describe(sizeof (efx_qword_t); } -if (lut_nentries ==0 || lut ==NULL || nprocessedp ==NULL ) - goto out; - stride =MCDI_OUT_DWORD (req,MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_SIZE ); - nprocessed =MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES_NUM (out_sz); -if (nprocessed ==0 ) { + count =MCDI_OUT_DWORD (req,MAC_STATISTICS_DESCRIPTOR_OUT_ENTRY_COUNT ); + more =MCDI_OUT_DWORD_FIELD (req, +MAC_STATISTICS_DESCRIPTOR_OUT_FLAGS , +MAC_STATISTICS_DESCRIPTOR_OUT_MORE_ENTRIES ); + +if ((count ==0 ) && (more !=0 )) { rc =EMSGSIZE ; goto fail4; } - entries =MCDI_OUT2 (req, uint8_t, -MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES ); +if (count >0 && (stride <MC_CMD_STAT_DESC_LEN || count > + (out_sz -MC_CMD_MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES_OFST ) / + stride)) { + rc =EMSGSIZE ; + goto fail5; + } + +if (lut !=NULL ) { + entries =MCDI_OUT2 (req, uint8_t, +MAC_STATISTICS_DESCRIPTOR_OUT_ENTRIES ); -for (i =0 ; i < nprocessed; ++i) -efx_np_stat_describe (entries + i * stride, lut_nentries, lut); +for (i =0 ; i < count; ++i) { +efx_np_stat_describe (entries + i * stride, + lut_nentries, lut); + } + } - *nprocessedp = nprocessed; +if (nprocessedp !=NULL ) + *nprocessedp = count; -out:EFSYS_KMEM_FREE (enp->en_esip, size, payload);return (0 ); +fail5: +EFSYS_PROBE (fail5); fail4:EFSYS_PROBE (fail4); fail3:
Signature · 1 line
2.47.3
PATCH v3 12/14 common/sfc_efx/base: fix filter in SW-HW mask converter
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports that the optional filter_arg could be used to invoke the callback, but that function has type efx_np_cap_filter_cb, where the argument is required. Add a NULL check to ensure that the filter_arg is valid when invoking the callback.
--- drivers/common/sfc_efx/base/efx_np.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +3 -3
@@ -1170,7 +1170,7 @@ efx_np_cap_mask_sw_to_hw( __in uint32_t mask_sw, __in_opt efx_np_cap_filter_cb *filter_cb, __in_opt void *filter_arg, - __out uint8_t *mask_hwp) + __inout uint8_t *mask_hwp) { FOREACH_SUP_CAP(hw_sw_map, hw_sw_map_nentries, hw_cap_data, hw_cap_data_nbytes) {
@@ -1179,8 +1179,8 @@ efx_np_cap_mask_sw_to_hw(if ((mask_sw & flag_sw) != flag_sw)continue ; -if (filter_cb !=NULL && -filter_cb (hw_sw_map->encm_hw, filter_arg) ==B_FALSE ) +if ((filter_cb !=NULL ) && (filter_arg !=NULL ) && + (filter_cb (hw_sw_map->encm_hw, filter_arg) ==B_FALSE ))continue ; mask_hwp[CAP_BYTE (hw_sw_map)] |=CAP_FLAG (hw_sw_map);
Signature · 1 line
2.47.3
PATCH v3 13/14 common/sfc_efx/base: rework SW mask to HW enum converter
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Code analysis reports that *enum_hwp is not written on successful return on some paths through this function. Refactor to simplify the code, and adjust the annotations so it is clear that *enum_hwp is only written on successful return. Adjust FEC handling in efx_np_link_ctrl to allow for *supportedp always being updated.
Code analysis also reports that the optional filter_arg can be NULL when invoking filter_cb, but the callback argument is not optional. Check that filter_arg is non-NULL to ensure correct usage.
The refactoring adds an explicit default for the HW enum for the case when no software capability bit is found in the map. For the link technology, this default becomes AUTO, replacing the implicit NONE. This change is intentional and yields the correct instruction to firmware.
--- drivers/common/sfc_efx/base/efx_np.c | 68 ++++++++++++++-------------- 1 file changed, 34 insertions(+), 34 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +34 -34
@@ -1211,60 +1211,59 @@ efx_np_cap_mask_sw_to_hw( MC_CMD_##_hw_cap_section##_LEN, (_mask_sw), \ (_filter_cb), (_filter_arg), (_mask_hwp)) -static void +__success(*supportedp != 0) static voidefx_np_cap_sw_mask_to_hw_enum ( __in_ecount(hw_sw_map_nentries) const struct efx_np_cap_map *hw_sw_map, __in unsigned int hw_sw_map_nentries, __in_bcount(hw_cap_data_nbytes) const uint8_t *hw_cap_data, __in size_t hw_cap_data_nbytes, __in uint32_t mask_sw, + __in uint16_t enum_hw_def, __in_opt efx_np_cap_filter_cb *filter_cb, __in_opt void *filter_arg, __out boolean_t *supportedp, __out_opt uint16_t *enum_hwp) { - unsigned int sw_nflags_req = 0; -uint32_t sw_check_mask =0 ; + boolean_t supported = B_FALSE; +uint32_t matched_mask =0 ; +uint32_t flags_seen =0 ;unsigned int i;for (i =0 ; i < hw_sw_map_nentries; ++i) { -uint32_t flag_sw =1U << hw_sw_map->encm_sw; -unsigned int byte_idx =CAP_BYTE (hw_sw_map); -uint8_t flag_hw =CAP_FLAG (hw_sw_map); +uint32_t flag_sw =1U << hw_sw_map[i].encm_sw; +unsigned int byte_idx =CAP_BYTE (&hw_sw_map[i]); +uint8_t flag_hw =CAP_FLAG (&hw_sw_map[i]); -if (byte_idx >= hw_cap_data_nbytes) { - ++(hw_sw_map); +if (byte_idx >= hw_cap_data_nbytes)continue ; - } -if ((mask_sw & flag_sw) == flag_sw) { -if ((sw_check_mask & flag_sw) ==0 ) - ++(sw_nflags_req); +if ((mask_sw & flag_sw) != flag_sw) +continue ; - sw_check_mask |= flag_sw; + flags_seen |= flag_sw; -if ((hw_cap_data[byte_idx] & flag_hw) == flag_hw) { -if (filter_cb ==NULL || -filter_cb (hw_sw_map->encm_hw, filter_arg) != -B_FALSE ) { - mask_sw &= ~(flag_sw); +if ((hw_cap_data[byte_idx] & flag_hw) != flag_hw) +continue ; -if (enum_hwp !=NULL ) - *enum_hwp = hw_sw_map->encm_hw; - } - } - } +if ((filter_cb !=NULL ) && (filter_arg !=NULL ) && + (filter_cb (hw_sw_map[i].encm_hw, filter_arg) ==B_FALSE )) +continue ; - ++(hw_sw_map); +if (enum_hwp !=NULL && (matched_mask & flag_sw) ==0 ) + *enum_hwp = hw_sw_map[i].encm_hw; + + matched_mask |= flag_sw; + supported =B_TRUE ; } -if (sw_check_mask !=0 && (mask_sw & sw_check_mask) == sw_check_mask) { -/* Failed to select the enum by at least one capability bit. */ - *supportedp =B_FALSE ; -return ; +if (flags_seen ==0 ) { +if (enum_hwp !=NULL ) + *enum_hwp = enum_hw_def; + + supported =B_TRUE ; } - *supportedp =B_TRUE ; + *supportedp = supported; }/*
@@ -1276,12 +1275,13 @@ efx_np_cap_sw_mask_to_hw_enum(*/ #define EFX_NP_CAP_SW_MASK_TO_HW_ENUM ( \ _hw_sw_cap_map, _hw_cap_section, _hw_cap_data, \ - _mask_sw, _filter_cb, _filter_arg, _supportedp, _enum_hwp) \ + _mask_sw, _enum_hw_def, _filter_cb, _filter_arg, \ + _supportedp, _enum_hwp) \ efx_np_cap_sw_mask_to_hw_enum((_hw_sw_cap_map), \ EFX_ARRAY_SIZE(_hw_sw_cap_map), \ MCDI_STRUCT_MEMBER((_hw_cap_data), const uint8_t, \ MC_CMD_##_hw_cap_section), \ - MC_CMD_##_hw_cap_section##_LEN, (_mask_sw), \ + MC_CMD_##_hw_cap_section##_LEN, (_mask_sw), (_enum_hw_def), \ (_filter_cb), (_filter_arg), \ (_supportedp), (_enum_hwp))
@@ -1396,6 +1396,7 @@ efx_np_link_ctrl( }else {EFX_NP_CAP_SW_MASK_TO_HW_ENUM (efx_np_cap_map_tech,ETH_AN_FIELDS_TECH_MASK , cap_data_raw, cap_mask_sw, +MC_CMD_ETH_TECH_AUTO , efx_np_filter_tech_by_lane_count_cb, &lane_count, &supported, &link_tech);
@@ -1424,10 +1425,9 @@ efx_np_link_ctrl(*/ EFX_NP_CAP_SW_MASK_TO_HW_ENUM (efx_np_cap_map_fec_req,ETH_AN_FIELDS_FEC_MASK , cap_data_raw, cap_mask_sw, -NULL ,NULL , &supported, &cap_enum_hw); + cap_enum_hw,NULL ,NULL , &supported, &cap_enum_hw); -if ((cap_mask_sw &EFX_PHY_CAP_FEC_MASK ) !=0 - && supported ==B_FALSE ) { +if (supported ==B_FALSE ) { rc =ENOTSUP ; goto fail5; }
Signature · 1 line
2.47.3
PATCH v3 14/14 common/sfc_efx/base: cleanup wider type comparisons in loops
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
CodeQL reports errors for comparisons between narrow and wider types in loop conditions [cpp/infiniteloop]. Use the wider types to fix that.
--- drivers/common/sfc_efx/base/ef10_filter.c | 2 +- drivers/common/sfc_efx/base/ef10_mcdi.c | 2 +- drivers/common/sfc_efx/base/ef10_nvram.c | 4 ++-- drivers/common/sfc_efx/base/efx_bootcfg.c | 2 +- drivers/common/sfc_efx/base/mcdi_mon.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-)
drivers/common/sfc_efx/base/ef10_filter.c +1 -1
@@ -1300,7 +1300,7 @@ ef10_filter_supported_filters(size_t mcdi_list_length;size_t mcdi_encap_list_length;size_t list_length; -uint32_t i; +size_t i;uint32_t next_buf_idx;size_t next_buf_length;efx_rc_t rc;
drivers/common/sfc_efx/base/ef10_mcdi.c +1 -1
@@ -140,7 +140,7 @@ ef10_mcdi_send_request(const efx_mcdi_transport_t *emtp = enp->en_mcdi.em_emtp;efsys_mem_t *esmp = emtp->emt_dma_mem;efx_dword_t dword; -unsigned int pos; +size_t pos;EFSYS_ASSERT (EFX_FAMILY_IS_EF100 (enp) ||EFX_FAMILY_IS_EF10 (enp));
drivers/common/sfc_efx/base/ef10_nvram.c +2 -2
@@ -2386,7 +2386,7 @@ ef10_nvram_type_to_partn(efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);ef10_parttbl_entry_t *parttbl =NULL ;size_t parttbl_rows =0 ; -unsigned int i; +size_t i; EFSYS_ASSERT3U(type, !=, EFX_NVRAM_INVALID); EFSYS_ASSERT3U(type, <, EFX_NVRAM_NTYPES);
@@ -2418,7 +2418,7 @@ ef10_nvram_partn_to_type(efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);ef10_parttbl_entry_t *parttbl =NULL ;size_t parttbl_rows =0 ; -unsigned int i; +size_t i;EFSYS_ASSERT (typep !=NULL );
drivers/common/sfc_efx/base/efx_bootcfg.c +1 -1
@@ -140,8 +140,8 @@ efx_dhcp_csum( __in_bcount(size) uint8_t const *data, __in size_t size) { -unsigned int pos; uint8_t checksum = 0; +size_t pos;for (pos =0 ; pos < size; pos++) checksum += data[pos];
drivers/common/sfc_efx/base/mcdi_mon.c +1 -1
@@ -30,7 +30,7 @@ mcdi_mon_decode_stats( {efx_mcdi_iface_t *emip = &(enp->en_mcdi.em_emip);efx_mon_stat_portmask_t port_mask; -uint16_t sensor; +size_t sensor;size_t sensor_max;uint32_t stat_mask[(EFX_MON_NSTATS +31 ) /32 ];uint32_t idx =0 ;
Signature · 1 line
2.47.3
Quoted 16 lines · On Fri, 14 Aug 2026 16:54:24 +0400 Ivan Malov <[email protected]> wrote:
This series addresses code analysis defects in the common/sfc_efx/base library.
The first four patches fix excessive stack consumption in MCDI helper functions, each exceeding 1 KB on-stack, by switching to heap-allocated payload buffers.
The remaining ten patches correct SAL annotations, add assertions and bounds checks across netport and filter helpers to address uninitialised memory, buffer overrun, and potential dereference issues. The final patch widens loop variable types to address a CodeQL warning.
v3:
Quoted 7 lines
- addressed https://mails.dpdk.org/archives/dev/2026-August/343201.html
-- patches 01-04: switched toEFX_MCDI_BUF_SIZE
-- patch 05: replaced the unreachable NULL guard with
EFSYS_ASSERT; corrected the commit message
-- patches 09, 13: moved__successto the declaration line -- patch 11: added stride and count bounds check before the loop -- patch 13: documented theTECH_AUTOdefault behaviour
This all looks good, applied to next-net.
Still going through the later patches.
v3 cover net/sfc: miscellaneous bug fixes
In reply to Ivan MalovThree independent fixes. The first ensures that Rx queue type flags are derived from scratch on every queue setup, preventing flags from a prior configuration persisting when an offload is disabled.
The second patch removes an erroneous static qualifier from a flow RSS iterator variable, which incorrectly shared state between multiple interfaces.
The third patch corrects reading of the advertised autoneg capability. When the user disables it, the corresponding bit was re-added upon the next link-state query.
v3:
- addressed https://mails.dpdk.org/archives/dev/2026-August/343202.html
-- patch 3/3: added Depends-on; inlined ep_adv_cap_mask
v2:
- note for the future AI reviews: apply this on top of the 'common/sfc_efx/base: fix code analysis issues' series
- addressed https://mails.dpdk.org/archives/dev/2026-August/343073.html
-- fixed the queue type flags so that it accounts for the extra flags -- the rest of the notes do not point at factual defects
Ivan Malov (3):
net/sfc: set Rx queue type flags from scratch on queue setup net/sfc: drop wrong static qualifier from iterator variable common/sfc_efx/base: fix reading advertised autoneg ability
drivers/common/sfc_efx/base/efx_np.c | 11 +++++------ drivers/common/sfc_efx/base/medford4_phy.c | 5 ++++- drivers/net/sfc/sfc_flow_rss.c | 2 +- drivers/net/sfc/sfc_rx.c | 8 ++++---- drivers/net/sfc/sfc_rx.h | 1 + 5 files changed, 15 insertions(+), 12 deletions(-)
Signature · 1 line
2.47.3
PATCH v3 1/3 net/sfc: set Rx queue type flags from scratch on queue setup
Derive queue type flags from scratch on every queue setup so that flags left over from a previous configuration do not persist when an offload is disabled.
--- drivers/net/sfc/sfc_rx.c | 8 ++++---- drivers/net/sfc/sfc_rx.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-)
drivers/net/sfc/sfc_rx.c +4 -4
@@ -1183,9 +1183,9 @@ sfc_rx_qinit(struct sfc_adapter *sa, sfc_sw_index_t sw_index,else rxq_info->type =EFX_RXQ_TYPE_DEFAULT ; - rxq_info->type_flags |= - (offloads &RTE_ETH_RX_OFFLOAD_SCATTER ) ? -EFX_RXQ_FLAG_SCATTER :EFX_RXQ_FLAG_NONE ; + rxq_info->type_flags = rxq_info->extra_type_flags | + ((offloads &RTE_ETH_RX_OFFLOAD_SCATTER ) ? +EFX_RXQ_FLAG_SCATTER :EFX_RXQ_FLAG_NONE ); if ((encp->enc_tunnel_encapsulations_supported != 0) && (sfc_dp_rx_offload_capa(sa->priv.dp_rx) &
@@ -1660,7 +1660,7 @@ sfc_rx_qinit_info(struct sfc_adapter *sa, sfc_sw_index_t sw_index,SFC_ASSERT (rte_is_power_of_2 (max_entries)); rxq_info->max_entries = max_entries; - rxq_info->type_flags = extra_efx_type_flags; + rxq_info->extra_type_flags = extra_efx_type_flags;return 0 ; }
drivers/net/sfc/sfc_rx.h +1 -0
@@ -110,6 +110,7 @@ struct sfc_rxq_info {unsigned int entries;efx_rxq_type_t type;unsigned int type_flags; +unsigned int extra_type_flags;struct sfc_dp_rxq *dp;boolean_t deferred_start;boolean_t deferred_started;
Signature · 1 line
2.47.3
PATCH v3 2/3 net/sfc: drop wrong static qualifier from iterator variable
In reply to Ivan MalovObviously, this should be per interface state.
Static wrongly turns it into global state.
--- drivers/net/sfc/sfc_flow_rss.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/sfc/sfc_flow_rss.c +1 -1
@@ -202,7 +202,7 @@ sfc_flow_rss_ctx_reuse(struct sfc_adapter *sa, uint16_t sw_qid_min, const uint16_t *sw_qids) { struct sfc_flow_rss *flow_rss = &sa->flow_rss; -static struct sfc_flow_rss_ctx *ctx; +struct sfc_flow_rss_ctx *ctx;SFC_ASSERT (sfc_adapter_is_locked (sa));
Signature · 1 line
2.47.3
PATCH v3 3/3 common/sfc_efx/base: fix reading advertised autoneg ability
In reply to Ivan MalovThe issue is that when the user disables auto-negotiation by removing the capability bit from the 'advertised mask' (set method) and then reads the resulting capabilities, which involves querying MCDI, the bit reappears in the mask irrespective of the user's intent.
Fix this by remembering the user's intent before any link-state queries.
Depends-on: series-38976 ("common/sfc_efx/base: fix code analysis issues")
--- drivers/common/sfc_efx/base/efx_np.c | 11 +++++------ drivers/common/sfc_efx/base/medford4_phy.c | 5 ++++- 2 files changed, 9 insertions(+), 7 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +5 -6
@@ -436,9 +436,6 @@ efx_np_link_state( MCDI_OUT2(req, const uint8_t, LINK_STATE_OUT_ADVERTISED_ABILITIES), &lsp->enls_adv_cap_mask); -if (lsp->enls_an_supported !=B_FALSE ) - lsp->enls_adv_cap_mask |=1U <<EFX_PHY_CAP_AN ; - efx_np_cap_hw_data_to_sw_mask( MCDI_OUT2(req, const uint8_t, LINK_STATE_OUT_LINK_PARTNER_ABILITIES),
@@ -1030,11 +1027,13 @@ efx_np_attach(if (rc !=0 ) goto fail3; -if (ls.enls_an_supported !=B_FALSE ) - epp->ep_phy_cap_mask |=1U <<EFX_PHY_CAP_AN ; - epp->ep_adv_cap_mask = ls.enls_adv_cap_mask; +if (ls.enls_an_supported !=B_FALSE ) { + epp->ep_adv_cap_mask |=1U <<EFX_PHY_CAP_AN ; + epp->ep_phy_cap_mask |=1U <<EFX_PHY_CAP_AN ; + } +#if EFSYS_OPT_LOOPBACK efx_np_assign_loopback_props (enp);#endif /* EFSYS_OPT_LOOPBACK */
drivers/common/sfc_efx/base/medford4_phy.c +4 -1
@@ -34,13 +34,16 @@ medford4_phy_get_link(efx_np_handle_t nph = enp->en_port.ep_np_handle;efx_np_link_state_t ls;efx_np_mac_state_t ms; +uint32_t preserve_an;efx_rc_t rc; + preserve_an = enp->en_port.ep_adv_cap_mask & (1U <<EFX_PHY_CAP_AN ); + rc =efx_np_link_state (enp, nph, &ls);if (rc !=0 ) goto fail1; - elsp->epls.epls_adv_cap_mask = ls.enls_adv_cap_mask; + elsp->epls.epls_adv_cap_mask = ls.enls_adv_cap_mask | preserve_an; elsp->epls.epls_lp_cap_mask = ls.enls_lp_cap_mask; elsp->epls.epls_lane_count = ls.enls_lane_count; elsp->els_loopback = ls.enls_loopback;
Signature · 1 line
2.47.3
v3 cover common/sfc_efx/base: add VADAPTER statistics for Medford4
In reply to Ivan MalovThis series adds support for per-VF (VADAPTER) MAC statistics on Medford4 in the libefx base layer.
The first patch selectively updates the MCDI headers, adding new definitions needed by the subsequent patches.
The second patch introduces netport VADAPTER statistics IDs, which identify the per-VF counter set returned by the NIC.
The third patch switches the netport statistics call to use GET_NETPORT_STATISTICS_V2, passing the EVB port handle so that the correct per-VF counters are retrieved.
v3:
- addressed https://mails.dpdk.org/archives/dev/2026-August/343074.html
-- patch 3/3: documented why V2 is used unconditionally
v2:
- note for the future AI reviews: apply this on top of the 'net/sfc: miscellaneous bug fixes' series
- v1 review notes do not seem to point at factual defects
Andy Moreton (2):
common/sfc_efx/base: add support for VADAPTER statistics IDs common/sfc_efx/base: switch netport stats to use EVB port ID
Ivan Malov (1):
common/sfc_efx/base: update MCDI headers
drivers/common/sfc_efx/base/efx_impl.h | 3 +- drivers/common/sfc_efx/base/efx_mcdi.c | 2 +- drivers/common/sfc_efx/base/efx_np.c | 60 +++- drivers/common/sfc_efx/base/efx_regs_mcdi.h | 313 +++++++++++++++++++- drivers/common/sfc_efx/base/medford4_mac.c | 12 +- 5 files changed, 373 insertions(+), 17 deletions(-)
Signature · 1 line
2.47.3
PATCH v3 1/3 common/sfc_efx/base: update MCDI headers
Selectively import MCDI changes from the in-house libefx repository to meet the needs of the feature support patches that will follow.
--- drivers/common/sfc_efx/base/efx_regs_mcdi.h | 313 +++++++++++++++++++- 1 file changed, 306 insertions(+), 7 deletions(-)
drivers/common/sfc_efx/base/efx_regs_mcdi.h +306 -7
@@ -6952,7 +6952,7 @@#define MC_CMD_LINK_STATE_MSGSET 0x6c#undef MC_CMD_0x6c_PRIVILEGE_CTG -#define MC_CMD_0x6c_PRIVILEGE_CTG SRIOV_CTG_LINK +#define MC_CMD_0x6c_PRIVILEGE_CTG SRIOV_CTG_GENERAL/* MC_CMD_LINK_STATE_IN msgrequest */ #define MC_CMD_LINK_STATE_IN_LEN 4
@@ -12323,13 +12323,15 @@/***********************************/ /* MC_CMD_MAC_CTRL -* Set MAC configuration. Return code: 0, EINVAL, ENOTSUP +* Set MAC configuration. Requires LINK privilege. The only exception is when +* the only request is MTU change and the new MTU <= the current setting. In +* such case we do nothing and return 0. Return code: 0, EINVAL, ENOTSUP */ #define MC_CMD_MAC_CTRL 0x1df#define MC_CMD_MAC_CTRL_MSGSET 0x1df#undef MC_CMD_0x1df_PRIVILEGE_CTG -#define MC_CMD_0x1df_PRIVILEGE_CTG SRIOV_CTG_LINK +#define MC_CMD_0x1df_PRIVILEGE_CTG SRIOV_CTG_GENERAL/* MC_CMD_MAC_CTRL_IN msgrequest */ #define MC_CMD_MAC_CTRL_IN_LEN 32
@@ -12454,7 +12456,7 @@#define MC_CMD_MAC_STATE_MSGSET 0x1e0#undef MC_CMD_0x1e0_PRIVILEGE_CTG -#define MC_CMD_0x1e0_PRIVILEGE_CTG SRIOV_CTG_LINK +#define MC_CMD_0x1e0_PRIVILEGE_CTG SRIOV_CTG_GENERAL/* MC_CMD_MAC_STATE_IN msgrequest */ #define MC_CMD_MAC_STATE_IN_LEN 4
@@ -12609,6 +12611,16 @@#define MC_CMD_STAT_ID_MAC 0x2/* enum: Network port PHY statistics. */ #define MC_CMD_STAT_ID_PHY 0x3 +/* enum: Network port packet memory (PM) statistics. */ +#define MC_CMD_STAT_ID_PM 0x4 +/* enum: Network port RXDP statistics. */ +#define MC_CMD_STAT_ID_RXDP 0x5 +/* enum: Low Latency datapath statistics. */ +#define MC_CMD_STAT_ID_LL 0x6 +/* enum: Fast Classifier statistics. */ +#define MC_CMD_STAT_ID_FC 0x7 +/* enum: Vadapter statistics. */ +#define MC_CMD_STAT_ID_VADAPTER 0x8#define MC_CMD_STAT_ID_SOURCE_ID_LBN 0#define MC_CMD_STAT_ID_SOURCE_ID_WIDTH 16#define MC_CMD_STAT_ID_MARKER_STAT_ID_OFST 2
@@ -12620,7 +12632,7 @@*/ #define MC_CMD_STAT_ID_GENERATION_START 0x1/* enum: This value is used to mark the end of a generation of statistics for -* DMA synchronizaion. Always the last entry in the DMA buffer and set to the +* DMA synchronization. Always the last entry in the DMA buffer and set to the * same value as GENERATION_START. The host driver must compare the * GENERATION_START and GENERATION_END values to verify that the DMA buffer is * consistent upon copying the the DMA buffer. If they do not match, it means
@@ -12769,6 +12781,207 @@#define MC_CMD_STAT_ID_FEC_CORRECTED_SYMBOLS_LANE3 0x6#define MC_CMD_STAT_ID_PHY_STAT_ID_LBN 16#define MC_CMD_STAT_ID_PHY_STAT_ID_WIDTH 16 +/* Include packet memory (PM) stats. */ +#define MC_CMD_STAT_ID_PM_STAT_ID_OFST 2 +#define MC_CMD_STAT_ID_PM_STAT_ID_LEN 2 +/* enum property: index */ +/* enum: PM discard_vfifo_full counter. */ +#define MC_CMD_STAT_ID_PM_DISCARD_VFIFO_FULL 0x1 +/* enum: PM discard_qbb counter. */ +#define MC_CMD_STAT_ID_PM_DISCARD_QBB 0x2 +/* enum: PM discard_mapping counter. */ +#define MC_CMD_STAT_ID_PM_DISCARD_MAPPING 0x3 +#define MC_CMD_STAT_ID_PM_STAT_ID_LBN 16 +#define MC_CMD_STAT_ID_PM_STAT_ID_WIDTH 16 +/* Include RXDP stats. */ +#define MC_CMD_STAT_ID_RXDP_STAT_ID_OFST 2 +#define MC_CMD_STAT_ID_RXDP_STAT_ID_LEN 2 +/* enum property: index */ +/* enum: RXDP counter: Number of packets dropped due to the queue being +* disabled. +*/ +#define MC_CMD_STAT_ID_RXDP_Q_DISABLED_PKTS 0x1 +/* enum: RXDP counter: Number of packets dropped by the DICPU. */ +#define MC_CMD_STAT_ID_RXDP_DI_DROPPED_PKTS 0x2 +/* enum: RXDP counter: Number of non-host packets. */ +#define MC_CMD_STAT_ID_RXDP_STREAMING_PKTS 0x3 +/* enum: RXDP counter: Number of times an hlb descriptor fetch was performed. +*/ +#define MC_CMD_STAT_ID_RXDP_HLB_FETCH_CONDITIONS 0x4 +/* enum: RXDP counter: Number of times the DPCPU waited for an existing +* descriptor fetch. +*/ +#define MC_CMD_STAT_ID_RXDP_HLB_WAIT_CONDITIONS 0x5 +/* enum: RXDP counter: Number of packets truncated because scattering was +* disabled. +*/ +#define MC_CMD_STAT_ID_RXDP_SCATTER_DISABLED_TRUNC 0x6 +/* enum: RXDP counter: Number of times the RXDP head of line blocked waiting +* for descriptors. Will be zero unless RXDP_HLB_IDLE capability is set. +*/ +#define MC_CMD_STAT_ID_RXDP_HLB_IDLE 0x7 +/* enum: RXDP counter: Number of times the RXDP timed out while head of line +* blocking. Will be zero unless RXDP_HLB_IDLE capability is set. +*/ +#define MC_CMD_STAT_ID_RXDP_HLB_TIMEOUT 0x8 +#define MC_CMD_STAT_ID_RXDP_STAT_ID_LBN 16 +#define MC_CMD_STAT_ID_RXDP_STAT_ID_WIDTH 16 +/* Include Low Latency datapath stats */ +#define MC_CMD_STAT_ID_LL_STAT_ID_OFST 2 +#define MC_CMD_STAT_ID_LL_STAT_ID_LEN 2 +/* enum property: index */ +/* enum: BIU Host CTPIO Write Byte Count, x3_ctpio_xfr_if vld & rdy & wr_req & +* sot & CTPIO_WINDOW_ADDR, increment by bcnt. +*/ +#define MC_CMD_STAT_ID_LL_CTPIO_WIN_BYTES 0x1 +/* enum: CTPIO TX Warm Packet Count, internal warm flag drop count per port. */ +#define MC_CMD_STAT_ID_LL_CTPIO_WIN_WARM_PKTS 0x2 +/* enum: CTPIO TX Warm Packet Byte Count, internal warm flag byte drop count +* per port. +*/ +#define MC_CMD_STAT_ID_LL_CTPIO_WIN_WARM_BYTES 0x3 +/* enum: ETH_TX valid & ready. */ +#define MC_CMD_STAT_ID_LL_ETH_TX_ACTIVE 0x4 +/* enum: ETH_TX !ready. */ +#define MC_CMD_STAT_ID_LL_ETH_TX_PAUSE 0x5 +/* enum: ETH_TX valid & ready & last. */ +#define MC_CMD_STAT_ID_LL_ETH_TX_PKTS 0x6 +/* enum: ETH_TX valid & ready & last, count bytes. */ +#define MC_CMD_STAT_ID_LL_ETH_TX_BYTES 0x7 +/* enum: ETH_TX valid & ready & last & bad. */ +#define MC_CMD_STAT_ID_LL_ETH_TX_CTUR_PKTS 0x8 +/* enum: ETH_TX valid & ready & last & bad, count bytes. */ +#define MC_CMD_STAT_ID_LL_ETH_TX_CTUR_BYTES 0x9 +/* enum: ETH_RX_RSP valid. */ +#define MC_CMD_STAT_ID_LL_ETH_TX_RSP 0xa +/* enum: TX Events Coalesed. */ +#define MC_CMD_STAT_ID_LL_INI_REQ_TXEV_COAL 0xb +/* enum: biu_ini_dma_req & biu_ini_grant & txev data for the port. */ +#define MC_CMD_STAT_ID_LL_INI_REQ_TXEV_PKTS 0xc +/* enum: biu_ini_dma_req & biu_ini_grant & txev data for the port, increment by +* biu_ini_len. +*/ +#define MC_CMD_STAT_ID_LL_INI_REQ_TXEV_BYTES 0xd +/* enum: ETH_RX valid & ready. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_ACTIVE 0xe +/* enum: ETH_RX !ready. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_PAUSE 0xf +/* enum: ETH_RX valid & ready & last. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_PKTS 0x10 +/* enum: ETH_RX valid & ready & last & bad. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_BAD_PKTS 0x11 +/* enum: ETH_RX valid & ready & last, count bytes. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_BYTES 0x12 +/* enum: ETH_RX packets dropped because RX for port traffic not enabled. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_EN_DROPPED_PKTS 0x13 +/* enum: ETH_RX bytes dropped because RX for port traffic not enabled. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_EN_DROPPED_BYTES 0x14 +/* enum: ETH_RX packets dropped because RX Buffer full. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_FULL_DROPPED_PKTS 0x15 +/* enum: ETH_RX bytes dropped because RX Buffer full. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_FULL_DROPPED_BYTES 0x16 +/* enum: ETH_RX packets dropped because RX Queue not enabled. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_QEN_DROPPED_PKTS 0x17 +/* enum: ETH_RX bytes dropped because RX Queue not enabled. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_QEN_DROPPED_BYTES 0x18 +/* enum: ETH_RX packets dropped because RX Queue descriptor not available. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_NODSC_DROPPED_PKTS 0x19 +/* enum: ETH_RX bytes dropped because RX Queue descriptor not available. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_NODSC_DROPPED_BYTES 0x1a +/* enum: biu_ini_dma_req & biu_ini_grant & rxpkt data for the port. */ +#define MC_CMD_STAT_ID_LL_INI_REQ_RXPKT_PKTS 0x1b +/* enum: biu_ini_dma_req & biu_ini_grant & rxpkt data for the port, increment +* by biu_ini_len. +*/ +#define MC_CMD_STAT_ID_LL_INI_REQ_RXPKT_BYTES 0x1c +/* enum: biu_ini_dma_req & biu_ini_grant & rxmeta data for the port. */ +#define MC_CMD_STAT_ID_LL_INI_REQ_RXMETA 0x1d +/* enum: RX Events Coalesed. */ +#define MC_CMD_STAT_ID_LL_INI_REQ_RXEV_COAL 0x1e +/* enum: biu_ini_dma_req & biu_ini_grant & rxev data for the port. */ +#define MC_CMD_STAT_ID_LL_INI_REQ_RXEV_PKTS 0x1f +/* enum: biu_ini_dma_req & biu_ini_grant & rxev data for the port, increment by +* biu_ini_len. +*/ +#define MC_CMD_STAT_ID_LL_INI_REQ_RXEV_BYTES 0x20 +/* enum: ETH_RX bytes dropped because packet was truncated by LL. */ +#define MC_CMD_STAT_ID_LL_ETH_RX_TRUNC_DROPPED_BYTES 0x21 +/* enum: CTPIO TX Drain Packet Count, internal drain drop count per port, TX +* packet is dropped. +*/ +#define MC_CMD_STAT_ID_LL_CTPIO_WIN_DRAIN_PKTS 0x22 +/* enum: CTPIO TX Drain Packet Byte Count, internal drain byte drop count per +* port, TX packet is dropped. +*/ +#define MC_CMD_STAT_ID_LL_CTPIO_WIN_DRAIN_BYTES 0x23 +/* enum: cycle count when backpressure high from EV Send block to TX. */ +#define MC_CMD_STAT_ID_LL_TX_EV_BACKPRESSURE 0x24 +/* enum: cycle count when backpressure high from EV Send block to RX. */ +#define MC_CMD_STAT_ID_LL_RX_EV_BACKPRESSURE 0x25 +#define MC_CMD_STAT_ID_LL_STAT_ID_LBN 16 +#define MC_CMD_STAT_ID_LL_STAT_ID_WIDTH 16 +/* Fast Classifier stats */ +#define MC_CMD_STAT_ID_FC_STAT_ID_OFST 2 +#define MC_CMD_STAT_ID_FC_STAT_ID_LEN 2 +/* enum property: index */ +/* enum: Number of detected ECC errors in the fast classifier result memory. +* This is a global stat and will only be reported for port 0. +*/ +#define MC_CMD_STAT_ID_FC_ECC_ERRORS 0x1 +/* enum: A non-zero number here indicates that an unknown number of additional +* single-bit errors have occurred in addition to those reported under +* FC_ECC_ERRORS. This is a global stat and will only be reported for port 0. +*/ +#define MC_CMD_STAT_ID_FC_ECC_OVERFLOW 0x2 +/* enum: Number of corrected errors in the fast classifier TCAM lookup data, +* i.e. filter key/mask. This is a global stat and will only be reported for +* port 0. +*/ +#define MC_CMD_STAT_ID_FC_TCAM_ERRORS 0x3 +#define MC_CMD_STAT_ID_FC_STAT_ID_LBN 16 +#define MC_CMD_STAT_ID_FC_STAT_ID_WIDTH 16 +/* Vadapter stats for SR-IOV */ +#define MC_CMD_STAT_ID_VADAPTER_STAT_ID_OFST 2 +#define MC_CMD_STAT_ID_VADAPTER_STAT_ID_LEN 2 +/* enum property: index */ +/* enum: Unicast packets received for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_RX_UNICAST_PACKETS 0x1 +/* enum: Unicast bytes received for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_RX_UNICAST_BYTES 0x2 +/* enum: Multicast packets received for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_RX_MULTICAST_PACKETS 0x3 +/* enum: Multicast bytes received for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_RX_MULTICAST_BYTES 0x4 +/* enum: Broadcast packets received for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_RX_BROADCAST_PACKETS 0x5 +/* enum: Broadcast bytes received for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_RX_BROADCAST_BYTES 0x6 +/* enum: Total number of packets received with bad CRC for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_RX_BAD_PACKETS 0x7 +/* enum: Total number of bytes received with bad CRC for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_RX_BAD_BYTES 0x8 +/* enum: Packets received with overflow for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_RX_OVERFLOW 0x9 +/* enum: Unicast packets transmitted for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_TX_UNICAST_PACKETS 0xa +/* enum: Unicast bytes transmitted for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_TX_UNICAST_BYTES 0xb +/* enum: Multicast packets transmitted for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_TX_MULTICAST_PACKETS 0xc +/* enum: Multicast bytes transmitted for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_TX_MULTICAST_BYTES 0xd +/* enum: Broadcast packets transmitted for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_TX_BROADCAST_PACKETS 0xe +/* enum: Broadcast bytes transmitted for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_TX_BROADCAST_BYTES 0xf +/* enum: Packets transmitted with bad FCS for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_TX_BAD_PACKETS 0x10 +/* enum: Bytes transmitted with bad FCS for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_TX_BAD_BYTES 0x11 +/* enum: Packets transmitted with overflow for vadapter. */ +#define MC_CMD_STAT_ID_VADAPTER_TX_OVERFLOW 0x12 +#define MC_CMD_STAT_ID_VADAPTER_STAT_ID_LBN 16 +#define MC_CMD_STAT_ID_VADAPTER_STAT_ID_WIDTH 16/* MC_CMD_STAT_DESC structuredef: Structure describing the layout and size of * the stats DMA buffer descriptor.
@@ -12796,6 +13009,26 @@#define MC_CMD_STAT_DESC_STAT_ID_PHY_STAT_ID_LEN 2#define MC_CMD_STAT_DESC_STAT_ID_PHY_STAT_ID_LBN 16#define MC_CMD_STAT_DESC_STAT_ID_PHY_STAT_ID_WIDTH 16 +#define MC_CMD_STAT_DESC_STAT_ID_PM_STAT_ID_OFST 2 +#define MC_CMD_STAT_DESC_STAT_ID_PM_STAT_ID_LEN 2 +#define MC_CMD_STAT_DESC_STAT_ID_PM_STAT_ID_LBN 16 +#define MC_CMD_STAT_DESC_STAT_ID_PM_STAT_ID_WIDTH 16 +#define MC_CMD_STAT_DESC_STAT_ID_RXDP_STAT_ID_OFST 2 +#define MC_CMD_STAT_DESC_STAT_ID_RXDP_STAT_ID_LEN 2 +#define MC_CMD_STAT_DESC_STAT_ID_RXDP_STAT_ID_LBN 16 +#define MC_CMD_STAT_DESC_STAT_ID_RXDP_STAT_ID_WIDTH 16 +#define MC_CMD_STAT_DESC_STAT_ID_LL_STAT_ID_OFST 2 +#define MC_CMD_STAT_DESC_STAT_ID_LL_STAT_ID_LEN 2 +#define MC_CMD_STAT_DESC_STAT_ID_LL_STAT_ID_LBN 16 +#define MC_CMD_STAT_DESC_STAT_ID_LL_STAT_ID_WIDTH 16 +#define MC_CMD_STAT_DESC_STAT_ID_FC_STAT_ID_OFST 2 +#define MC_CMD_STAT_DESC_STAT_ID_FC_STAT_ID_LEN 2 +#define MC_CMD_STAT_DESC_STAT_ID_FC_STAT_ID_LBN 16 +#define MC_CMD_STAT_DESC_STAT_ID_FC_STAT_ID_WIDTH 16 +#define MC_CMD_STAT_DESC_STAT_ID_VADAPTER_STAT_ID_OFST 2 +#define MC_CMD_STAT_DESC_STAT_ID_VADAPTER_STAT_ID_LEN 2 +#define MC_CMD_STAT_DESC_STAT_ID_VADAPTER_STAT_ID_LBN 16 +#define MC_CMD_STAT_DESC_STAT_ID_VADAPTER_STAT_ID_WIDTH 16/* Index of the statistic in the DMA buffer. */ #define MC_CMD_STAT_DESC_STAT_INDEX_OFST 4#define MC_CMD_STAT_DESC_STAT_INDEX_LEN 2
@@ -13247,7 +13480,11 @@/* MC_CMD_GET_FIXED_PORT_PROPERTIES_OUT msgresponse */ #define MC_CMD_GET_FIXED_PORT_PROPERTIES_OUT_LEN 36 -/* Supported capabilities of the port in its current configuration. */ +/* Supported capabilities of the port in its current configuration. NOTE: The +* FEC_REQ field is to be ignored for FIXED_PORT_PROPERTIES, as it is a +* property that depends on the link configuration. The FEC_MASK field should +* be used to query for the fixed FEC modes supported by a port. +*/ #define MC_CMD_GET_FIXED_PORT_PROPERTIES_OUT_ABILITIES_OFST 0#define MC_CMD_GET_FIXED_PORT_PROPERTIES_OUT_ABILITIES_LEN 25/* See structuredef: MC_CMD_ETH_AN_FIELDS */
@@ -13288,7 +13525,11 @@/* MC_CMD_GET_FIXED_PORT_PROPERTIES_OUT_V2 msgresponse */ #define MC_CMD_GET_FIXED_PORT_PROPERTIES_OUT_V2_LEN 48 -/* Supported capabilities of the port in its current configuration. */ +/* Supported capabilities of the port in its current configuration. NOTE: The +* FEC_REQ field is to be ignored for FIXED_PORT_PROPERTIES, as it is a +* property that depends on the link configuration. The FEC_MASK field should +* be used to query for the fixed FEC modes supported by a port. +*/ #define MC_CMD_GET_FIXED_PORT_PROPERTIES_OUT_V2_ABILITIES_OFST 0#define MC_CMD_GET_FIXED_PORT_PROPERTIES_OUT_V2_ABILITIES_LEN 25/* Number of lanes supported by the port in its current configuration. */
@@ -14253,6 +14494,64 @@#define MC_CMD_GET_NETPORT_STATISTICS_IN_DMA_LEN_OFST 16#define MC_CMD_GET_NETPORT_STATISTICS_IN_DMA_LEN_LEN 4 +/* MC_CMD_GET_NETPORT_STATISTICS_V2_IN msgrequest */ +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_LEN 24 +/* Handle of port to get MAC statistics for. */ +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PORT_HANDLE_OFST 0 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PORT_HANDLE_LEN 4 +/* Contains options for querying the MAC statistics. */ +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_CMD_OFST 4 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_CMD_LEN 4 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_OFST 4 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_LBN 0 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_WIDTH 1 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_CLEAR_OFST 4 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_CLEAR_LBN 1 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_CLEAR_WIDTH 1 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PERIODIC_CHANGE_OFST 4 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PERIODIC_CHANGE_LBN 2 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PERIODIC_CHANGE_WIDTH 1 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PERIODIC_ENABLE_OFST 4 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PERIODIC_ENABLE_LBN 3 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PERIODIC_ENABLE_WIDTH 1 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PERIODIC_NOEVENT_OFST 4 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PERIODIC_NOEVENT_LBN 4 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PERIODIC_NOEVENT_WIDTH 1 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PERIOD_MS_OFST 4 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PERIOD_MS_LBN 15 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PERIOD_MS_WIDTH 17 +/* Specifies the physical address of the DMA buffer to use for statistics +* transfer. This field must contain a valid address under either of these +* conditions: 1. DMA flag is set (immediate DMA requested) 2. Both +* PERIODIC_CHANGE and PERIODIC_ENABLE are set (periodic DMA configured) +*/ +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_ADDR_OFST 8 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_ADDR_LEN 8 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_ADDR_LO_OFST 8 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_ADDR_LO_LEN 4 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_ADDR_LO_LBN 64 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_ADDR_LO_WIDTH 32 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_ADDR_HI_OFST 12 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_ADDR_HI_LEN 4 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_ADDR_HI_LBN 96 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_ADDR_HI_WIDTH 32 +/* Specifies the length of the DMA buffer in bytes for statistics transfer. The +* buffer size must be at least DMA_BUFFER_SIZE bytes (as returned by +* MC_CMD_MAC_STATISTICS_DESCRIPTOR). Providing an insufficient buffer size +* will result in an EINVAL error. This field must contain a valid length under +* either of these conditions: 1. DMA flag is set (immediate DMA requested) 2. +* Both PERIODIC_CHANGE and PERIODIC_ENABLE are set (periodic DMA configured) +*/ +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_LEN_OFST 16 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_DMA_LEN_LEN 4 +/* Port ID mapping to an EVB port, used for reporting vadapter stats. If this +* value is not provided or invalid, and vadapter stats are supported by the +* NIC then the vadapter values will be reported as 0s to maintain a consistent +* statistics descriptor layout. +*/ +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PORT_ID_OFST 20 +#define MC_CMD_GET_NETPORT_STATISTICS_V2_IN_PORT_ID_LEN 4 +/* MC_CMD_GET_NETPORT_STATISTICS_OUT msgresponse */ #define MC_CMD_GET_NETPORT_STATISTICS_OUT_LENMIN 0#define MC_CMD_GET_NETPORT_STATISTICS_OUT_LENMAX 248
Signature · 1 line
2.47.3
Re: [PATCH v3 1/3] common/sfc_efx/base: update MCDI headers
Quoted 6 lines · On Fri, 14 Aug 2026 16:56:06 +0400 Ivan Malov <[email protected]> wrote:
Selectively import MCDI changes from the in-house libefx repository to meet the needs of the feature support patches that will follow.
Signed-off-by Ivan Malov <[email protected]>Reviewed-by Viacheslav Galaktionov <[email protected]>---
A couple of checkpatch warnings on this patch. Although merged to next-net, would still be good to fix.
### [PATCH] common/sfc_efx/base: update MCDI headers
WARNING:TYPO_SPELLING: 'Coalesed' may be misspelled - perhaps 'Coalesced'? #155: FILE: drivers/common/sfc_efx/base/efx_regs_mcdi.h:12857:
+/* enum: TX Events Coalesed. */
^^^^^^^^
WARNING:TYPO_SPELLING: 'Coalesed' may be misspelled - perhaps 'Coalesced'? #197: FILE: drivers/common/sfc_efx/base/efx_regs_mcdi.h:12899:
+/* enum: RX Events Coalesed. */
^^^^^^^^
total: 0 errors, 2 warnings, 378 lines checked
### [PATCH] common/sfc_efx/base: indicate dummy netport properties on VF
WARNING:SPACING: space prohibited between function name and open parenthesis '(' #41: FILE: drivers/common/sfc_efx/base/efx_np.c:261:
+ sizeof (*loopback_cap_maskp));
total: 0 errors, 1 warnings, 65 lines checked
PATCH v3 2/3 common/sfc_efx/base: add support for VADAPTER statistics IDs
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Add netport VADAPTER statistics IDs for use with VFs.
--- drivers/common/sfc_efx/base/efx_np.c | 45 ++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+)
drivers/common/sfc_efx/base/efx_np.c +45 -0
@@ -704,6 +704,51 @@ static const efx_np_stat_t efx_np_mac_stat_map[] = {#undef EFX_NP_STAT_MAC +#define EFX_NP_STAT_VADAPTER (_hw, _sw) \ + [EFX_MAC_##_sw] = { \ + .ens_hw_id = EFX_NP_HW_STAT_ID(VADAPTER, _hw), \ + .ens_valid = B_TRUE, \ + } + +EFX_NP_STAT_VADAPTER (VADAPTER_RX_UNICAST_PACKETS , +VADAPTER_RX_UNICAST_PACKETS ), +EFX_NP_STAT_VADAPTER (VADAPTER_RX_UNICAST_BYTES , +VADAPTER_RX_UNICAST_BYTES ), +EFX_NP_STAT_VADAPTER (VADAPTER_RX_MULTICAST_PACKETS , +VADAPTER_RX_MULTICAST_PACKETS ), +EFX_NP_STAT_VADAPTER (VADAPTER_RX_MULTICAST_BYTES , +VADAPTER_RX_MULTICAST_BYTES ), +EFX_NP_STAT_VADAPTER (VADAPTER_RX_BROADCAST_PACKETS , +VADAPTER_RX_BROADCAST_PACKETS ), +EFX_NP_STAT_VADAPTER (VADAPTER_RX_BROADCAST_BYTES , +VADAPTER_RX_BROADCAST_BYTES ), +EFX_NP_STAT_VADAPTER (VADAPTER_RX_BAD_PACKETS , +VADAPTER_RX_BAD_PACKETS ), +EFX_NP_STAT_VADAPTER (VADAPTER_RX_BAD_BYTES , +VADAPTER_RX_BAD_BYTES ), +EFX_NP_STAT_VADAPTER (VADAPTER_RX_OVERFLOW , +VADAPTER_RX_OVERFLOW ), +EFX_NP_STAT_VADAPTER (VADAPTER_TX_UNICAST_PACKETS , +VADAPTER_TX_UNICAST_PACKETS ), +EFX_NP_STAT_VADAPTER (VADAPTER_TX_UNICAST_BYTES , +VADAPTER_TX_UNICAST_BYTES ), +EFX_NP_STAT_VADAPTER (VADAPTER_TX_MULTICAST_PACKETS , +VADAPTER_TX_MULTICAST_PACKETS ), +EFX_NP_STAT_VADAPTER (VADAPTER_TX_MULTICAST_BYTES , +VADAPTER_TX_MULTICAST_BYTES ), +EFX_NP_STAT_VADAPTER (VADAPTER_TX_BROADCAST_PACKETS , +VADAPTER_TX_BROADCAST_PACKETS ), +EFX_NP_STAT_VADAPTER (VADAPTER_TX_BROADCAST_BYTES , +VADAPTER_TX_BROADCAST_BYTES ), +EFX_NP_STAT_VADAPTER (VADAPTER_TX_BAD_PACKETS , +VADAPTER_TX_BAD_PACKETS ), +EFX_NP_STAT_VADAPTER (VADAPTER_TX_BAD_BYTES , +VADAPTER_TX_BAD_BYTES ), +EFX_NP_STAT_VADAPTER (VADAPTER_TX_OVERFLOW , +VADAPTER_TX_OVERFLOW ), + +#undef EFX_NP_STAT_VADAPTER + #define EFX_NP_STAT_PHY(_hw, _sw) \ [EFX_MAC_##_sw] = { \ .ens_hw_id = EFX_NP_HW_STAT_ID(PHY, _hw), \
Signature · 1 line
2.47.3
PATCH v3 3/3 common/sfc_efx/base: switch netport stats to use EVB port ID
In reply to Ivan MalovFrom: Andy Moreton <[email protected]>
Support for VADAPTER stats requires passing the EVB port handle. Use GET_NETPORT_STATISTICS_V2 to do that.
GET_NETPORT_STATISTICS_V2 is guaranteed present in all firmware builds that advertise netport support, as already assumed by efx_np_mac_ctrl() with MAC_CTRL_IN_V2.
Also for clarity adjust the argument order for efx_np_mac_stats to match the legacy efx_mcdi_mac_stats.
--- drivers/common/sfc_efx/base/efx_impl.h | 3 ++- drivers/common/sfc_efx/base/efx_mcdi.c | 2 +- drivers/common/sfc_efx/base/efx_np.c | 15 ++++++++++++--- drivers/common/sfc_efx/base/medford4_mac.c | 12 +++++++----- 4 files changed, 22 insertions(+), 10 deletions(-)
drivers/common/sfc_efx/base/efx_impl.h +2 -1
@@ -1988,8 +1988,9 @@ extern __checkReturn efx_rc_tefx_np_mac_stats ( __in efx_nic_t *enp, __in efx_np_handle_t nph, - __in efx_stats_action_t action, + __in uint32_t vport_id, __in_opt const efsys_mem_t *esmp, + __in efx_stats_action_t action, __in uint16_t period_ms);#endif /* EFSYS_OPT_MAC_STATS */
drivers/common/sfc_efx/base/efx_mcdi.c +1 -1
@@ -2250,7 +2250,7 @@ efx_mcdi_mac_stats_clear(if (efx_np_supported (enp) !=B_FALSE ) { rc =efx_np_mac_stats (enp, epp->ep_np_handle, -EFX_STATS_CLEAR ,NULL ,0 ); + enp->en_vport_id,NULL ,EFX_STATS_CLEAR ,0 ); }else { rc =efx_mcdi_mac_stats (enp, enp->en_vport_id,NULL ,EFX_STATS_CLEAR ,0 );
drivers/common/sfc_efx/base/efx_np.c +12 -3
@@ -1614,12 +1614,13 @@ efx_np_mac_ctrl(efx_np_mac_stats ( __in efx_nic_t *enp, __in efx_np_handle_t nph, - __in efx_stats_action_t action, + __in uint32_t vport_id, __in_opt const efsys_mem_t *esmp, + __in efx_stats_action_t action, __in uint16_t period_ms) {EFX_MCDI_DECLARE_BUF (payload, - MC_CMD_GET_NETPORT_STATISTICS_IN_LEN, + MC_CMD_GET_NETPORT_STATISTICS_V2_IN_LEN, MC_CMD_GET_NETPORT_STATISTICS_OUT_LENMIN);boolean_t enable = (action ==EFX_STATS_ENABLE_NOEVENTS );boolean_t events = (action ==EFX_STATS_ENABLE_EVENTS );
@@ -1630,7 +1631,7 @@ efx_np_mac_stats(efx_rc_t rc; req.emr_out_length =MC_CMD_GET_NETPORT_STATISTICS_OUT_LENMIN ; - req.emr_in_length =MC_CMD_GET_NETPORT_STATISTICS_IN_LEN ; + req.emr_in_length =MC_CMD_GET_NETPORT_STATISTICS_V2_IN_LEN ; req.emr_cmd =MC_CMD_GET_NETPORT_STATISTICS ; req.emr_out_buf = payload; req.emr_in_buf = payload;
@@ -1672,6 +1673,14 @@ efx_np_mac_stats(MCDI_IN_SET_DWORD (req,GET_NETPORT_STATISTICS_IN_DMA_LEN , sz); } +/* +* NOTE: Do not use EVB_PORT_ID_ASSIGNED when disabling periodic stats, +* as this may fail (and leave periodic DMA enabled) if the +* vadapter has already been deleted. +*/ +MCDI_IN_SET_DWORD (req,GET_NETPORT_STATISTICS_V2_IN_PORT_ID , + (disable ?EVB_PORT_ID_NULL : vport_id)); +efx_mcdi_execute (enp, &req);if (req.emr_rc !=0 ) {
drivers/common/sfc_efx/base/medford4_mac.c +7 -5
@@ -172,8 +172,8 @@ medford4_mac_stats_upload(efx_port_t *epp = &(enp->en_port);efx_rc_t rc; - rc =efx_np_mac_stats (enp, - epp->ep_np_handle,EFX_STATS_UPLOAD , esmp,0 ); + rc =efx_np_mac_stats (enp, epp->ep_np_handle, enp->en_vport_id, + esmp,EFX_STATS_UPLOAD ,0 );if (rc !=0 ) goto fail1;
@@ -196,13 +196,15 @@ medford4_mac_stats_periodic(if (period_ms ==0 ) { rc =efx_np_mac_stats (enp, epp->ep_np_handle, -EFX_STATS_DISABLE ,NULL ,0 ); + enp->en_vport_id,NULL ,EFX_STATS_DISABLE ,0 ); }else if (events !=B_FALSE ) { rc =efx_np_mac_stats (enp, epp->ep_np_handle, -EFX_STATS_ENABLE_EVENTS , esmp, period_ms); + enp->en_vport_id, esmp,EFX_STATS_ENABLE_EVENTS , + period_ms); }else { rc =efx_np_mac_stats (enp, epp->ep_np_handle, -EFX_STATS_ENABLE_NOEVENTS , esmp, period_ms); + enp->en_vport_id, esmp,EFX_STATS_ENABLE_NOEVENTS , + period_ms); }if (rc !=0 )
Signature · 1 line
2.47.3
v3 cover common/sfc_efx/base: add Medford4 VF support
In reply to Ivan MalovThis series enables DPDK to use the sfc driver
on a Medford4 VF alongside the PF.
The first patch wires EVB switch operations into the Medford4 libefx implementation, allowing the PF to manage VFs.
Starting with MCFW 1.4.0.8, VFs may use the netport MCDI for basic port configuration, though several operations remain restricted. The remaining four patches address each restriction: dummy fixed port properties, suppressed event subscription, denied FCS and flow control, and ENOTSUP for periodic MAC stats DMA.
This series depends on the VADAPTER statistics series.
v3:
- addressed https://mails.dpdk.org/archives/dev/2026-August/343075.html
-- patch 6/6: dropped erroneous VADAPTER mention from
the commit message; added SR-IOV VF to sfc_efx.rst
v2:
- note for the future AI reviews: apply this on top of
the 'common/sfc_efx/base: add VADAPTER statistics for Medford4' series
- addressed https://mails.dpdk.org/archives/dev/2026-August/343075.html
-- fixed reporting of the factual link speed when running on VFs -- remaining notes do not seem to point at factual defects
Ivan Malov (6):
common/sfc_efx/base: let Medford4 PF manage VFs common/sfc_efx/base: indicate dummy netport properties on VF common/sfc_efx/base: skip netport event subscriptions on VFs common/sfc_efx/base: deny tuning FCS and flow control to VFs common/sfc_efx/base: deny periodic MAC stats delivery to VFs
doc: announce VF support of AMD Solarflare X45xx family NICs
doc/guides/nics/sfc_efx.rst | 2 + doc/guides/rel_notes/release_26_11.rst | 4 ++ drivers/common/sfc_efx/base/efx_evb.c | 6 ++ drivers/common/sfc_efx/base/efx_np.c | 90 ++++++++++++++++++++++---- 4 files changed, 90 insertions(+), 12 deletions(-)
Signature · 1 line
2.47.3
PATCH v3 1/6 common/sfc_efx/base: let Medford4 PF manage VFs
When the user binds the PF to 'vfio-pci', enables SR-IOV and instantiates a VF, looking to attach both the PF and the VF to DPDK, the DPDK driver has to instantiate the EVB switch on the PF. Wire the necessary methods into the Medford4 EVB implementation in libefx.
--- drivers/common/sfc_efx/base/efx_evb.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/common/sfc_efx/base/efx_evb.c +6 -0
@@ -107,6 +107,12 @@ efx_evb_init(break ;#endif /* EFSYS_OPT_RIVERHEAD */ +#if EFSYS_OPT_MEDFORD4 +case EFX_FAMILY_MEDFORD4 : + eeop = &__efx_evb_ef10_ops; +break ; +#endif /* EFSYS_OPT_MEDFORD4 */ +default :EFSYS_ASSERT (0 ); rc =ENOTSUP ;
Signature · 1 line
2.47.3
PATCH v3 2/6 common/sfc_efx/base: indicate dummy netport properties on VF
In reply to Ivan MalovStarting with MCFW version 1.4.0.8, Medford4 adapters support the use of the netport MCDI for port configuration by a VF; however, the MCDI which retrieves fixed port properties is not permitted for use by VFs.
Fill in dummy values sufficient for the DPDK driver to start on a VF.
--- drivers/common/sfc_efx/base/efx_np.c | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +22 -4
@@ -240,6 +240,7 @@ efx_np_get_fixed_port_props( __out_opt uint32_t *sup_cap_maskp, __out_opt efx_qword_t *loopback_cap_maskp) { + const efx_nic_cfg_t *encp = &enp->en_nic_cfg;EFX_MCDI_DECLARE_BUF (payload,MC_CMD_GET_FIXED_PORT_PROPERTIES_IN_LEN ,MC_CMD_GET_FIXED_PORT_PROPERTIES_OUT_V2_LEN );
@@ -247,6 +248,10 @@ efx_np_get_fixed_port_props(efx_mcdi_req_t req;efx_rc_t rc; +/* VFs do not allow access to the fixed port data. */ +if (EFX_PCI_FUNCTION_IS_VF (encp)) +return (0 ); + req.emr_out_length =MC_CMD_GET_FIXED_PORT_PROPERTIES_OUT_V2_LEN ; req.emr_in_length =MC_CMD_GET_FIXED_PORT_PROPERTIES_IN_LEN ; req.emr_cmd =MC_CMD_GET_FIXED_PORT_PROPERTIES ;
@@ -1058,10 +1063,6 @@ efx_np_attach(if (rc !=0 ) goto fail1; -/* -* FIXME: This may need revisiting for VFs, which -* don't necessarily have access to these details. -*/ rc =efx_np_get_fixed_port_props (enp, epp->ep_np_handle, epp->ep_np_cap_data_raw, &epp->ep_phy_cap_mask, &epp->ep_np_loopback_cap_mask);
@@ -1079,6 +1080,23 @@ efx_np_attach( epp->ep_phy_cap_mask |=1U <<EFX_PHY_CAP_AN ; } +/* +* On VFs, 'efx_np_get_fixed_port_props' does not report any link +* speeds; however, 'efx_np_link_state' should provide clues as +* to which link speed is de facto active on the VF. Use this +* clue to provide accurate information to the application. +* +* Also, indicate three basic capabilities that the VF cannot +* manage, but that can be safely assumed to be available. +*/ +if (EFX_PCI_FUNCTION_IS_VF (encp)) { + epp->ep_phy_cap_mask = epp->ep_adv_cap_mask; + + epp->ep_phy_cap_mask |=1U <<EFX_PHY_CAP_PAUSE ; + epp->ep_phy_cap_mask |=1U <<EFX_PHY_CAP_ASYM ; + epp->ep_phy_cap_mask |=1U <<EFX_PHY_CAP_AN ; + } +#if EFSYS_OPT_LOOPBACK efx_np_assign_loopback_props (enp);#endif /* EFSYS_OPT_LOOPBACK */
Signature · 1 line
2.47.3
PATCH v3 3/6 common/sfc_efx/base: skip netport event subscriptions on VFs
In reply to Ivan MalovSubscribing to netport events is not permitted on VFs.
--- drivers/common/sfc_efx/base/efx_np.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/common/sfc_efx/base/efx_np.c +5 -0
@@ -997,6 +997,7 @@ efx_np_set_event_mask( __in efx_np_handle_t nph, __in boolean_t want_linkchange_events) { + const efx_nic_cfg_t *encp = &enp->en_nic_cfg;EFX_MCDI_DECLARE_BUF (payload,MC_CMD_SET_NETPORT_EVENTS_MASK_IN_LEN ,MC_CMD_SET_NETPORT_EVENTS_MASK_OUT_LEN );
@@ -1004,6 +1005,10 @@ efx_np_set_event_mask(efx_dword_t dword;efx_rc_t rc; +/* VFs do not allow subscription to link change events. */ +if (EFX_PCI_FUNCTION_IS_VF (encp)) +return (0 ); + req.emr_out_length =MC_CMD_SET_NETPORT_EVENTS_MASK_OUT_LEN ; req.emr_in_length =MC_CMD_SET_NETPORT_EVENTS_MASK_IN_LEN ; req.emr_cmd =MC_CMD_SET_NETPORT_EVENTS_MASK ;
Signature · 1 line
2.47.3
PATCH v3 4/6 common/sfc_efx/base: deny tuning FCS and flow control to VFs
In reply to Ivan MalovMedford4 VFs can configure MAC settings via the netport MCDI, but controlling FCS stripping and setting flow control mode are off limits. Express all this in code to allow the DPDK driver to start and forbid changes to FCS and flow control.
For what it's worth, changing MTU is allowed on VFs, but the value must be less than or equal to the PF's MTU.
--- drivers/common/sfc_efx/base/efx_np.c | 41 +++++++++++++++++++++++----- 1 file changed, 34 insertions(+), 7 deletions(-)
drivers/common/sfc_efx/base/efx_np.c +34 -7
@@ -1558,6 +1558,7 @@ efx_np_mac_ctrl( __in efx_np_handle_t nph, __in const efx_np_mac_ctrl_t *mc) { + const efx_nic_cfg_t *encp = &enp->en_nic_cfg;EFX_MCDI_DECLARE_BUF (payload,MC_CMD_MAC_CTRL_IN_LEN ,MC_CMD_MAC_CTRL_OUT_LEN );
@@ -1581,9 +1582,19 @@ efx_np_mac_ctrl(if (mc->enmc_set_pdu_only !=B_FALSE ) goto skip_full_reconfigure; - cfg |=1U <<MC_CMD_MAC_CONFIG_OPTIONS_CFG_INCLUDE_FCS ; -if (mc->enmc_include_fcs !=B_FALSE ) - flags |=1U <<MC_CMD_MAC_FLAGS_FLAG_INCLUDE_FCS ; +/* Only PFs can control FCS stripping. */ +if (EFX_PCI_FUNCTION_IS_PF (encp)) { + cfg |=1U <<MC_CMD_MAC_CONFIG_OPTIONS_CFG_INCLUDE_FCS ; +if (mc->enmc_include_fcs !=B_FALSE ) + flags |=1U <<MC_CMD_MAC_FLAGS_FLAG_INCLUDE_FCS ; + }else if (mc->enmc_include_fcs !=B_FALSE ) { +/* +* Assume that FCS stripping being enabled is the driver's +* default expectation and deny disabling it to VFs. +*/ + rc =ENOTSUP ; + goto fail1; + }MCDI_IN_SET_DWORD (req,MAC_CTRL_IN_FLAGS , flags);
@@ -1605,12 +1616,22 @@ efx_np_mac_ctrl(break ;default : rc =EINVAL ; - goto fail1; + goto fail2; } } - cfg |=1U <<MC_CMD_MAC_CONFIG_OPTIONS_CFG_FCNTL ; -MCDI_IN_SET_DWORD (req,MAC_CTRL_IN_FCNTL , fcntl); +/* Only PFs can change flow control settings. */ +if (EFX_PCI_FUNCTION_IS_PF (encp)) { + cfg |=1U <<MC_CMD_MAC_CONFIG_OPTIONS_CFG_FCNTL ; +MCDI_IN_SET_DWORD (req,MAC_CTRL_IN_FCNTL , fcntl); + }else if (fcntl !=MC_CMD_FCNTL_AUTO ) { +/* +* Assume that flow control auto-negotiation is the driver's +* default expectation and deny any attempts to override it. +*/ + rc =ENOTSUP ; + goto fail3; + } skip_full_reconfigure:MCDI_IN_SET_DWORD (req,MAC_CTRL_IN_V2_CONTROL_FLAGS , cfg);
@@ -1619,11 +1640,17 @@ efx_np_mac_ctrl(if (req.emr_rc !=0 ) { rc = req.emr_rc; - goto fail2; + goto fail4; }return (0 ); +fail4: +EFSYS_PROBE (fail4); + +fail3: +EFSYS_PROBE (fail3); + fail2:EFSYS_PROBE (fail2);
Signature · 1 line
2.47.3
PATCH v3 5/6 common/sfc_efx/base: deny periodic MAC stats delivery to VFs
In reply to Ivan MalovCurrently, requesting periodic DMA results in an EACCES error being returned, but the DPDK driver expects ENOTSUP to handle the situation gracefully. Implement proper error indication.
--- drivers/common/sfc_efx/base/efx_np.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
drivers/common/sfc_efx/base/efx_np.c +17 -1
@@ -1734,16 +1734,32 @@ efx_np_mac_stats(efx_mcdi_execute (enp, &req);if (req.emr_rc !=0 ) { +const efx_nic_cfg_t *encp = &enp->en_nic_cfg; + +if (req.emr_rc ==EACCES && (enable | events) && +EFX_PCI_FUNCTION_IS_VF (encp)) { +/* +* VFs cannot request periodic DMAing of statistics. +* Indicate 'ENOTSUP' for the DPDK driver to handle +* this gracefully and stick with one-time uploads. +*/ + rc =ENOTSUP ; + goto fail3; + } +/* EF10: Expect ENOENT if no DMA queues are initialised */ if ((req.emr_rc !=ENOENT ) || (enp->en_rx_qcount + enp->en_tx_qcount !=0 )) { rc = req.emr_rc; - goto fail3; + goto fail4; } }return (0 ); +fail4: +EFSYS_PROBE (fail4); + fail3:EFSYS_PROBE (fail3);
Signature · 1 line
2.47.3
PATCH v3 6/6 doc: announce VF support of AMD Solarflare X45xx family NICs
In reply to Ivan MalovThe Solarflare PMD has been updated to let the user attach to the X4 VFs (created by the PF that is attached either to the DPDK application or to the Solarflare Linux net driver).
--- doc/guides/nics/sfc_efx.rst | 2 ++ doc/guides/rel_notes/release_26_11.rst | 4 ++++ 2 files changed, 6 insertions(+)
doc/guides/nics/sfc_efx.rst +2 -0
@@ -113,6 +113,8 @@ SFC EFX PMD has support for: - SR-IOV PF +- SR-IOV VF + - Port representors (see :ref: switch_representation) - VLAN stripping (if running firmware variant supports it)
doc/guides/rel_notes/release_26_11.rst +4 -0
@@ -55,6 +55,10 @@ New Features Also, make sure to start the actual text at the margin. ======================================================= +* **Updated Solarflare network driver.** + + * Added VF support on AMD Solarflare X45xx adapters. + Removed Items -------------
Signature · 1 line
2.47.3