bnxt patchset
cover bnxt patchset
Hi,
This patch set fixes some of the issues found during testing. Please apply.
Thanks
net/bnxt: fix log levels for non error conditions. net/bnxt: fix to avoid a segfault net/bnxt: fix vnic cleanup
net/bnxt: fix set link config
net/bnxt: reset VF stats during initialization net/bnxt: fix VLAN antispoof configuration code net/bnxt: check invalid l2_filter_id net/bnxt: fix to free a filter before reusing it
drivers/net/bnxt/bnxt.h | 7 +++ drivers/net/bnxt/bnxt_cpr.c | 2 +- drivers/net/bnxt/bnxt_hwrm.c | 76 ++++++++++++++++++++++- drivers/net/bnxt/bnxt_hwrm.h | 3 + drivers/net/bnxt/hsi_struct_def_dpdk.h | 81 +++++++++++++++++++++++- drivers/net/bnxt/rte_pmd_bnxt.c | 110 ++++++++++++++++++++++-----------
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH 1/8 net/bnxt: fix log levels for non error conditions.
1) handle_async_event is a DEBUG level log message.
2) Log "Unable to get default VNIC for VF %d" at INFO level.
--- drivers/net/bnxt/bnxt_cpr.c | 2 +- drivers/net/bnxt/rte_pmd_bnxt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +1 -1
@@ -58,7 +58,7 @@ void bnxt_handle_async_event(struct bnxt *bp,bnxt_link_update_op (bp->eth_dev,0 );break ;default : -RTE_LOG (ERR ,PMD ,"handle_async_event id = 0x%x\n" , event_id); +RTE_LOG (DEBUG ,PMD ,"handle_async_event id = 0x%x\n" , event_id);break ; } }
drivers/net/bnxt/rte_pmd_bnxt.c +1 -1
@@ -333,7 +333,7 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)* This simply indicates there's no driver * loaded. This is not an error. */ -RTE_LOG (ERR ,PMD , +RTE_LOG (INFO ,PMD ,"Unable to get default VNIC for VF %d\n" , vf); }else {
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH 2/8 net/bnxt: fix to avoid a segfault
In reply to Ajit KhapardeFix use of local variable to avoid segfault.
cnt was incorrectly tested and decremented in the loop that removes a VLAN from the table.
--- drivers/net/bnxt/rte_pmd_bnxt.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
drivers/net/bnxt/rte_pmd_bnxt.c +9 -8
@@ -500,6 +500,7 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan,continue ; } +/* cnt is one less than vlan_count */ cnt = bp->pf.vf_info[i].vlan_count++;/* * And finally, add to the
@@ -511,19 +512,19 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan, ve->vid =rte_cpu_to_be_16 (vlan); } }else { -for (j =0 ; cnt; j++) { +for (j =0 ; j < cnt; j++) {if (rte_be_to_cpu_16 ( - bp->pf.vf_info[i].vlan_table[j].vid) != - vlan) + bp->pf.vf_info[i].vlan_table[j].vid) != + vlan)continue ;memmove ( - &bp->pf.vf_info[i].vlan_table[j], - &bp->pf.vf_info[i].vlan_table[j +1 ], -getpagesize () - - ((j +1 ) * + &bp->pf.vf_info[i].vlan_table[j], + &bp->pf.vf_info[i].vlan_table[j +1 ], +getpagesize () - + ((j +1 ) *sizeof (struct bnxt_vlan_table_entry ))); j--; - cnt = bp->pf.vf_info[i].vlan_count--; + cnt = --bp->pf.vf_info[i].vlan_count; } } rte_pmd_bnxt_set_vf_vlan_anti_spoof(dev->data->port_id,
Signature · 1 line
2.10.1 (Apple Git-78)
Re: [PATCH 2/8] net/bnxt: fix to avoid a segfault
Quoted 29 lines · Ajit Khaparde
Fix use of local variable to avoid segfault.
cnt was incorrectly tested and decremented in the loop that removes a VLAN from the table.Fixes 36735a932ca7 ("support set VF QOS and MAC anti spoof")Signed-off-by Stephen Hurd <[email protected]>Signed-off-by Ajit Khaparde <[email protected]>--- drivers/net/bnxt/rte_pmd_bnxt.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)drivers/net/bnxt/rte_pmd_bnxt.c +1
-1@@ -500,6 +500,7 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan,continue ; } +/* cnt is one less than vlan_count */ cnt = bp->pf.vf_info[i].vlan_count++;/* * And finally, add to the @@ -511,19 +512,19 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan, ve->vid =rte_cpu_to_be_16 (vlan); } }else { -for (j =0 ; cnt; j++) {
drivers/net/bnxt/rte_pmd_bnxt.c int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan, · line 521
Quoted 10 lines
drivers/net/bnxt/rte_pmd_bnxt.c +3
-4+for (j =0 ; j < cnt; j++) {if (rte_be_to_cpu_16 ( - bp->pf.vf_info[i].vlan_table[j].vid) != - vlan) + bp->pf.vf_info[i].vlan_table[j].vid) != + vlan)continue ; memmove( - &bp->pf.vf_info[i].vlan_table[j], - &bp->pf.vf_info[i].vlan_table[j + 1],
I may be missing something but if &bp->pf.vf_info[i].vlan_table[j + 1].vid == vlan, this may be endless loop.
because each time vlan_table[j + 1] copied into vlan_table[j] and j--, in next iteration same thing will happen.
drivers/net/bnxt/rte_pmd_bnxt.c int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan, · line 522
Quoted 4 lines
drivers/net/bnxt/rte_pmd_bnxt.c +2
-2- getpagesize() - - ((j + 1) * + &bp->pf.vf_info[i].vlan_table[j], + &bp->pf.vf_info[i].vlan_table[j + 1],
I guess line realigned to fit into 80 characters limitation, one of the good thing with 80 chars limitation is it forces to reduce indention.
It is up to you, but if you do following, it can be possible to reduce the indention one level and it will be easier to fit into limit:
if.((vf_mask.&.1) == 0)
continue;
Quoted 10 lines
drivers/net/bnxt/rte_pmd_bnxt.c +3
-1+getpagesize () - + ((j +1 ) * sizeof(struct bnxt_vlan_table_entry))); j--; - cnt = bp->pf.vf_info[i].vlan_count--; + cnt = --bp->pf.vf_info[i].vlan_count; } } rte_pmd_bnxt_set_vf_vlan_anti_spoof(dev->data->port_id,
PATCH 3/8 net/bnxt: fix vnic cleanup
In reply to Ajit KhapardeCheck if the vnic_id and rss_rule is not invalid before passing it to the firmware to cleanup the VNIC. Log a message if the vnic_id is invalid.
--- drivers/net/bnxt/bnxt_hwrm.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +18 -1
@@ -980,6 +980,7 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)HWRM_CHECK_RESULT ; vnic->fw_vnic_id =rte_le_to_cpu_16 (resp->vnic_id); +RTE_LOG (DEBUG ,PMD ,"VNIC ID %x\n" , vnic->fw_vnic_id);return rc; }
@@ -1045,6 +1046,11 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic)uint32_t ctx_enable_flag =HWRM_VNIC_CFG_INPUT_ENABLES_RSS_RULE ;struct bnxt_plcmodes_cfg pmodes; +if (vnic->fw_vnic_id ==INVALID_HW_RING_ID ) { +RTE_LOG (DEBUG ,PMD ,"VNIC ID %x\n" , vnic->fw_vnic_id); +return rc; + } + rc =bnxt_hwrm_vnic_plcmodes_qcfg (bp, vnic, &pmodes);if (rc)return rc;
@@ -1103,6 +1109,10 @@ int bnxt_hwrm_vnic_qcfg(struct bnxt *bp, struct bnxt_vnic_info *vnic,struct hwrm_vnic_qcfg_input req = {.req_type =0 };struct hwrm_vnic_qcfg_output *resp = bp->hwrm_cmd_resp_addr; +if (vnic->fw_vnic_id ==INVALID_HW_RING_ID ) { +RTE_LOG (DEBUG ,PMD ,"VNIC QCFG ID %d\n" , vnic->fw_vnic_id); +return rc; + }HWRM_PREP (req,VNIC_QCFG ,-1 , resp); req.enables =
@@ -1149,6 +1159,7 @@ int bnxt_hwrm_vnic_ctx_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)HWRM_CHECK_RESULT ; vnic->rss_rule =rte_le_to_cpu_16 (resp->rss_cos_lb_ctx_id); +RTE_LOG (DEBUG ,PMD ,"VNIC RSS Rule %x\n" , vnic->rss_rule);return rc; }
@@ -1160,6 +1171,10 @@ int bnxt_hwrm_vnic_ctx_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)struct hwrm_vnic_rss_cos_lb_ctx_free_output *resp = bp->hwrm_cmd_resp_addr; +if (vnic->rss_rule ==0xffff ) { +RTE_LOG (DEBUG ,PMD ,"VNIC RSS Rule %x\n" , vnic->rss_rule); +return rc; + }HWRM_PREP (req,VNIC_RSS_COS_LB_CTX_FREE ,-1 , resp); req.rss_cos_lb_ctx_id =rte_cpu_to_le_16 (vnic->rss_rule);
@@ -1179,8 +1194,10 @@ int bnxt_hwrm_vnic_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)struct hwrm_vnic_free_input req = {.req_type =0 };struct hwrm_vnic_free_output *resp = bp->hwrm_cmd_resp_addr; -if (vnic->fw_vnic_id ==INVALID_HW_RING_ID ) +if (vnic->fw_vnic_id ==INVALID_HW_RING_ID ) { +RTE_LOG (DEBUG ,PMD ,"VNIC FREE ID %x\n" , vnic->fw_vnic_id);return rc; + }HWRM_PREP (req,VNIC_FREE ,-1 , resp);
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH 4/8 net/bnxt: fix set link config
In reply to Ajit Khaparderemove the unnecessary rte_delay in bnxt_set_hwrm_link_config
--- drivers/net/bnxt/bnxt_hwrm.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +0 -1
@@ -1971,7 +1971,6 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up) "Set link config failed with rc %d\n", rc); } -rte_delay_ms (BNXT_LINK_WAIT_INTERVAL ); error:return rc; }
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH 5/8 net/bnxt: reset VF stats during initialization
In reply to Ajit KhapardeThis patch resets the VF stats during initialization
PF/VF")
--- drivers/net/bnxt/bnxt_hwrm.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/bnxt/bnxt_hwrm.c +1 -0
@@ -2306,6 +2306,7 @@ int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs)reserve_resources_from_vf (bp, &req, i); bp->pf.active_vfs++; +bnxt_hwrm_func_clr_stats (bp, bp->pf.vf_info[i].fid); }/*
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH 6/8 net/bnxt: fix VLAN antispoof configuration code
In reply to Ajit KhapardeWe are wrongly using a Rx side HWRM command set_rx_mask to configure VLAN anti-spoof. This being a Tx side feature, this patch tries to fix it.
Since the HWRM command to do it ringt is available only in the newer firmware versions, the patch verifies the firmware version before attempting to send the HWRM command to the firmware.
--- drivers/net/bnxt/bnxt.h | 7 +++ drivers/net/bnxt/bnxt_hwrm.c | 49 ++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.h | 3 ++ drivers/net/bnxt/hsi_struct_def_dpdk.h | 81 ++++++++++++++++++++++++++++- drivers/net/bnxt/rte_pmd_bnxt.c | 93 +++++++++++++++++++++++----------- 5 files changed, 203 insertions(+), 30 deletions(-)
drivers/net/bnxt/bnxt.h +7 -0
@@ -97,9 +97,16 @@ struct bnxt_vlan_table_entry {uint16_t vid; } __attribute__((packed)); +struct bnxt_vlan_antispoof_table_entry { +uint16_t tpid; +uint16_t vid; +uint16_t mask; +} __attribute__((packed)); +struct bnxt_child_vf_info {void *req_buf;struct bnxt_vlan_table_entry *vlan_table; +struct bnxt_vlan_antispoof_table_entry *vlan_as_table; STAILQ_HEAD(, bnxt_filter_info) filter;uint32_t func_cfg_flags;uint32_t l2_rx_mask;
drivers/net/bnxt/bnxt_hwrm.c +49 -0
61 lines not on this page · raw message
drivers/net/bnxt/bnxt_hwrm.h +3 -0
@@ -48,6 +48,9 @@ int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,int bnxt_hwrm_cfa_l2_set_rx_mask (struct bnxt *bp,struct bnxt_vnic_info *vnic,uint16_t vlan_count,struct bnxt_vlan_table_entry *vlan_table); +int bnxt_hwrm_cfa_vlan_antispoof_cfg (struct bnxt *bp,uint16_t fid, +uint16_t vlan_count, +struct bnxt_vlan_antispoof_table_entry *vlan_table);int bnxt_hwrm_clear_filter (struct bnxt *bp,struct bnxt_filter_info *filter); int bnxt_hwrm_set_filter(struct bnxt *bp,
drivers/net/bnxt/hsi_struct_def_dpdk.h +80 -1
93 lines not on this page · raw message
drivers/net/bnxt/rte_pmd_bnxt.c +64 -29
145 lines not on this page · raw message
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH 7/8 net/bnxt: check invalid l2_filter_id
In reply to Ajit KhapardeAdd code to check for invalid filter_id in bnxt_hwrm_clear_filter
--- drivers/net/bnxt/bnxt_hwrm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +3 -0
@@ -327,6 +327,9 @@ int bnxt_hwrm_clear_filter(struct bnxt *bp,struct hwrm_cfa_l2_filter_free_input req = {.req_type =0 };struct hwrm_cfa_l2_filter_free_output *resp = bp->hwrm_cmd_resp_addr; +if (filter->fw_l2_filter_id ==UINT64_MAX ) +return 0 ; +HWRM_PREP (req,CFA_L2_FILTER_FREE ,-1 , resp); req.l2_filter_id =rte_cpu_to_le_64 (filter->fw_l2_filter_id);
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH 8/8 net/bnxt: fix to free a filter before reusing it
In reply to Ajit KhapardeThis patch sends the HWRM command to free a filter in the hardware, before using it again.
--- drivers/net/bnxt/bnxt_hwrm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +3 -0
@@ -352,6 +352,9 @@ int bnxt_hwrm_set_filter(struct bnxt *bp,struct hwrm_cfa_l2_filter_alloc_output *resp = bp->hwrm_cmd_resp_addr;uint32_t enables =0 ; +if (filter->fw_l2_filter_id !=UINT64_MAX ) +bnxt_hwrm_clear_filter (bp, filter); +HWRM_PREP (req,CFA_L2_FILTER_ALLOC ,-1 , resp); req.flags =rte_cpu_to_le_32 (filter->flags);
Signature · 1 line
2.10.1 (Apple Git-78)
Quoted 6 lines · Ajit Khaparde
Hi,
This patch set fixes some of the issues found during testing. Please apply.Thanks
Quoted 8 lines
net/bnxt: fix log levels for non error conditions. net/bnxt: fix to avoid a segfault net/bnxt: fix vnic cleanup
net/bnxt: fix set link config
net/bnxt: reset VF stats during initialization net/bnxt: fix VLAN antispoof configuration code net/bnxt: check invalidl2_filter_idnet/bnxt: fix to free a filter before reusing it
Getting following build errors, fyi:
.../drivers/net/bnxt/rte_pmd_bnxt.c:464:8: error: variable 'rc' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (bnxt_hwrm_cfa_l2_set_rx_mask(bp, &vnic,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../drivers/net/bnxt/rte_pmd_bnxt.c:471:9: note: uninitialized use
occurs here
return rc;
^~
.../drivers/net/bnxt/rte_pmd_bnxt.c:464:4: note: remove the 'if' if its
condition is always true
if (bnxt_hwrm_cfa_l2_set_rx_mask(bp, &vnic,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.../drivers/net/bnxt/rte_pmd_bnxt.c:462:7: error: variable 'rc' is used uninitialized whenever 'if' condition is false [-Werror,-Wsometimes-uninitialized]
if (bnxt_hwrm_vnic_qcfg(bp, &vnic,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.../drivers/net/bnxt/rte_pmd_bnxt.c:471:9: note: uninitialized use occurs here
return rc;
^~.../drivers/net/bnxt/rte_pmd_bnxt.c:462:3: note: remove the 'if' if its condition is always true
if (bnxt_hwrm_vnic_qcfg(bp, &vnic, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~.../drivers/net/bnxt/rte_pmd_bnxt.c:454:6: error: variable 'rc' is used uninitialized whenever 'if' condition is true [-Werror,-Wsometimes-uninitialized]
if (dflt_vnic < 0) {
^~~~~~~~~~~~~
.../drivers/net/bnxt/rte_pmd_bnxt.c:471:9: note: uninitialized use
occurs here
return rc;
^~
.../drivers/net/bnxt/rte_pmd_bnxt.c:454:2: note: remove the 'if' if its
condition is always false
if (dflt_vnic < 0) {
^~~~~~~~~~~~~~~~~~~~
.../drivers/net/bnxt/rte_pmd_bnxt.c:440:8: note: initialize the variable
'rc' to silence this warning
int rc;
^
= 03 errors generated.
v2 cover bnxt patchset
This patch set fixes some of the issues found during testing. Please apply.
v1->v2: incorporate review feedback
net/bnxt: fix log levels for non error conditions. net/bnxt: fix to avoid a segfault net/bnxt: fix vnic cleanup
net/bnxt: fix set link config
net/bnxt: reset VF stats during initialization net/bnxt: fix VLAN antispoof configuration code net/bnxt: check invalid l2_filter_id net/bnxt: fix to free a filter before reusing it
drivers/net/bnxt/bnxt.h | 7 ++ drivers/net/bnxt/bnxt_cpr.c | 2 +- drivers/net/bnxt/bnxt_hwrm.c | 76 +++++++++++- drivers/net/bnxt/bnxt_hwrm.h | 3 + drivers/net/bnxt/hsi_struct_def_dpdk.h | 81 ++++++++++++- drivers/net/bnxt/rte_pmd_bnxt.c | 178 ++++++++++++++++------------
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH v2 1/8 net/bnxt: fix log levels for non error conditions.
1) handle_async_event is a DEBUG level log message.
2) Log "Unable to get default VNIC for VF %d" at INFO level.
--- drivers/net/bnxt/bnxt_cpr.c | 2 +- drivers/net/bnxt/rte_pmd_bnxt.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/bnxt/bnxt_cpr.c +1 -1
@@ -58,7 +58,7 @@ void bnxt_handle_async_event(struct bnxt *bp,bnxt_link_update_op (bp->eth_dev,0 );break ;default : -RTE_LOG (ERR ,PMD ,"handle_async_event id = 0x%x\n" , event_id); +RTE_LOG (DEBUG ,PMD ,"handle_async_event id = 0x%x\n" , event_id);break ; } }
drivers/net/bnxt/rte_pmd_bnxt.c +1 -1
@@ -333,7 +333,7 @@ int rte_pmd_bnxt_set_vf_vlan_anti_spoof(uint8_t port, uint16_t vf, uint8_t on)* This simply indicates there's no driver * loaded. This is not an error. */ -RTE_LOG (ERR ,PMD , +RTE_LOG (INFO ,PMD ,"Unable to get default VNIC for VF %d\n" , vf); }else {
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH v2 2/8 net/bnxt: fix to avoid a segfault
In reply to Ajit KhapardeFix use of local variable to avoid segfault.
cnt was incorrectly tested and decremented in the loop that removes a VLAN from the table.
--v1->v2: incorporate review feedback.
--- drivers/net/bnxt/rte_pmd_bnxt.c | 101 +++++++++++++++++++--------------------- 1 file changed, 49 insertions(+), 52 deletions(-)
drivers/net/bnxt/rte_pmd_bnxt.c +49 -52
@@ -473,62 +473,59 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port, uint16_t vlan,for (i =0 ; vf_mask; i++, vf_mask >>=1 ) { cnt = bp->pf.vf_info[i].vlan_count; -if (vf_mask &1 ) { -if (bp->pf.vf_info[i].vlan_table ==NULL ) { - rc =-1 ; -continue ; +if ((vf_mask &1 ) ==0 ) +continue ; + +if (bp->pf.vf_info[i].vlan_table ==NULL ) { + rc =-1 ; +continue ; + } +if (vlan_on) { +/* First, search for a duplicate... */ +for (j =0 ; j < cnt; j++) { +if (rte_be_to_cpu_16 ( + bp->pf.vf_info[i].vlan_table[j].vid) == vlan) +break ; } -if (vlan_on) { -/* First, search for a duplicate... */ -for (j =0 ; j < cnt; j++) { -if (rte_be_to_cpu_16 ( - bp->pf.vf_info[i].vlan_table[j].vid) == - vlan) -break ; - } -if (j == cnt) { -/* Now check that there's space */ -if (cnt ==getpagesize () / -sizeof (struct bnxt_vlan_table_entry )) { -RTE_LOG (ERR ,PMD , -"VF %d VLAN table is full\n" , - i); -RTE_LOG (ERR ,PMD , -"cannot add VLAN %u\n" , - vlan); - rc =-1 ; -continue ; - } - - cnt = bp->pf.vf_info[i].vlan_count++; -/* -* And finally, add to the -* end of the table -*/ - ve = &bp->pf.vf_info[i].vlan_table[cnt]; -/* TODO: Hardcoded TPID */ - ve->tpid =rte_cpu_to_be_16 (0x8100 ); - ve->vid =rte_cpu_to_be_16 (vlan); - } - }else { -for (j =0 ; cnt; j++) { -if (rte_be_to_cpu_16 ( - bp->pf.vf_info[i].vlan_table[j].vid) != - vlan) -continue ; -memmove ( - &bp->pf.vf_info[i].vlan_table[j], - &bp->pf.vf_info[i].vlan_table[j +1 ], -getpagesize () - - ((j +1 ) * -sizeof (struct bnxt_vlan_table_entry ))); - j--; - cnt = bp->pf.vf_info[i].vlan_count--; +if (j == cnt) { +/* Now check that there's space */ +if (cnt ==getpagesize () / +sizeof (struct bnxt_vlan_table_entry )) { +RTE_LOG (ERR ,PMD , +"VF %d VLAN table is full\n" , + i); +RTE_LOG (ERR ,PMD , +"cannot add VLAN %u\n" , vlan); + rc =-1 ; +continue ; } + +/* cnt is one less than vlan_count */ + cnt = bp->pf.vf_info[i].vlan_count++; +/* +* And finally, add to the +* end of the table +*/ + ve = &bp->pf.vf_info[i].vlan_table[cnt]; +/* TODO: Hardcoded TPID */ + ve->tpid =rte_cpu_to_be_16 (0x8100 ); + ve->vid =rte_cpu_to_be_16 (vlan); + } + }else { +for (j =0 ; j < cnt; j++) { +if (rte_be_to_cpu_16 ( + bp->pf.vf_info[i].vlan_table[j].vid) != vlan) +continue ; +memmove (&bp->pf.vf_info[i].vlan_table[j], + &bp->pf.vf_info[i].vlan_table[j +1 ], +getpagesize () - ((j +1 ) * +sizeof (struct bnxt_vlan_table_entry ))); + j--; + cnt = --bp->pf.vf_info[i].vlan_count; } -rte_pmd_bnxt_set_vf_vlan_anti_spoof (dev->data->port_id, - i, bp->pf.vf_info[i].vlan_spoof_en); } +rte_pmd_bnxt_set_vf_vlan_anti_spoof (dev->data->port_id, i, + bp->pf.vf_info[i].vlan_spoof_en); }return rc;
Signature · 1 line
2.10.1 (Apple Git-78)
Re: [PATCH v2 2/8] net/bnxt: fix to avoid a segfault
So the only change was replacing a nesting level with a continue? Yeah, looks good.
Quoted 157 lines · Ajit Khaparde
Fix use of local variable to avoid segfault.
cnt was incorrectly tested and decremented in the loop that removes a VLAN from the table.Fixes 36735a932ca7 ("support set VF QOS and MAC anti spoof")Signed-off-by Stephen Hurd <[email protected]>Signed-off-by Ajit Khaparde <[email protected]>--
v1->v2: incorporate review feedback.--- drivers/net/bnxt/rte_pmd_bnxt.c | 101 +++++++++++++++++++----------- ---------- 1 file changed, 49 insertions(+), 52 deletions(-)drivers/net/bnxt/rte_pmd_ renamed from drivers/net/bnxt/rte_pmd_bnxt.c +0
-0
bnxt.c
index 0a8fb1e..ec5855d 100644drivers/net/bnxt/rte_pmd_bnxt.c +13
-9@@ -473,62 +473,59 @@ int rte_pmd_bnxt_set_vf_vlan_filter(uint8_t port,uint16_t vlan, for (i = 0; vf_mask; i++, vf_mask >>= 1) { cnt = bp->pf.vf_info[i].vlan_count; -if (vf_mask &1 ) { -if (bp->pf.vf_info[i].vlan_table ==NULL ) { - rc =-1 ; -continue ; +if ((vf_mask &1 ) ==0 ) +continue ; + +if (bp->pf.vf_info[i].vlan_table ==NULL ) { + rc =-1 ; +continue ; + } +if (vlan_on) { +/* First, search for a duplicate... */ +for (j =0 ; j < cnt; j++) { +if (rte_be_to_cpu_16 ( + bp->pf.vf_info[i].vlan_table[j].vid) == vlan) +break ; } -if (vlan_on) { -/* First, search for a duplicate... */ -for (j =0 ; j < cnt; j++) { -if (rte_be_to_cpu_16 ( - bp->pf.vf_info[i].vlan_table[j].vid)==
drivers/net/bnxt/rte_pmd_bnxt.c +0
-7- vlan) -break ; - } - if (j == cnt) { - /* Now check that there's space */ - if (cnt == getpagesize() / - sizeof(struct
bnxt_vlan_table_entry)) {drivers/net/bnxt/rte_pmd_bnxt.c +0
-2- RTE_LOG(ERR, PMD, - "VF %d VLAN table isfull\n",
drivers/net/bnxt/rte_pmd_bnxt.c +0
-3- i); - RTE_LOG(ERR, PMD, - "cannot add VLAN%u\n",
drivers/net/bnxt/rte_pmd_bnxt.c +0
-6- vlan); - rc =-1 ; -continue ; - } - - cnt =bp->pf.vf_info[i].vlan_count++;
drivers/net/bnxt/rte_pmd_bnxt.c +0
-5-/* -* And finally, add to the -* end of the table -*/ - ve = &bp->pf.vf_info[i].vlan_table[cnt];
drivers/net/bnxt/rte_pmd_bnxt.c +0
-2-/* TODO: Hardcoded TPID */ - ve->tpid =
rte_cpu_to_be_16(0x8100);drivers/net/bnxt/rte_pmd_bnxt.c +0
-6- ve->vid =rte_cpu_to_be_16 (vlan); - } - }else { -for (j =0 ; cnt; j++) { -if (rte_be_to_cpu_16 ( - bp->pf.vf_info[i].vlan_table[j].vid)!=
drivers/net/bnxt/rte_pmd_bnxt.c +1
-8- vlan) -continue ; -memmove ( - &bp->pf.vf_info[i].vlan_table[j], - &bp->pf.vf_info[i].vlan_table[j + 1], - getpagesize() - - ((j + 1) * - sizeof(struct
bnxt_vlan_table_entry)));drivers/net/bnxt/rte_pmd_bnxt.c +0
-2- j--; - cnt =bp->pf.vf_info[i].vlan_count--;
drivers/net/bnxt/rte_pmd_bnxt.c +6
-0+if (j == cnt) { +/* Now check that there's space */ +if (cnt ==getpagesize () / +sizeof (struct bnxt_vlan_table_entry )) { + RTE_LOG(ERR, PMD, + "VF %d VLAN table isfull\n",
drivers/net/bnxt/rte_pmd_bnxt.c +3
-0+ i); + RTE_LOG(ERR, PMD, + "cannot add VLAN %u\n",vlan);
drivers/net/bnxt/rte_pmd_bnxt.c +18
-0+ rc =-1 ; +continue ; } + +/* cnt is one less than vlan_count */ + cnt = bp->pf.vf_info[i].vlan_count++; +/* +* And finally, add to the +* end of the table +*/ + ve = &bp->pf.vf_info[i].vlan_table[cnt]; +/* TODO: Hardcoded TPID */ + ve->tpid =rte_cpu_to_be_16 (0x8100 ); + ve->vid =rte_cpu_to_be_16 (vlan); + } + }else { +for (j =0 ; j < cnt; j++) { +if (rte_be_to_cpu_16 ( + bp->pf.vf_info[i].vlan_table[j].vid)!= vlan)
drivers/net/bnxt/rte_pmd_bnxt.c +3
-0+continue ; +memmove (&bp->pf.vf_info[i].vlan_table[j], + &bp->pf.vf_info[i].vlan_table[j +1],
drivers/net/bnxt/rte_pmd_bnxt.c +2
-0+ getpagesize() - ((j + 1) * + sizeof(struct
bnxt_vlan_table_entry)));drivers/net/bnxt/rte_pmd_bnxt.c +2
-1+ j--; + cnt = --bp->pf.vf_info[i].vlan_count; } - rte_pmd_bnxt_set_vf_vlan_anti_spoof(dev->data->port_id,
- i, bp->pf.vf_info[i].vlan_spoof_en); }drivers/net/bnxt/rte_pmd_bnxt.c +2
-1+rte_pmd_bnxt_set_vf_vlan_anti_spoof (dev->data->port_id, i, + bp->pf.vf_info[i].vlan_spoof_en); }return rc; --2.10.1 (Apple Git-78)
Signature · 3 lines
Stephen Hurd 949-926-8039 [email protected]
PATCH v2 3/8 net/bnxt: fix vnic cleanup
In reply to Ajit KhapardeCheck if the vnic_id and rss_rule is not invalid before passing it to the firmware to cleanup the VNIC. Log a message if the vnic_id is invalid.
--- drivers/net/bnxt/bnxt_hwrm.c | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +18 -1
@@ -980,6 +980,7 @@ int bnxt_hwrm_vnic_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)HWRM_CHECK_RESULT ; vnic->fw_vnic_id =rte_le_to_cpu_16 (resp->vnic_id); +RTE_LOG (DEBUG ,PMD ,"VNIC ID %x\n" , vnic->fw_vnic_id);return rc; }
@@ -1045,6 +1046,11 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic)uint32_t ctx_enable_flag =HWRM_VNIC_CFG_INPUT_ENABLES_RSS_RULE ;struct bnxt_plcmodes_cfg pmodes; +if (vnic->fw_vnic_id ==INVALID_HW_RING_ID ) { +RTE_LOG (DEBUG ,PMD ,"VNIC ID %x\n" , vnic->fw_vnic_id); +return rc; + } + rc =bnxt_hwrm_vnic_plcmodes_qcfg (bp, vnic, &pmodes);if (rc)return rc;
@@ -1103,6 +1109,10 @@ int bnxt_hwrm_vnic_qcfg(struct bnxt *bp, struct bnxt_vnic_info *vnic,struct hwrm_vnic_qcfg_input req = {.req_type =0 };struct hwrm_vnic_qcfg_output *resp = bp->hwrm_cmd_resp_addr; +if (vnic->fw_vnic_id ==INVALID_HW_RING_ID ) { +RTE_LOG (DEBUG ,PMD ,"VNIC QCFG ID %d\n" , vnic->fw_vnic_id); +return rc; + }HWRM_PREP (req,VNIC_QCFG ,-1 , resp); req.enables =
@@ -1149,6 +1159,7 @@ int bnxt_hwrm_vnic_ctx_alloc(struct bnxt *bp, struct bnxt_vnic_info *vnic)HWRM_CHECK_RESULT ; vnic->rss_rule =rte_le_to_cpu_16 (resp->rss_cos_lb_ctx_id); +RTE_LOG (DEBUG ,PMD ,"VNIC RSS Rule %x\n" , vnic->rss_rule);return rc; }
@@ -1160,6 +1171,10 @@ int bnxt_hwrm_vnic_ctx_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)struct hwrm_vnic_rss_cos_lb_ctx_free_output *resp = bp->hwrm_cmd_resp_addr; +if (vnic->rss_rule ==0xffff ) { +RTE_LOG (DEBUG ,PMD ,"VNIC RSS Rule %x\n" , vnic->rss_rule); +return rc; + }HWRM_PREP (req,VNIC_RSS_COS_LB_CTX_FREE ,-1 , resp); req.rss_cos_lb_ctx_id =rte_cpu_to_le_16 (vnic->rss_rule);
@@ -1179,8 +1194,10 @@ int bnxt_hwrm_vnic_free(struct bnxt *bp, struct bnxt_vnic_info *vnic)struct hwrm_vnic_free_input req = {.req_type =0 };struct hwrm_vnic_free_output *resp = bp->hwrm_cmd_resp_addr; -if (vnic->fw_vnic_id ==INVALID_HW_RING_ID ) +if (vnic->fw_vnic_id ==INVALID_HW_RING_ID ) { +RTE_LOG (DEBUG ,PMD ,"VNIC FREE ID %x\n" , vnic->fw_vnic_id);return rc; + }HWRM_PREP (req,VNIC_FREE ,-1 , resp);
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH v2 4/8 net/bnxt: fix set link config
In reply to Ajit Khaparderemove the unnecessary rte_delay in bnxt_set_hwrm_link_config
--- drivers/net/bnxt/bnxt_hwrm.c | 1 - 1 file changed, 1 deletion(-)
drivers/net/bnxt/bnxt_hwrm.c +0 -1
@@ -1971,7 +1971,6 @@ int bnxt_set_hwrm_link_config(struct bnxt *bp, bool link_up) "Set link config failed with rc %d\n", rc); } -rte_delay_ms (BNXT_LINK_WAIT_INTERVAL ); error:return rc; }
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH v2 5/8 net/bnxt: reset VF stats during initialization
In reply to Ajit KhapardeThis patch resets the VF stats during initialization
PF/VF")
--- drivers/net/bnxt/bnxt_hwrm.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/bnxt/bnxt_hwrm.c +1 -0
@@ -2306,6 +2306,7 @@ int bnxt_hwrm_allocate_vfs(struct bnxt *bp, int num_vfs)reserve_resources_from_vf (bp, &req, i); bp->pf.active_vfs++; +bnxt_hwrm_func_clr_stats (bp, bp->pf.vf_info[i].fid); }/*
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH v2 6/8 net/bnxt: fix VLAN antispoof configuration code
In reply to Ajit KhapardeWe are wrongly using a Rx side HWRM command set_rx_mask to configure VLAN anti-spoof. This being a Tx side feature, this patch tries to fix it.
Since the HWRM command to do it ringt is available only in the newer firmware versions, the patch verifies the firmware version before attempting to send the HWRM command to the firmware.
--v1->v2: incorporate review feedback
--- drivers/net/bnxt/bnxt.h | 7 +++ drivers/net/bnxt/bnxt_hwrm.c | 49 ++++++++++++++++++ drivers/net/bnxt/bnxt_hwrm.h | 3 ++ drivers/net/bnxt/hsi_struct_def_dpdk.h | 81 +++++++++++++++++++++++++++++- drivers/net/bnxt/rte_pmd_bnxt.c | 91 +++++++++++++++++++++++----------- 5 files changed, 202 insertions(+), 29 deletions(-)
drivers/net/bnxt/bnxt.h +7 -0
@@ -97,9 +97,16 @@ struct bnxt_vlan_table_entry {uint16_t vid; } __attribute__((packed)); +struct bnxt_vlan_antispoof_table_entry { +uint16_t tpid; +uint16_t vid; +uint16_t mask; +} __attribute__((packed)); +struct bnxt_child_vf_info {void *req_buf;struct bnxt_vlan_table_entry *vlan_table; +struct bnxt_vlan_antispoof_table_entry *vlan_as_table; STAILQ_HEAD(, bnxt_filter_info) filter;uint32_t func_cfg_flags;uint32_t l2_rx_mask;
drivers/net/bnxt/bnxt_hwrm.c +49 -0
61 lines not on this page · raw message
drivers/net/bnxt/bnxt_hwrm.h +3 -0
@@ -48,6 +48,9 @@ int bnxt_hwrm_cfa_l2_clear_rx_mask(struct bnxt *bp,int bnxt_hwrm_cfa_l2_set_rx_mask (struct bnxt *bp,struct bnxt_vnic_info *vnic,uint16_t vlan_count,struct bnxt_vlan_table_entry *vlan_table); +int bnxt_hwrm_cfa_vlan_antispoof_cfg (struct bnxt *bp,uint16_t fid, +uint16_t vlan_count, +struct bnxt_vlan_antispoof_table_entry *vlan_table);int bnxt_hwrm_clear_filter (struct bnxt *bp,struct bnxt_filter_info *filter); int bnxt_hwrm_set_filter(struct bnxt *bp,
drivers/net/bnxt/hsi_struct_def_dpdk.h +80 -1
93 lines not on this page · raw message
drivers/net/bnxt/rte_pmd_bnxt.c +63 -28
143 lines not on this page · raw message
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH v2 7/8 net/bnxt: check invalid l2_filter_id
In reply to Ajit KhapardeAdd code to check for invalid filter_id in bnxt_hwrm_clear_filter
--- drivers/net/bnxt/bnxt_hwrm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +3 -0
@@ -327,6 +327,9 @@ int bnxt_hwrm_clear_filter(struct bnxt *bp,struct hwrm_cfa_l2_filter_free_input req = {.req_type =0 };struct hwrm_cfa_l2_filter_free_output *resp = bp->hwrm_cmd_resp_addr; +if (filter->fw_l2_filter_id ==UINT64_MAX ) +return 0 ; +HWRM_PREP (req,CFA_L2_FILTER_FREE ,-1 , resp); req.l2_filter_id =rte_cpu_to_le_64 (filter->fw_l2_filter_id);
Signature · 1 line
2.10.1 (Apple Git-78)
PATCH v2 8/8 net/bnxt: fix to free a filter before reusing it
In reply to Ajit KhapardeThis patch sends the HWRM command to free a filter in the hardware, before using it again.
--- drivers/net/bnxt/bnxt_hwrm.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/bnxt/bnxt_hwrm.c +3 -0
@@ -352,6 +352,9 @@ int bnxt_hwrm_set_filter(struct bnxt *bp,struct hwrm_cfa_l2_filter_alloc_output *resp = bp->hwrm_cmd_resp_addr;uint32_t enables =0 ; +if (filter->fw_l2_filter_id !=UINT64_MAX ) +bnxt_hwrm_clear_filter (bp, filter); +HWRM_PREP (req,CFA_L2_FILTER_ALLOC ,-1 , resp); req.flags =rte_cpu_to_le_32 (filter->flags);
Signature · 1 line
2.10.1 (Apple Git-78)
Quoted 5 lines · Ajit Khaparde
This patch set fixes some of the issues found during testing. Please apply.
v1->v2: incorporate review feedback
Quoted 8 lines
net/bnxt: fix log levels for non error conditions. net/bnxt: fix to avoid a segfault net/bnxt: fix vnic cleanup
net/bnxt: fix set link config
net/bnxt: reset VF stats during initialization net/bnxt: fix VLAN antispoof configuration code net/bnxt: check invalidl2_filter_idnet/bnxt: fix to free a filter before reusing it
Series applied to dpdk-next-net/master, thanks.