bnxt_en: Patches for net-next.
cover bnxt_en: Patches for net-next.
Mainly clean-ups, optimizations, and updating to the latest firmware interface spec.
Michael Chan (12):
bnxt_en: support hwrm_func_drv_unrgtr command
bnxt_en: Optimize ring alloc and ring free functions.
bnxt_en: Add support for upgrading APE/NC-SI firmware via Ethtool
FLASHDEV
bnxt_en: Increment checksum error counter only if NETIF_F_RXCSUM is
set.
bnxt_en: Allocate rx_cpu_rmap only if Accelerated RFS is enabled.
bnxt_en: Don't treat single segment rx frames as GRO frames.
bnxt_en: Check hardware resources before enabling NTUPLE.
bnxt_en: Cleanup bnxt_hwrm_func_cfg().
bnxt_en: Improve VF resource accounting.
bnxt_en: Keep track of the ring group resource.
bnxt_en: Update to Firmware interface spec 1.0.0.
bnxt_en: Add BCM57301 & BCM57402 devices.
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 330 +++++---- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 13 +- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 5 + drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 865 ++++++++-------------- drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 62 +- 5 files changed, 544 insertions(+), 731 deletions(-)
Signature · 1 line
1.8.3.1
PATCH 1/12 bnxt_en: support hwrm_func_drv_unrgtr command
From: Jeffrey Huang <[email protected]>
During remove_one, the driver should issue hwrm_func_drv_unrgtr command to inform firmware that this function has been unloaded. This is to let firmware keep track of driver present/absent state when driver is gracefully unloaded. A keep alive timer is needed later to keep track of driver state during abnormal shutdown.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +9 -0
@@ -2710,6 +2710,14 @@ static int bnxt_hwrm_func_drv_rgtr(struct bnxt *bp)return hwrm_send_message (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT ); } +static int bnxt_hwrm_func_drv_unrgtr (struct bnxt *bp) +{ +struct hwrm_func_drv_unrgtr_input req = {0 }; + +bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_FUNC_DRV_UNRGTR ,-1 ,-1 ); +return hwrm_send_message (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT ); +} +static int bnxt_hwrm_tunnel_dst_port_free (struct bnxt *bp,u8 tunnel_type) {u32 rc =0 ;
@@ -5549,6 +5557,7 @@ static void bnxt_remove_one(struct pci_dev *pdev)cancel_work_sync (&bp->sp_task); bp->sp_event =0 ; +bnxt_hwrm_func_drv_unrgtr (bp);bnxt_free_hwrm_resources (bp);pci_iounmap (pdev, bp->bar2);pci_iounmap (pdev, bp->bar1);
Signature · 1 line
1.8.3.1
PATCH 2/12 bnxt_en: Optimize ring alloc and ring free functions.
In reply to Michael ChanRemove the unnecessary "if" statement before the "for" statement:
if (x) {
for (i = 0; i < x; i++)...
}
Also, change the ring free function to return void as it only returns 0.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 201 +++++++++++++----------------- 1 file changed, 87 insertions(+), 114 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +87 -114
@@ -1969,11 +1969,12 @@ static int bnxt_init_one_rx_ring(struct bnxt *bp, int ring_nr) rxr->rx_prod = prod; ring->fw_ring_id =INVALID_HW_RING_ID ; + ring = &rxr->rx_agg_ring_struct; + ring->fw_ring_id =INVALID_HW_RING_ID ; +if (!(bp->flags &BNXT_FLAG_AGG_RINGS ))return 0 ; - ring = &rxr->rx_agg_ring_struct; - type = ((u32 )PAGE_SIZE <<RX_BD_LEN_SHIFT ) |RX_BD_TYPE_RX_AGG_BD |RX_BD_FLAGS_SOP ;
@@ -1989,7 +1990,6 @@ static int bnxt_init_one_rx_ring(struct bnxt *bp, int ring_nr) prod =NEXT_RX_AGG (prod); } rxr->rx_agg_prod = prod; - ring->fw_ring_id =INVALID_HW_RING_ID ;if (bp->flags &BNXT_FLAG_TPA ) {if (rxr->rx_tpa) {
@@ -3301,54 +3301,45 @@ static int bnxt_hwrm_ring_alloc(struct bnxt *bp) {int i, rc =0 ; -if (bp->cp_nr_rings) { -for (i =0 ; i < bp->cp_nr_rings; i++) { -struct bnxt_napi *bnapi = bp->bnapi[i]; -struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; -struct bnxt_ring_struct *ring = &cpr->cp_ring_struct; +for (i =0 ; i < bp->cp_nr_rings; i++) { +struct bnxt_napi *bnapi = bp->bnapi[i]; +struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; +struct bnxt_ring_struct *ring = &cpr->cp_ring_struct; - rc =hwrm_ring_alloc_send_msg (bp, ring, -HWRM_RING_ALLOC_CMPL , i, -INVALID_STATS_CTX_ID ); -if (rc) - goto err_out; - cpr->cp_doorbell = bp->bar1 + i *0x80 ; -BNXT_CP_DB (cpr->cp_doorbell, cpr->cp_raw_cons); - bp->grp_info[i].cp_fw_ring_id = ring->fw_ring_id; - } + rc =hwrm_ring_alloc_send_msg (bp, ring,HWRM_RING_ALLOC_CMPL , i, +INVALID_STATS_CTX_ID ); +if (rc) + goto err_out; + cpr->cp_doorbell = bp->bar1 + i *0x80 ; +BNXT_CP_DB (cpr->cp_doorbell, cpr->cp_raw_cons); + bp->grp_info[i].cp_fw_ring_id = ring->fw_ring_id; } -if (bp->tx_nr_rings) { -for (i =0 ; i < bp->tx_nr_rings; i++) { -struct bnxt_napi *bnapi = bp->bnapi[i]; -struct bnxt_tx_ring_info *txr = &bnapi->tx_ring; -struct bnxt_ring_struct *ring = &txr->tx_ring_struct; -u16 fw_stats_ctx = bp->grp_info[i].fw_stats_ctx; +for (i =0 ; i < bp->tx_nr_rings; i++) { +struct bnxt_napi *bnapi = bp->bnapi[i]; +struct bnxt_tx_ring_info *txr = &bnapi->tx_ring; +struct bnxt_ring_struct *ring = &txr->tx_ring_struct; +u16 fw_stats_ctx = bp->grp_info[i].fw_stats_ctx; - rc =hwrm_ring_alloc_send_msg (bp, ring, -HWRM_RING_ALLOC_TX , i, - fw_stats_ctx); -if (rc) - goto err_out; - txr->tx_doorbell = bp->bar1 + i *0x80 ; - } + rc =hwrm_ring_alloc_send_msg (bp, ring,HWRM_RING_ALLOC_TX , i, + fw_stats_ctx); +if (rc) + goto err_out; + txr->tx_doorbell = bp->bar1 + i *0x80 ; } -if (bp->rx_nr_rings) { -for (i =0 ; i < bp->rx_nr_rings; i++) { -struct bnxt_napi *bnapi = bp->bnapi[i]; -struct bnxt_rx_ring_info *rxr = &bnapi->rx_ring; -struct bnxt_ring_struct *ring = &rxr->rx_ring_struct; +for (i =0 ; i < bp->rx_nr_rings; i++) { +struct bnxt_napi *bnapi = bp->bnapi[i]; +struct bnxt_rx_ring_info *rxr = &bnapi->rx_ring; +struct bnxt_ring_struct *ring = &rxr->rx_ring_struct; - rc =hwrm_ring_alloc_send_msg (bp, ring, -HWRM_RING_ALLOC_RX , i, -INVALID_STATS_CTX_ID ); -if (rc) - goto err_out; - rxr->rx_doorbell = bp->bar1 + i *0x80 ; -writel (DB_KEY_RX | rxr->rx_prod, rxr->rx_doorbell); - bp->grp_info[i].rx_fw_ring_id = ring->fw_ring_id; - } + rc =hwrm_ring_alloc_send_msg (bp, ring,HWRM_RING_ALLOC_RX , i, +INVALID_STATS_CTX_ID ); +if (rc) + goto err_out; + rxr->rx_doorbell = bp->bar1 + i *0x80 ; +writel (DB_KEY_RX | rxr->rx_prod, rxr->rx_doorbell); + bp->grp_info[i].rx_fw_ring_id = ring->fw_ring_id; }if (bp->flags &BNXT_FLAG_AGG_RINGS ) {
@@ -3416,91 +3407,73 @@ static int hwrm_ring_free_send_msg(struct bnxt *bp,return 0 ; } -static int bnxt_hwrm_ring_free (struct bnxt *bp,bool close_path) +static void bnxt_hwrm_ring_free (struct bnxt *bp,bool close_path) { -int i, rc =0 ; +int i;if (!bp->bnapi) -return 0 ; +return ; -if (bp->tx_nr_rings) { -for (i =0 ; i < bp->tx_nr_rings; i++) { -struct bnxt_napi *bnapi = bp->bnapi[i]; -struct bnxt_tx_ring_info *txr = &bnapi->tx_ring; -struct bnxt_ring_struct *ring = &txr->tx_ring_struct; -u32 cmpl_ring_id = bp->grp_info[i].cp_fw_ring_id; - -if (ring->fw_ring_id !=INVALID_HW_RING_ID ) { -hwrm_ring_free_send_msg ( - bp, ring, -RING_FREE_REQ_RING_TYPE_TX , - close_path ? cmpl_ring_id : -INVALID_HW_RING_ID ); - ring->fw_ring_id =INVALID_HW_RING_ID ; - } +for (i =0 ; i < bp->tx_nr_rings; i++) { +struct bnxt_napi *bnapi = bp->bnapi[i]; +struct bnxt_tx_ring_info *txr = &bnapi->tx_ring; +struct bnxt_ring_struct *ring = &txr->tx_ring_struct; +u32 cmpl_ring_id = bp->grp_info[i].cp_fw_ring_id; + +if (ring->fw_ring_id !=INVALID_HW_RING_ID ) { +hwrm_ring_free_send_msg (bp, ring, +RING_FREE_REQ_RING_TYPE_TX , + close_path ? cmpl_ring_id : +INVALID_HW_RING_ID ); + ring->fw_ring_id =INVALID_HW_RING_ID ; } } -if (bp->rx_nr_rings) { -for (i =0 ; i < bp->rx_nr_rings; i++) { -struct bnxt_napi *bnapi = bp->bnapi[i]; -struct bnxt_rx_ring_info *rxr = &bnapi->rx_ring; -struct bnxt_ring_struct *ring = &rxr->rx_ring_struct; -u32 cmpl_ring_id = bp->grp_info[i].cp_fw_ring_id; - -if (ring->fw_ring_id !=INVALID_HW_RING_ID ) { -hwrm_ring_free_send_msg ( - bp, ring, -RING_FREE_REQ_RING_TYPE_RX , - close_path ? cmpl_ring_id : -INVALID_HW_RING_ID ); - ring->fw_ring_id =INVALID_HW_RING_ID ; - bp->grp_info[i].rx_fw_ring_id = -INVALID_HW_RING_ID ; - } +for (i =0 ; i < bp->rx_nr_rings; i++) { +struct bnxt_napi *bnapi = bp->bnapi[i]; +struct bnxt_rx_ring_info *rxr = &bnapi->rx_ring; +struct bnxt_ring_struct *ring = &rxr->rx_ring_struct; +u32 cmpl_ring_id = bp->grp_info[i].cp_fw_ring_id; + +if (ring->fw_ring_id !=INVALID_HW_RING_ID ) { +hwrm_ring_free_send_msg (bp, ring, +RING_FREE_REQ_RING_TYPE_RX , + close_path ? cmpl_ring_id : +INVALID_HW_RING_ID ); + ring->fw_ring_id =INVALID_HW_RING_ID ; + bp->grp_info[i].rx_fw_ring_id =INVALID_HW_RING_ID ; } } -if (bp->rx_agg_nr_pages) { -for (i =0 ; i < bp->rx_nr_rings; i++) { -struct bnxt_napi *bnapi = bp->bnapi[i]; -struct bnxt_rx_ring_info *rxr = &bnapi->rx_ring; -struct bnxt_ring_struct *ring = - &rxr->rx_agg_ring_struct; -u32 cmpl_ring_id = bp->grp_info[i].cp_fw_ring_id; - -if (ring->fw_ring_id !=INVALID_HW_RING_ID ) { -hwrm_ring_free_send_msg ( - bp, ring, -RING_FREE_REQ_RING_TYPE_RX , - close_path ? cmpl_ring_id : -INVALID_HW_RING_ID ); - ring->fw_ring_id =INVALID_HW_RING_ID ; - bp->grp_info[i].agg_fw_ring_id = -INVALID_HW_RING_ID ; - } +for (i =0 ; i < bp->rx_nr_rings; i++) { +struct bnxt_napi *bnapi = bp->bnapi[i]; +struct bnxt_rx_ring_info *rxr = &bnapi->rx_ring; +struct bnxt_ring_struct *ring = &rxr->rx_agg_ring_struct; +u32 cmpl_ring_id = bp->grp_info[i].cp_fw_ring_id; + +if (ring->fw_ring_id !=INVALID_HW_RING_ID ) { +hwrm_ring_free_send_msg (bp, ring, +RING_FREE_REQ_RING_TYPE_RX , + close_path ? cmpl_ring_id : +INVALID_HW_RING_ID ); + ring->fw_ring_id =INVALID_HW_RING_ID ; + bp->grp_info[i].agg_fw_ring_id =INVALID_HW_RING_ID ; } } -if (bp->cp_nr_rings) { -for (i =0 ; i < bp->cp_nr_rings; i++) { -struct bnxt_napi *bnapi = bp->bnapi[i]; -struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; -struct bnxt_ring_struct *ring = &cpr->cp_ring_struct; - -if (ring->fw_ring_id !=INVALID_HW_RING_ID ) { -hwrm_ring_free_send_msg ( - bp, ring, -RING_FREE_REQ_RING_TYPE_CMPL , -INVALID_HW_RING_ID ); - ring->fw_ring_id =INVALID_HW_RING_ID ; - bp->grp_info[i].cp_fw_ring_id = -INVALID_HW_RING_ID ; - } +for (i =0 ; i < bp->cp_nr_rings; i++) { +struct bnxt_napi *bnapi = bp->bnapi[i]; +struct bnxt_cp_ring_info *cpr = &bnapi->cp_ring; +struct bnxt_ring_struct *ring = &cpr->cp_ring_struct; + +if (ring->fw_ring_id !=INVALID_HW_RING_ID ) { +hwrm_ring_free_send_msg (bp, ring, +RING_FREE_REQ_RING_TYPE_CMPL , +INVALID_HW_RING_ID ); + ring->fw_ring_id =INVALID_HW_RING_ID ; + bp->grp_info[i].cp_fw_ring_id =INVALID_HW_RING_ID ; } } - -return rc; }int bnxt_hwrm_set_coal (struct bnxt *bp)
Signature · 1 line
1.8.3.1
PATCH 3/12 bnxt_en: Add support for upgrading APE/NC-SI firmware via Ethtool FLASHDEV
In reply to Michael ChanFrom: Rob Swindell <[email protected]>
NC-SI firmware of type apeFW (10) is now supported.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +3 -0
@@ -818,6 +818,9 @@ static int bnxt_flash_firmware(struct net_device *dev,case BNX_DIR_TYPE_BOOTCODE_2 : code_type =CODE_BOOT ;break ; +case BNX_DIR_TYPE_APE_FW : + code_type =CODE_MCTP_PASSTHRU ; +break ;default :netdev_err (dev,"Unsupported directory entry type: %u\n" , dir_type);
Signature · 1 line
1.8.3.1
PATCH 4/12 bnxt_en: Increment checksum error counter only if NETIF_F_RXCSUM is set.
In reply to Michael ChanFrom: Satish Baddipadige <[email protected]>
rx_l4_csum_error is now incremented only when offload is enabled
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +4 -2
@@ -1187,8 +1187,10 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_napi *bnapi, u32 *raw_cons, skb->csum_level =RX_CMP_ENCAP (rxcmp1); } }else { -if (rxcmp1->rx_cmp_cfa_code_errors_v2 &RX_CMP_L4_CS_ERR_BITS ) - cpr->rx_l4_csum_errors++; +if (rxcmp1->rx_cmp_cfa_code_errors_v2 &RX_CMP_L4_CS_ERR_BITS ) { +if (dev->features &NETIF_F_RXCSUM ) + cpr->rx_l4_csum_errors++; + } }skb_record_rx_queue (skb, bnapi->index);
Signature · 1 line
1.8.3.1
PATCH 5/12 bnxt_en: Allocate rx_cpu_rmap only if Accelerated RFS is enabled.
In reply to Michael ChanAlso, no need to check for bp->rx_nr_rings as it is always >= 1. If the allocation fails, it is not a fatal error and we can still proceed.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -3
@@ -4009,10 +4009,8 @@ static int bnxt_set_real_num_queues(struct bnxt *bp)return rc;#ifdef CONFIG_RFS_ACCEL -if (bp->rx_nr_rings) +if (bp->flags &BNXT_FLAG_RFS ) dev->rx_cpu_rmap =alloc_irq_cpu_rmap (bp->rx_nr_rings); -if (!dev->rx_cpu_rmap) - rc = -ENOMEM ;#endif return rc;
Signature · 1 line
1.8.3.1
PATCH 6/12 bnxt_en: Don't treat single segment rx frames as GRO frames.
In reply to Michael ChanIf hardware completes single segment rx frames, don't bother setting up all the GRO related fields. Pass the SKB up as a normal frame.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +6 -1
@@ -856,8 +856,13 @@ static inline struct sk_buff *bnxt_gro_skb(struct bnxt_tpa_info *tpa_info,struct tcphdr *th;int payload_off, tcp_opt_len =0 ;int len, nw_off; +u16 segs; -NAPI_GRO_CB (skb)->count =TPA_END_TPA_SEGS (tpa_end); + segs =TPA_END_TPA_SEGS (tpa_end); +if (segs ==1 ) +return skb; + +NAPI_GRO_CB (skb)->count = segs;skb_shinfo (skb)->gso_size =le32_to_cpu (tpa_end1->rx_tpa_end_cmp_seg_len);skb_shinfo (skb)->gso_type = tpa_info->gso_type;
Signature · 1 line
1.8.3.1
PATCH 7/12 bnxt_en: Check hardware resources before enabling NTUPLE.
In reply to Michael ChanThe hardware resources required to enable NTUPLE varies depending on how many rx channels are configured. We need to make sure we have the resources before we enable NTUPLE. Add bnxt_rfs_capable() to do the checking.
In addition, we need to do the same checking in ndo_fix_features(). As the rx channels are changed using ethtool -L, we call netdev_update_features() to make the necessary adjustment for NTUPLE.
Calling netdev_update_features() in netif_running() state but before calling bnxt_open_nic() would be a problem. To make this work, bnxt_set_features() has to be modified to test for BNXT_STATE_OPEN for the true hardware state instead of checking netif_running().
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 41 ++++++++++++++++++----- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 2 ++ 2 files changed, 35 insertions(+), 8 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +33 -8
@@ -4916,9 +4916,32 @@ skip_uc:return rc; } +static bool bnxt_rfs_capable (struct bnxt *bp) +{ +#ifdef CONFIG_RFS_ACCEL +struct bnxt_pf_info *pf = &bp->pf; +int vnics; + +if (BNXT_VF (bp) || !(bp->flags &BNXT_FLAG_MSIX_CAP )) +return false; + + vnics =1 + bp->rx_nr_rings; +if (vnics > pf->max_rsscos_ctxs || vnics > pf->max_vnics) +return false; + +return true; +#else +return false; +#endif +} +static netdev_features_t bnxt_fix_features (struct net_device *dev,netdev_features_t features) { +struct bnxt *bp =netdev_priv (dev); + +if (!bnxt_rfs_capable (bp)) + features &= ~NETIF_F_NTUPLE ;return features; }
@@ -4959,7 +4982,7 @@ static int bnxt_set_features(struct net_device *dev, netdev_features_t features) bp->flags = flags; -if (!netif_running (dev)) { +if (!test_bit (BNXT_STATE_OPEN , &bp->state)) {if (update_tpa)bnxt_set_ring_params (bp);return rc;
@@ -5639,11 +5662,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)if (bnxt_vf_pciid (ent->driver_data)) bp->flags |=BNXT_FLAG_VF ; -if (pdev->msix_cap) { +if (pdev->msix_cap) bp->flags |=BNXT_FLAG_MSIX_CAP ; -if (BNXT_PF (bp)) - bp->flags |=BNXT_FLAG_RFS ; - } rc =bnxt_init_board (pdev, dev);if (rc <0 )
@@ -5662,9 +5682,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)NETIF_F_RXHASH |NETIF_F_RXCSUM |NETIF_F_LRO |NETIF_F_GRO ; -if (bp->flags &BNXT_FLAG_RFS ) - dev->hw_features |=NETIF_F_NTUPLE ; - dev->hw_enc_features =NETIF_F_IP_CSUM |NETIF_F_IPV6_CSUM |NETIF_F_SG | NETIF_F_TSO | NETIF_F_TSO6 |
@@ -5723,6 +5740,14 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) bp->cp_nr_rings =max_t (int, bp->rx_nr_rings, bp->tx_nr_rings); bp->num_stat_ctxs = bp->cp_nr_rings; +if (BNXT_PF (bp)) { + dev->hw_features |=NETIF_F_NTUPLE ; +if (bnxt_rfs_capable (bp)) { + bp->flags |=BNXT_FLAG_RFS ; + dev->features |=NETIF_F_NTUPLE ; + } + } +if (dev->hw_features &NETIF_F_HW_VLAN_CTAG_RX ) bp->flags |=BNXT_FLAG_STRIP_VLAN ;
drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +2 -0
@@ -266,6 +266,8 @@ static int bnxt_set_channels(struct net_device *dev, bp->cp_nr_rings =max_t (int, bp->tx_nr_rings, bp->rx_nr_rings); bp->num_stat_ctxs = bp->cp_nr_rings; +/* After changing number of rx channels, update NTUPLE feature. */ +netdev_update_features (dev);if (netif_running (dev)) { rc =bnxt_open_nic (bp, true, false);if ((!rc) &&BNXT_PF (bp)) {
Signature · 1 line
1.8.3.1
PATCH 8/12 bnxt_en: Cleanup bnxt_hwrm_func_cfg().
In reply to Michael Chan1. Use local variable pf for repeated access to this pointer.
2. The 2nd argument num_vfs was unnecessarily declared as pointer to int. This function doesn't change num_vfs so change the argument to int.
--- drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 33 ++++++++++++------------- 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +16 -17
@@ -363,7 +363,7 @@ static int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp) }/* only call by PF to reserve resources for VF */ -static int bnxt_hwrm_func_cfg (struct bnxt *bp,int *num_vfs) +static int bnxt_hwrm_func_cfg (struct bnxt *bp,int num_vfs) {u32 rc =0 , mtu, i;u16 vf_tx_rings, vf_rx_rings, vf_cp_rings, vf_stat_ctx, vf_vnics;
@@ -378,18 +378,17 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int *num_vfs)* be removed once new HWRM provides HW ring groups capability in * hwrm_func_qcap. */ - vf_cp_rings =min_t (u16, bp->pf.max_cp_rings, bp->pf.max_stat_ctxs); - vf_cp_rings = (vf_cp_rings - bp->cp_nr_rings) / *num_vfs; + vf_cp_rings =min_t (u16, pf->max_cp_rings, pf->max_stat_ctxs); + vf_cp_rings = (vf_cp_rings - bp->cp_nr_rings) / num_vfs;/* TODO: restore this logic below once the WA above is removed */ -/* vf_cp_rings = (bp->pf.max_cp_rings - bp->cp_nr_rings) / *num_vfs; */ - vf_stat_ctx = (bp->pf.max_stat_ctxs - bp->num_stat_ctxs) / *num_vfs; +/* vf_cp_rings = (pf->max_cp_rings - bp->cp_nr_rings) / num_vfs; */ + vf_stat_ctx = (pf->max_stat_ctxs - bp->num_stat_ctxs) / num_vfs;if (bp->flags &BNXT_FLAG_AGG_RINGS ) - vf_rx_rings = (bp->pf.max_rx_rings - bp->rx_nr_rings *2 ) / - *num_vfs; + vf_rx_rings = (pf->max_rx_rings - bp->rx_nr_rings *2 ) / + num_vfs;else - vf_rx_rings = (bp->pf.max_rx_rings - bp->rx_nr_rings) / - *num_vfs; - vf_tx_rings = (bp->pf.max_tx_rings - bp->tx_nr_rings) / *num_vfs; + vf_rx_rings = (pf->max_rx_rings - bp->rx_nr_rings) / num_vfs; + vf_tx_rings = (pf->max_tx_rings - bp->tx_nr_rings) / num_vfs; req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_MTU | FUNC_CFG_REQ_ENABLES_MRU |
@@ -417,22 +416,22 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int *num_vfs) req.num_stat_ctxs =cpu_to_le16 (vf_stat_ctx);mutex_lock (&bp->hwrm_cmd_lock); -for (i =0 ; i < *num_vfs; i++) { +for (i =0 ; i < num_vfs; i++) { req.vf_id =cpu_to_le16 (pf->first_vf_id + i); rc =_hwrm_send_message (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT );if (rc)break ; - bp->pf.active_vfs = i +1 ; - bp->pf.vf[i].fw_fid =le16_to_cpu (req.vf_id); + pf->active_vfs = i +1 ; + pf->vf[i].fw_fid =le16_to_cpu (req.vf_id); }mutex_unlock (&bp->hwrm_cmd_lock);if (!rc) { - bp->pf.max_pf_tx_rings = bp->tx_nr_rings; + pf->max_pf_tx_rings = bp->tx_nr_rings;if (bp->flags &BNXT_FLAG_AGG_RINGS ) - bp->pf.max_pf_rx_rings = bp->rx_nr_rings *2 ; + pf->max_pf_rx_rings = bp->rx_nr_rings *2 ;else - bp->pf.max_pf_rx_rings = bp->rx_nr_rings; + pf->max_pf_rx_rings = bp->rx_nr_rings; }return rc; }
@@ -492,7 +491,7 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs) goto err_out1;/* Reserve resources for VFs */ - rc =bnxt_hwrm_func_cfg (bp, num_vfs); + rc =bnxt_hwrm_func_cfg (bp, *num_vfs);if (rc) goto err_out2;
Signature · 1 line
1.8.3.1
PATCH 9/12 bnxt_en: Improve VF resource accounting.
In reply to Michael ChanWe need to keep track of all resources, such as rx rings, tx rings, cmpl rings, rss contexts, stats contexts, vnics, after we have divided them for the VFs. Otherwise, subsequent ring changes on the PF may not work correctly.
We adjust all max resources in struct bnxt_pf_info after they have been assigned to the VFs. There is no need to keep the separate max_pf_tx_rings and max_pf_rx_rings.
When SR-IOV is disabled, we call bnxt_hwrm_func_qcaps() to restore the max resources for the PF.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 8 +++----- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 3 +-- drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 15 ++++++++------- 3 files changed, 12 insertions(+), 14 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +3 -5
@@ -3592,7 +3592,7 @@ static int bnxt_hwrm_stat_ctx_alloc(struct bnxt *bp)return 0 ; } -static int bnxt_hwrm_func_qcaps (struct bnxt *bp) +int bnxt_hwrm_func_qcaps (struct bnxt *bp) {int rc =0 ;struct hwrm_func_qcaps_input req = {0 };
@@ -3616,9 +3616,7 @@ static int bnxt_hwrm_func_qcaps(struct bnxt *bp) pf->max_rsscos_ctxs =le16_to_cpu (resp->max_rsscos_ctx); pf->max_cp_rings =le16_to_cpu (resp->max_cmpl_rings); pf->max_tx_rings =le16_to_cpu (resp->max_tx_rings); - pf->max_pf_tx_rings = pf->max_tx_rings; pf->max_rx_rings =le16_to_cpu (resp->max_rx_rings); - pf->max_pf_rx_rings = pf->max_rx_rings; pf->max_l2_ctxs =le16_to_cpu (resp->max_l2_ctxs); pf->max_vnics =le16_to_cpu (resp->max_vnics); pf->max_stat_ctxs =le16_to_cpu (resp->max_stat_ctx);
@@ -5623,8 +5621,8 @@ void bnxt_get_max_rings(struct bnxt *bp, int *max_rx, int *max_tx)int max_rings =0 ;if (BNXT_PF (bp)) { - *max_tx = bp->pf.max_pf_tx_rings; - *max_rx = bp->pf.max_pf_rx_rings; + *max_tx = bp->pf.max_tx_rings; + *max_rx = bp->pf.max_rx_rings; max_rings =min_t (int, bp->pf.max_irqs, bp->pf.max_cp_rings); max_rings =min_t (int, max_rings, bp->pf.max_stat_ctxs); }else {
drivers/net/ethernet/broadcom/bnxt/bnxt.h +1 -2
@@ -722,9 +722,7 @@ struct bnxt_pf_info {u16 max_rsscos_ctxs;u16 max_cp_rings;u16 max_tx_rings;/* HW assigned max tx rings for this PF */ -u16 max_pf_tx_rings;/* runtime max tx rings owned by PF */ u16 max_rx_rings;/* HW assigned max rx rings for this PF */ -u16 max_pf_rx_rings;/* runtime max rx rings owned by PF */ u16 max_irqs;u16 max_l2_ctxs;u16 max_vnics;
@@ -1084,6 +1082,7 @@ void bnxt_hwrm_cmd_hdr_init(struct bnxt *, void *, u16, u16, u16);int _hwrm_send_message (struct bnxt *,void *,u32 ,int );int hwrm_send_message (struct bnxt *,void *,u32 ,int );int bnxt_hwrm_set_coal (struct bnxt *); +int bnxt_hwrm_func_qcaps (struct bnxt *);int bnxt_hwrm_set_pause (struct bnxt *);int bnxt_hwrm_set_link_setting (struct bnxt *,bool );int bnxt_open_nic (struct bnxt *,bool ,bool );
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +8 -7
@@ -427,11 +427,12 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs) }mutex_unlock (&bp->hwrm_cmd_lock);if (!rc) { - pf->max_pf_tx_rings = bp->tx_nr_rings; -if (bp->flags &BNXT_FLAG_AGG_RINGS ) - pf->max_pf_rx_rings = bp->rx_nr_rings *2 ; -else - pf->max_pf_rx_rings = bp->rx_nr_rings; + pf->max_tx_rings -= vf_tx_rings * num_vfs; + pf->max_rx_rings -= vf_rx_rings * num_vfs; + pf->max_cp_rings -= vf_cp_rings * num_vfs; + pf->max_rsscos_ctxs -= num_vfs; + pf->max_stat_ctxs -= vf_stat_ctx * num_vfs; + pf->max_vnics -= vf_vnics * num_vfs; }return rc; }
@@ -535,8 +536,8 @@ void bnxt_sriov_disable(struct bnxt *bp)bnxt_free_vf_resources (bp); bp->pf.active_vfs =0 ; - bp->pf.max_pf_rx_rings = bp->pf.max_rx_rings; - bp->pf.max_pf_tx_rings = bp->pf.max_tx_rings; +/* Reclaim all resources for the PF. */ +bnxt_hwrm_func_qcaps (bp); }int bnxt_sriov_configure (struct pci_dev *pdev,int num_vfs)
Signature · 1 line
1.8.3.1
PATCH 10/12 bnxt_en: Keep track of the ring group resource.
In reply to Michael ChanNewer firmware will return the ring group resource when we call hwrm_func_qcaps(). To be compatible with older firmware, use the number of tx rings as the number of ring groups if the older firmware returns 0. When determining how many rx rings we can support, take the ring group resource in account as well in _bnxt_get_max_rings(). Divide and assign the ring groups to VFs.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 11 ++++++++++- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 ++ drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 7 ++++++- 3 files changed, 18 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +10 -1
@@ -3617,6 +3617,9 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp) pf->max_cp_rings =le16_to_cpu (resp->max_cmpl_rings); pf->max_tx_rings =le16_to_cpu (resp->max_tx_rings); pf->max_rx_rings =le16_to_cpu (resp->max_rx_rings); + pf->max_hw_ring_grps =le32_to_cpu (resp->max_hw_ring_grps); +if (!pf->max_hw_ring_grps) + pf->max_hw_ring_grps = pf->max_tx_rings; pf->max_l2_ctxs =le16_to_cpu (resp->max_l2_ctxs); pf->max_vnics =le16_to_cpu (resp->max_vnics); pf->max_stat_ctxs =le16_to_cpu (resp->max_stat_ctx);
@@ -3644,6 +3647,9 @@ int bnxt_hwrm_func_qcaps(struct bnxt *bp) vf->max_cp_rings =le16_to_cpu (resp->max_cmpl_rings); vf->max_tx_rings =le16_to_cpu (resp->max_tx_rings); vf->max_rx_rings =le16_to_cpu (resp->max_rx_rings); + vf->max_hw_ring_grps =le32_to_cpu (resp->max_hw_ring_grps); +if (!vf->max_hw_ring_grps) + vf->max_hw_ring_grps = vf->max_tx_rings; vf->max_l2_ctxs =le16_to_cpu (resp->max_l2_ctxs); vf->max_vnics =le16_to_cpu (resp->max_vnics); vf->max_stat_ctxs =le16_to_cpu (resp->max_stat_ctx);
@@ -5618,25 +5624,28 @@ static int bnxt_get_max_irq(struct pci_dev *pdev)void bnxt_get_max_rings (struct bnxt *bp,int *max_rx,int *max_tx) { -int max_rings =0 ; +int max_rings =0 , max_ring_grps =0 ;if (BNXT_PF (bp)) { *max_tx = bp->pf.max_tx_rings; *max_rx = bp->pf.max_rx_rings; max_rings =min_t (int, bp->pf.max_irqs, bp->pf.max_cp_rings); max_rings =min_t (int, max_rings, bp->pf.max_stat_ctxs); + max_ring_grps = bp->pf.max_hw_ring_grps; }else {#ifdef CONFIG_BNXT_SRIOV *max_tx = bp->vf.max_tx_rings; *max_rx = bp->vf.max_rx_rings; max_rings =min_t (int, bp->vf.max_irqs, bp->vf.max_cp_rings); max_rings =min_t (int, max_rings, bp->vf.max_stat_ctxs); + max_ring_grps = bp->vf.max_hw_ring_grps;#endif }if (bp->flags &BNXT_FLAG_AGG_RINGS ) *max_rx >>=1 ; *max_rx =min_t (int, *max_rx, max_rings); + *max_rx =min_t (int, *max_rx, max_ring_grps); *max_tx =min_t (int, *max_tx, max_rings); }
drivers/net/ethernet/broadcom/bnxt/bnxt.h +2 -0
@@ -695,6 +695,7 @@ struct bnxt_vf_info {u16 max_cp_rings;u16 max_tx_rings;u16 max_rx_rings; +u16 max_hw_ring_grps;u16 max_l2_ctxs;u16 max_irqs;u16 max_vnics;
@@ -723,6 +724,7 @@ struct bnxt_pf_info {u16 max_cp_rings;u16 max_tx_rings;/* HW assigned max tx rings for this PF */ u16 max_rx_rings;/* HW assigned max rx rings for this PF */ +u16 max_hw_ring_grps;u16 max_irqs;u16 max_l2_ctxs;u16 max_vnics;
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +6 -1
@@ -367,6 +367,7 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs) {u32 rc =0 , mtu, i;u16 vf_tx_rings, vf_rx_rings, vf_cp_rings, vf_stat_ctx, vf_vnics; +u16 vf_ring_grps;struct hwrm_func_cfg_input req = {0 };struct bnxt_pf_info *pf = &bp->pf;
@@ -388,6 +389,7 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs) num_vfs; else vf_rx_rings = (pf->max_rx_rings - bp->rx_nr_rings) / num_vfs; + vf_ring_grps = (bp->pf.max_hw_ring_grps - bp->rx_nr_rings) / num_vfs; vf_tx_rings = (pf->max_tx_rings - bp->tx_nr_rings) / num_vfs; req.enables = cpu_to_le32(FUNC_CFG_REQ_ENABLES_MTU |
@@ -398,7 +400,8 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs)FUNC_CFG_REQ_ENABLES_NUM_TX_RINGS |FUNC_CFG_REQ_ENABLES_NUM_RX_RINGS |FUNC_CFG_REQ_ENABLES_NUM_L2_CTXS | - FUNC_CFG_REQ_ENABLES_NUM_VNICS); +FUNC_CFG_REQ_ENABLES_NUM_VNICS | + FUNC_CFG_REQ_ENABLES_NUM_HW_RING_GRPS); mtu = bp->dev->mtu +ETH_HLEN +ETH_FCS_LEN +VLAN_HLEN ; req.mru =cpu_to_le16 (mtu);
@@ -408,6 +411,7 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs) req.num_cmpl_rings =cpu_to_le16 (vf_cp_rings); req.num_tx_rings =cpu_to_le16 (vf_tx_rings); req.num_rx_rings =cpu_to_le16 (vf_rx_rings); + req.num_hw_ring_grps =cpu_to_le16 (vf_ring_grps); req.num_l2_ctxs =cpu_to_le16 (4 ); vf_vnics =1 ;
@@ -429,6 +433,7 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs)if (!rc) { pf->max_tx_rings -= vf_tx_rings * num_vfs; pf->max_rx_rings -= vf_rx_rings * num_vfs; + pf->max_hw_ring_grps -= vf_ring_grps * num_vfs; pf->max_cp_rings -= vf_cp_rings * num_vfs; pf->max_rsscos_ctxs -= num_vfs; pf->max_stat_ctxs -= vf_stat_ctx * num_vfs;
Signature · 1 line
1.8.3.1
PATCH 11/12 bnxt_en: Update to Firmware interface spec 1.0.0.
In reply to Michael ChanThis interface will be forward compatible with future changes.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 33 +- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 8 +- drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h | 865 +++++++++--------------- drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c | 15 +- 4 files changed, 349 insertions(+), 572 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +16 -17
@@ -2787,7 +2787,7 @@ static int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp, u16 vnic_id)struct bnxt_vnic_info *vnic = &bp->vnic_info[vnic_id];bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_CFA_L2_SET_RX_MASK ,-1 ,-1 ); - req.dflt_vnic_id =cpu_to_le32 (vnic->fw_vnic_id); + req.vnic_id =cpu_to_le32 (vnic->fw_vnic_id); req.num_mc_entries =cpu_to_le32 (vnic->mc_list_count); req.mc_tbl_addr =cpu_to_le64 (vnic->mc_list_mapping);
@@ -2820,7 +2820,7 @@ static int bnxt_hwrm_cfa_ntuple_filter_free(struct bnxt *bp, CFA_NTUPLE_FILTER_ALLOC_REQ_ENABLES_SRC_PORT_MASK | \ CFA_NTUPLE_FILTER_ALLOC_REQ_ENABLES_DST_PORT | \ CFA_NTUPLE_FILTER_ALLOC_REQ_ENABLES_DST_PORT_MASK | \ - CFA_NTUPLE_FILTER_ALLOC_REQ_ENABLES_DST_VNIC_ID) + CFA_NTUPLE_FILTER_ALLOC_REQ_ENABLES_DST_ID)static int bnxt_hwrm_cfa_ntuple_filter_alloc (struct bnxt *bp,struct bnxt_ntuple_filter *fltr)
@@ -2839,7 +2839,7 @@ static int bnxt_hwrm_cfa_ntuple_filter_alloc(struct bnxt *bp, req.ethertype =htons (ETH_P_IP );memcpy (req.src_macaddr, fltr->src_mac_addr,ETH_ALEN ); - req.ipaddr_type =4 ; + req.ip_addr_type =CFA_NTUPLE_FILTER_ALLOC_REQ_IP_ADDR_TYPE_IPV4 ; req.ip_protocol = keys->basic.ip_proto; req.src_ipaddr[0 ] = keys->addrs.v4addrs.src;
@@ -2852,7 +2852,7 @@ static int bnxt_hwrm_cfa_ntuple_filter_alloc(struct bnxt *bp, req.dst_port = keys->ports.dst; req.dst_port_mask =cpu_to_be16 (0xffff ); - req.dst_vnic_id =cpu_to_le16 (vnic->fw_vnic_id); + req.dst_id =cpu_to_le16 (vnic->fw_vnic_id);mutex_lock (&bp->hwrm_cmd_lock); rc =_hwrm_send_message (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT );if (!rc)
@@ -2872,10 +2872,10 @@ static int bnxt_hwrm_set_vnic_filter(struct bnxt *bp, u16 vnic_id, u16 idx,bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_CFA_L2_FILTER_ALLOC ,-1 ,-1 ); req.flags =cpu_to_le32 (CFA_L2_FILTER_ALLOC_REQ_FLAGS_PATH_RX |CFA_L2_FILTER_ALLOC_REQ_FLAGS_OUTERMOST ); - req.dst_vnic_id =cpu_to_le16 (bp->vnic_info[vnic_id].fw_vnic_id); + req.dst_id =cpu_to_le16 (bp->vnic_info[vnic_id].fw_vnic_id); req.enables =cpu_to_le32 (CFA_L2_FILTER_ALLOC_REQ_ENABLES_L2_ADDR | -CFA_L2_FILTER_ALLOC_REQ_ENABLES_DST_VNIC_ID | +CFA_L2_FILTER_ALLOC_REQ_ENABLES_DST_ID |CFA_L2_FILTER_ALLOC_REQ_ENABLES_L2_ADDR_MASK );memcpy (req.l2_addr, mac_addr,ETH_ALEN ); req.l2_addr_mask[0 ] =0xff ;
@@ -2945,7 +2945,8 @@ static int bnxt_hwrm_vnic_set_tpa(struct bnxt *bp, u16 vnic_id, u32 tpa_flags) req.enables =cpu_to_le32 (VNIC_TPA_CFG_REQ_ENABLES_MAX_AGG_SEGS | -VNIC_TPA_CFG_REQ_ENABLES_MAX_AGGS ); +VNIC_TPA_CFG_REQ_ENABLES_MAX_AGGS | +VNIC_TPA_CFG_REQ_ENABLES_MIN_AGG_LEN );/* Number of segs are log2 units, and first packet is not * included as part of this units.
@@ -2963,6 +2964,8 @@ static int bnxt_hwrm_vnic_set_tpa(struct bnxt *bp, u16 vnic_id, u32 tpa_flags) segs =ilog2 (nsegs); req.max_agg_segs =cpu_to_le16 (segs); req.max_aggs =cpu_to_le16 (VNIC_TPA_CFG_REQ_MAX_AGGS_MAX ); + + req.min_agg_len =cpu_to_le32 (512 ); } req.vnic_id =cpu_to_le16 (vnic->fw_vnic_id);
@@ -3726,14 +3729,11 @@ static int bnxt_hwrm_ver_get(struct bnxt *bp)memcpy (&bp->ver_resp, resp,sizeof (struct hwrm_ver_get_output )); -if (req.hwrm_intf_maj != resp->hwrm_intf_maj || - req.hwrm_intf_min != resp->hwrm_intf_min || - req.hwrm_intf_upd != resp->hwrm_intf_upd) { -netdev_warn (bp->dev,"HWRM interface %d.%d.%d does not match driver interface %d.%d.%d.\n" , +if (resp->hwrm_intf_maj <1 ) { +netdev_warn (bp->dev,"HWRM interface %d.%d.%d is older than 1.0.0.\n" , resp->hwrm_intf_maj, resp->hwrm_intf_min, - resp->hwrm_intf_upd, req.hwrm_intf_maj, - req.hwrm_intf_min, req.hwrm_intf_upd); -netdev_warn (bp->dev,"Please update driver or firmware with matching interface versions.\n" ); + resp->hwrm_intf_upd); +netdev_warn (bp->dev,"Please update firmware with HWRM interface 1.0.0 or newer.\n" ); } snprintf(bp->fw_ver_str, BC_HWRM_STR_LEN, "bc %d.%d.%d rm %d.%d.%d", resp->hwrm_fw_maj, resp->hwrm_fw_min, resp->hwrm_fw_bld,
@@ -3936,8 +3936,7 @@ static int bnxt_init_chip(struct bnxt *bp, bool irq_re_init) } bp->vnic_info[0 ].uc_filter_count =1 ; - bp->vnic_info[0 ].rx_mask =CFA_L2_SET_RX_MASK_REQ_MASK_UNICAST | -CFA_L2_SET_RX_MASK_REQ_MASK_BCAST ; + bp->vnic_info[0 ].rx_mask =CFA_L2_SET_RX_MASK_REQ_MASK_BCAST ;if ((bp->dev->flags &IFF_PROMISC ) &&BNXT_PF (bp)) bp->vnic_info[0].rx_mask |=
@@ -4343,7 +4342,7 @@ static int bnxt_update_link(struct bnxt *bp, bool chng_link_state) link_info->auto_mode = resp->auto_mode; link_info->auto_pause_setting = resp->auto_pause; link_info->force_pause_setting = resp->force_pause; - link_info->duplex_setting = resp->duplex_setting; + link_info->duplex_setting = resp->duplex;if (link_info->phy_link_status ==BNXT_LINK_LINK ) link_info->link_speed =le16_to_cpu (resp->link_speed);else
drivers/net/ethernet/broadcom/bnxt/bnxt.h +4 -4
@@ -11,11 +11,11 @@#define BNXT_H #define DRV_MODULE_NAME "bnxt_en" -#define DRV_MODULE_VERSION "0.1.24" +#define DRV_MODULE_VERSION "1.0.0" -#define DRV_VER_MAJ 0 -#define DRV_VER_MIN 1 -#define DRV_VER_UPD 24 +#define DRV_VER_MAJ 1 +#define DRV_VER_MIN 0 +#define DRV_VER_UPD 0struct tx_bd {__le32 tx_bd_len_flags_type;
drivers/net/ethernet/broadcom/bnxt/bnxt_hsi.h +320 -545
1,348 lines not on this page · raw message
drivers/net/ethernet/broadcom/bnxt/bnxt_sriov.c +9 -6
@@ -64,7 +64,7 @@ int bnxt_set_vf_spoofchk(struct net_device *dev, int vf_id, bool setting)* the spoof check should also include vlan anti-spoofing */ bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_FUNC_CFG ,-1 ,-1 ); - req.vf_id =cpu_to_le16 (vf->fw_fid); + req.fid =cpu_to_le16 (vf->fw_fid); req.flags =cpu_to_le32 (func_flags); rc =hwrm_send_message (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT );if (!rc) {
@@ -128,7 +128,7 @@ int bnxt_set_vf_mac(struct net_device *dev, int vf_id, u8 *mac)memcpy (vf->mac_addr, mac,ETH_ALEN );bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_FUNC_CFG ,-1 ,-1 ); - req.vf_id =cpu_to_le16 (vf->fw_fid); + req.fid =cpu_to_le16 (vf->fw_fid); req.flags =cpu_to_le32 (vf->func_flags); req.enables =cpu_to_le32 (FUNC_CFG_REQ_ENABLES_DFLT_MAC_ADDR );memcpy (req.dflt_mac_addr, mac,ETH_ALEN );
@@ -159,7 +159,7 @@ int bnxt_set_vf_vlan(struct net_device *dev, int vf_id, u16 vlan_id, u8 qos)return 0 ;bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_FUNC_CFG ,-1 ,-1 ); - req.vf_id =cpu_to_le16 (vf->fw_fid); + req.fid =cpu_to_le16 (vf->fw_fid); req.flags =cpu_to_le32 (vf->func_flags); req.dflt_vlan =cpu_to_le16 (vlan_tag); req.enables =cpu_to_le32 (FUNC_CFG_REQ_ENABLES_DFLT_VLAN );
@@ -198,7 +198,7 @@ int bnxt_set_vf_bw(struct net_device *dev, int vf_id, int min_tx_rate,if (min_tx_rate == vf->min_tx_rate && max_tx_rate == vf->max_tx_rate)return 0 ;bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_FUNC_CFG ,-1 ,-1 ); - req.vf_id =cpu_to_le16 (vf->fw_fid); + req.fid =cpu_to_le16 (vf->fw_fid); req.flags =cpu_to_le32 (vf->func_flags); req.enables =cpu_to_le32 (FUNC_CFG_REQ_ENABLES_MAX_BW ); req.max_bw =cpu_to_le32 (max_tx_rate);
@@ -421,13 +421,13 @@ static int bnxt_hwrm_func_cfg(struct bnxt *bp, int num_vfs)mutex_lock (&bp->hwrm_cmd_lock);for (i =0 ; i < num_vfs; i++) { - req.vf_id =cpu_to_le16 (pf->first_vf_id + i); + req.fid =cpu_to_le16 (pf->first_vf_id + i); rc =_hwrm_send_message (bp, &req,sizeof (req),HWRM_CMD_TIMEOUT );if (rc)break ; pf->active_vfs = i +1 ; - pf->vf[i].fw_fid =le16_to_cpu (req.vf_id); + pf->vf[i].fw_fid =le16_to_cpu (req.fid); }mutex_unlock (&bp->hwrm_cmd_lock);if (!rc) {
@@ -600,6 +600,7 @@ static int bnxt_hwrm_fwd_resp(struct bnxt *bp, struct bnxt_vf_info *vf,/* Set the new target id */ req.target_id =cpu_to_le16 (vf->fw_fid); + req.encap_resp_target_id =cpu_to_le16 (vf->fw_fid); req.encap_resp_len =cpu_to_le16 (msg_size); req.encap_resp_addr = encap_resp_addr; req.encap_resp_cmpl_ring = encap_resp_cpr;
@@ -634,6 +635,7 @@ static int bnxt_hwrm_fwd_err_resp(struct bnxt *bp, struct bnxt_vf_info *vf,bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_REJECT_FWD_RESP ,-1 ,-1 );/* Set the new target id */ req.target_id =cpu_to_le16 (vf->fw_fid); + req.encap_resp_target_id =cpu_to_le16 (vf->fw_fid);memcpy (req.encap_request, vf->hwrm_cmd_req_addr, msg_size);mutex_lock (&bp->hwrm_cmd_lock);
@@ -665,6 +667,7 @@ static int bnxt_hwrm_exec_fwd_resp(struct bnxt *bp, struct bnxt_vf_info *vf,bnxt_hwrm_cmd_hdr_init (bp, &req,HWRM_EXEC_FWD_RESP ,-1 ,-1 );/* Set the new target id */ req.target_id =cpu_to_le16 (vf->fw_fid); + req.encap_resp_target_id =cpu_to_le16 (vf->fw_fid);memcpy (req.encap_request, vf->hwrm_cmd_req_addr, msg_size);mutex_lock (&bp->hwrm_cmd_lock);
Signature · 1 line
1.8.3.1
PATCH 12/12 bnxt_en: Add BCM57301 & BCM57402 devices.
In reply to Michael ChanFrom: David Christensen <[email protected]>
Added the PCI IDs for the BCM57301 and BCM57402 controllers.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +8 -2
@@ -72,8 +72,10 @@ MODULE_VERSION(DRV_MODULE_VERSION);#define BNXT_TX_PUSH_THRESH 92enum board_idx { +BCM57301 ,BCM57302 ,BCM57304 , +BCM57402 ,BCM57404 ,BCM57406 ,BCM57304_VF ,
@@ -84,17 +86,21 @@ enum board_idx {static const struct {char *name; } board_info[] = { - {"Broadcom BCM57302 NetXtreme-C Single-port 10Gb/25Gb/40Gb/50Gb Ethernet" }, + {"Broadcom BCM57301 NetXtreme-C Single-port 10Gb Ethernet" }, + {"Broadcom BCM57302 NetXtreme-C Dual-port 10Gb/25Gb Ethernet" }, {"Broadcom BCM57304 NetXtreme-C Dual-port 10Gb/25Gb/40Gb/50Gb Ethernet" }, + {"Broadcom BCM57402 NetXtreme-E Dual-port 10Gb Ethernet" }, {"Broadcom BCM57404 NetXtreme-E Dual-port 10Gb/25Gb Ethernet" }, - {"Broadcom BCM57406 NetXtreme-E Dual-port 10Gb Ethernet" }, + {"Broadcom BCM57406 NetXtreme-E Dual-port 10GBase-T Ethernet" }, {"Broadcom BCM57304 NetXtreme-C Ethernet Virtual Function" }, {"Broadcom BCM57404 NetXtreme-E Ethernet Virtual Function" }, };static const struct pci_device_id bnxt_pci_tbl[] = { + {PCI_VDEVICE (BROADCOM ,0x16c8 ), .driver_data =BCM57301 }, {PCI_VDEVICE (BROADCOM ,0x16c9 ), .driver_data =BCM57302 }, {PCI_VDEVICE (BROADCOM ,0x16ca ), .driver_data =BCM57304 }, + {PCI_VDEVICE (BROADCOM ,0x16d0 ), .driver_data =BCM57402 }, {PCI_VDEVICE (BROADCOM ,0x16d1 ), .driver_data =BCM57404 }, {PCI_VDEVICE (BROADCOM ,0x16d2 ), .driver_data =BCM57406 }, #ifdef CONFIG_BNXT_SRIOV
Signature · 1 line
1.8.3.1
David Miller
maintainerFrom: Michael Chan <[email protected]>
Date: Sun, 27 Dec 2015 18:19:17 -0500
Quoted 2 lines
Mainly clean-ups, optimizations, and updating to the latest firmware interface spec.
Series applied, thanks Michael.