Message ID | 20240729205459.2583533-2-dw@davidwei.uk (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | fix bnxt_en queue reset when queue is active | expand |
On 29.07.2024 22:54, David Wei wrote: > From: Michael Chan <michael.chan@broadcom.com> > > Add the HWRM_VNIC_UPDATE message structures and the function to > send the message to firmware. This message can be used when > disabling and enabling a receive ring within a VNIC. The mru > which is the maximum receive size of packets received by the > VNIC can be updated. > > Signed-off-by: Michael Chan <michael.chan@broadcom.com> > Signed-off-by: David Wei <dw@davidwei.uk> > --- > drivers/net/ethernet/broadcom/bnxt/bnxt.c | 23 +++++++++++- > drivers/net/ethernet/broadcom/bnxt/bnxt.h | 3 ++ > drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 37 +++++++++++++++++++ > 3 files changed, 62 insertions(+), 1 deletion(-) > > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c > index ffa74c26ee53..8822d7a17fbf 100644 > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c > @@ -6579,7 +6579,8 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic) > req->dflt_ring_grp = cpu_to_le16(bp->grp_info[grp_idx].fw_grp_id); > req->lb_rule = cpu_to_le16(0xffff); > vnic_mru: > - req->mru = cpu_to_le16(bp->dev->mtu + ETH_HLEN + VLAN_HLEN); > + vnic->mru = bp->dev->mtu + ETH_HLEN + VLAN_HLEN; > + req->mru = cpu_to_le16(vnic->mru); These changes seems unrelated to the topic of the patch IMO. This goal of this patch is to introduce the new firmware command that will be used later, if I understand correctly. Maybe those lines should be introduced in one of the later patches. > > req->vnic_id = cpu_to_le16(vnic->fw_vnic_id); > #ifdef CONFIG_BNXT_SRIOV > @@ -10086,6 +10087,26 @@ static int __bnxt_setup_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic) > return rc; > } > > +int bnxt_hwrm_vnic_update(struct bnxt *bp, struct bnxt_vnic_info *vnic, > + u8 valid) > +{ > + struct hwrm_vnic_update_input *req; > + int rc; > + > + rc = hwrm_req_init(bp, req, HWRM_VNIC_UPDATE); > + if (rc) > + return rc; > + > + req->vnic_id = cpu_to_le32(vnic->fw_vnic_id); > + > + if (valid & VNIC_UPDATE_REQ_ENABLES_MRU_VALID) > + req->mru = cpu_to_le16(vnic->mru); > + > + req->enables = cpu_to_le32(valid); > + > + return hwrm_req_send(bp, req); > +} > + > int bnxt_hwrm_vnic_rss_cfg_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic) > { > int rc; > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h > index 6bbdc718c3a7..5de67f718993 100644 > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h > @@ -1250,6 +1250,7 @@ struct bnxt_vnic_info { > #define BNXT_MAX_CTX_PER_VNIC 8 > u16 fw_rss_cos_lb_ctx[BNXT_MAX_CTX_PER_VNIC]; > u16 fw_l2_ctx_id; > + u16 mru; > #define BNXT_MAX_UC_ADDRS 4 > struct bnxt_l2_filter *l2_filters[BNXT_MAX_UC_ADDRS]; > /* index 0 always dev_addr */ > @@ -2838,6 +2839,8 @@ int bnxt_hwrm_free_wol_fltr(struct bnxt *bp); > int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all); > int bnxt_hwrm_func_qcaps(struct bnxt *bp); > int bnxt_hwrm_fw_set_time(struct bnxt *); > +int bnxt_hwrm_vnic_update(struct bnxt *bp, struct bnxt_vnic_info *vnic, > + u8 valid); > int bnxt_hwrm_vnic_rss_cfg_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic); > int __bnxt_setup_vnic_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic); > void bnxt_del_one_rss_ctx(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx, > diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h > index f219709f9563..933f48a62586 100644 > --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h > +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h > @@ -6510,6 +6510,43 @@ struct hwrm_vnic_alloc_output { > u8 valid; > }; > > +/* hwrm_vnic_update_input (size:256b/32B) */ > +struct hwrm_vnic_update_input { > + __le16 req_type; > + __le16 cmpl_ring; > + __le16 seq_id; > + __le16 target_id; > + __le64 resp_addr; > + __le32 vnic_id; > + __le32 enables; > + #define VNIC_UPDATE_REQ_ENABLES_VNIC_STATE_VALID 0x1UL > + #define VNIC_UPDATE_REQ_ENABLES_MRU_VALID 0x2UL > + #define VNIC_UPDATE_REQ_ENABLES_METADATA_FORMAT_TYPE_VALID 0x4UL > + u8 vnic_state; > + #define VNIC_UPDATE_REQ_VNIC_STATE_NORMAL 0x0UL > + #define VNIC_UPDATE_REQ_VNIC_STATE_DROP 0x1UL > + #define VNIC_UPDATE_REQ_VNIC_STATE_LAST VNIC_UPDATE_REQ_VNIC_STATE_DROP > + u8 metadata_format_type; > + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_0 0x0UL > + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_1 0x1UL > + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_2 0x2UL > + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_3 0x3UL > + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_4 0x4UL > + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_LAST VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_4 > + __le16 mru; > + u8 unused_1[4]; > +}; > + > +/* hwrm_vnic_update_output (size:128b/16B) */ > +struct hwrm_vnic_update_output { > + __le16 error_code; > + __le16 req_type; > + __le16 seq_id; > + __le16 resp_len; > + u8 unused_0[7]; > + u8 valid; > +}; > + > /* hwrm_vnic_free_input (size:192b/24B) */ > struct hwrm_vnic_free_input { > __le16 req_type;
On 2024-07-30 11:24, Wojciech Drewek wrote: > > > On 29.07.2024 22:54, David Wei wrote: >> From: Michael Chan <michael.chan@broadcom.com> >> >> Add the HWRM_VNIC_UPDATE message structures and the function to >> send the message to firmware. This message can be used when >> disabling and enabling a receive ring within a VNIC. The mru >> which is the maximum receive size of packets received by the >> VNIC can be updated. >> >> Signed-off-by: Michael Chan <michael.chan@broadcom.com> >> Signed-off-by: David Wei <dw@davidwei.uk> >> --- >> drivers/net/ethernet/broadcom/bnxt/bnxt.c | 23 +++++++++++- >> drivers/net/ethernet/broadcom/bnxt/bnxt.h | 3 ++ >> drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 37 +++++++++++++++++++ >> 3 files changed, 62 insertions(+), 1 deletion(-) >> >> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c >> index ffa74c26ee53..8822d7a17fbf 100644 >> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c >> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c >> @@ -6579,7 +6579,8 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic) >> req->dflt_ring_grp = cpu_to_le16(bp->grp_info[grp_idx].fw_grp_id); >> req->lb_rule = cpu_to_le16(0xffff); >> vnic_mru: >> - req->mru = cpu_to_le16(bp->dev->mtu + ETH_HLEN + VLAN_HLEN); >> + vnic->mru = bp->dev->mtu + ETH_HLEN + VLAN_HLEN; >> + req->mru = cpu_to_le16(vnic->mru); > > These changes seems unrelated to the topic of the patch IMO. > This goal of this patch is to introduce the new firmware command that > will be used later, if I understand correctly. Maybe those lines should be > introduced in one of the later patches. That's fair. I took the patch wholesale from Michael. Happy to split it into another patch. > >> >> req->vnic_id = cpu_to_le16(vnic->fw_vnic_id); >> #ifdef CONFIG_BNXT_SRIOV >> @@ -10086,6 +10087,26 @@ static int __bnxt_setup_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic) >> return rc; >> } >> >> +int bnxt_hwrm_vnic_update(struct bnxt *bp, struct bnxt_vnic_info *vnic, >> + u8 valid) >> +{ >> + struct hwrm_vnic_update_input *req; >> + int rc; >> + >> + rc = hwrm_req_init(bp, req, HWRM_VNIC_UPDATE); >> + if (rc) >> + return rc; >> + >> + req->vnic_id = cpu_to_le32(vnic->fw_vnic_id); >> + >> + if (valid & VNIC_UPDATE_REQ_ENABLES_MRU_VALID) >> + req->mru = cpu_to_le16(vnic->mru); >> + >> + req->enables = cpu_to_le32(valid); >> + >> + return hwrm_req_send(bp, req); >> +} >> + >> int bnxt_hwrm_vnic_rss_cfg_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic) >> { >> int rc; >> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h >> index 6bbdc718c3a7..5de67f718993 100644 >> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h >> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h >> @@ -1250,6 +1250,7 @@ struct bnxt_vnic_info { >> #define BNXT_MAX_CTX_PER_VNIC 8 >> u16 fw_rss_cos_lb_ctx[BNXT_MAX_CTX_PER_VNIC]; >> u16 fw_l2_ctx_id; >> + u16 mru; >> #define BNXT_MAX_UC_ADDRS 4 >> struct bnxt_l2_filter *l2_filters[BNXT_MAX_UC_ADDRS]; >> /* index 0 always dev_addr */ >> @@ -2838,6 +2839,8 @@ int bnxt_hwrm_free_wol_fltr(struct bnxt *bp); >> int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all); >> int bnxt_hwrm_func_qcaps(struct bnxt *bp); >> int bnxt_hwrm_fw_set_time(struct bnxt *); >> +int bnxt_hwrm_vnic_update(struct bnxt *bp, struct bnxt_vnic_info *vnic, >> + u8 valid); >> int bnxt_hwrm_vnic_rss_cfg_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic); >> int __bnxt_setup_vnic_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic); >> void bnxt_del_one_rss_ctx(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx, >> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h >> index f219709f9563..933f48a62586 100644 >> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h >> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h >> @@ -6510,6 +6510,43 @@ struct hwrm_vnic_alloc_output { >> u8 valid; >> }; >> >> +/* hwrm_vnic_update_input (size:256b/32B) */ >> +struct hwrm_vnic_update_input { >> + __le16 req_type; >> + __le16 cmpl_ring; >> + __le16 seq_id; >> + __le16 target_id; >> + __le64 resp_addr; >> + __le32 vnic_id; >> + __le32 enables; >> + #define VNIC_UPDATE_REQ_ENABLES_VNIC_STATE_VALID 0x1UL >> + #define VNIC_UPDATE_REQ_ENABLES_MRU_VALID 0x2UL >> + #define VNIC_UPDATE_REQ_ENABLES_METADATA_FORMAT_TYPE_VALID 0x4UL >> + u8 vnic_state; >> + #define VNIC_UPDATE_REQ_VNIC_STATE_NORMAL 0x0UL >> + #define VNIC_UPDATE_REQ_VNIC_STATE_DROP 0x1UL >> + #define VNIC_UPDATE_REQ_VNIC_STATE_LAST VNIC_UPDATE_REQ_VNIC_STATE_DROP >> + u8 metadata_format_type; >> + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_0 0x0UL >> + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_1 0x1UL >> + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_2 0x2UL >> + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_3 0x3UL >> + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_4 0x4UL >> + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_LAST VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_4 >> + __le16 mru; >> + u8 unused_1[4]; >> +}; >> + >> +/* hwrm_vnic_update_output (size:128b/16B) */ >> +struct hwrm_vnic_update_output { >> + __le16 error_code; >> + __le16 req_type; >> + __le16 seq_id; >> + __le16 resp_len; >> + u8 unused_0[7]; >> + u8 valid; >> +}; >> + >> /* hwrm_vnic_free_input (size:192b/24B) */ >> struct hwrm_vnic_free_input { >> __le16 req_type;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index ffa74c26ee53..8822d7a17fbf 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -6579,7 +6579,8 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, struct bnxt_vnic_info *vnic) req->dflt_ring_grp = cpu_to_le16(bp->grp_info[grp_idx].fw_grp_id); req->lb_rule = cpu_to_le16(0xffff); vnic_mru: - req->mru = cpu_to_le16(bp->dev->mtu + ETH_HLEN + VLAN_HLEN); + vnic->mru = bp->dev->mtu + ETH_HLEN + VLAN_HLEN; + req->mru = cpu_to_le16(vnic->mru); req->vnic_id = cpu_to_le16(vnic->fw_vnic_id); #ifdef CONFIG_BNXT_SRIOV @@ -10086,6 +10087,26 @@ static int __bnxt_setup_vnic(struct bnxt *bp, struct bnxt_vnic_info *vnic) return rc; } +int bnxt_hwrm_vnic_update(struct bnxt *bp, struct bnxt_vnic_info *vnic, + u8 valid) +{ + struct hwrm_vnic_update_input *req; + int rc; + + rc = hwrm_req_init(bp, req, HWRM_VNIC_UPDATE); + if (rc) + return rc; + + req->vnic_id = cpu_to_le32(vnic->fw_vnic_id); + + if (valid & VNIC_UPDATE_REQ_ENABLES_MRU_VALID) + req->mru = cpu_to_le16(vnic->mru); + + req->enables = cpu_to_le32(valid); + + return hwrm_req_send(bp, req); +} + int bnxt_hwrm_vnic_rss_cfg_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic) { int rc; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 6bbdc718c3a7..5de67f718993 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -1250,6 +1250,7 @@ struct bnxt_vnic_info { #define BNXT_MAX_CTX_PER_VNIC 8 u16 fw_rss_cos_lb_ctx[BNXT_MAX_CTX_PER_VNIC]; u16 fw_l2_ctx_id; + u16 mru; #define BNXT_MAX_UC_ADDRS 4 struct bnxt_l2_filter *l2_filters[BNXT_MAX_UC_ADDRS]; /* index 0 always dev_addr */ @@ -2838,6 +2839,8 @@ int bnxt_hwrm_free_wol_fltr(struct bnxt *bp); int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all); int bnxt_hwrm_func_qcaps(struct bnxt *bp); int bnxt_hwrm_fw_set_time(struct bnxt *); +int bnxt_hwrm_vnic_update(struct bnxt *bp, struct bnxt_vnic_info *vnic, + u8 valid); int bnxt_hwrm_vnic_rss_cfg_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic); int __bnxt_setup_vnic_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic); void bnxt_del_one_rss_ctx(struct bnxt *bp, struct bnxt_rss_ctx *rss_ctx, diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h index f219709f9563..933f48a62586 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h @@ -6510,6 +6510,43 @@ struct hwrm_vnic_alloc_output { u8 valid; }; +/* hwrm_vnic_update_input (size:256b/32B) */ +struct hwrm_vnic_update_input { + __le16 req_type; + __le16 cmpl_ring; + __le16 seq_id; + __le16 target_id; + __le64 resp_addr; + __le32 vnic_id; + __le32 enables; + #define VNIC_UPDATE_REQ_ENABLES_VNIC_STATE_VALID 0x1UL + #define VNIC_UPDATE_REQ_ENABLES_MRU_VALID 0x2UL + #define VNIC_UPDATE_REQ_ENABLES_METADATA_FORMAT_TYPE_VALID 0x4UL + u8 vnic_state; + #define VNIC_UPDATE_REQ_VNIC_STATE_NORMAL 0x0UL + #define VNIC_UPDATE_REQ_VNIC_STATE_DROP 0x1UL + #define VNIC_UPDATE_REQ_VNIC_STATE_LAST VNIC_UPDATE_REQ_VNIC_STATE_DROP + u8 metadata_format_type; + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_0 0x0UL + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_1 0x1UL + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_2 0x2UL + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_3 0x3UL + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_4 0x4UL + #define VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_LAST VNIC_UPDATE_REQ_METADATA_FORMAT_TYPE_4 + __le16 mru; + u8 unused_1[4]; +}; + +/* hwrm_vnic_update_output (size:128b/16B) */ +struct hwrm_vnic_update_output { + __le16 error_code; + __le16 req_type; + __le16 seq_id; + __le16 resp_len; + u8 unused_0[7]; + u8 valid; +}; + /* hwrm_vnic_free_input (size:192b/24B) */ struct hwrm_vnic_free_input { __le16 req_type;