aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2013-04-24 16:34:00 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-24 16:34:09 -0400
commit01f27fc085574b301248d4da241e9d5ebd61e5c9 (patch)
tree93bf76c9038844f3ac4eda0ce650915e5e06e3b6
parent0996076973856e093c84ed870501fb9d5c72f8a3 (diff)
parent70632d0afe749c44562c1112eea0839774bcf578 (diff)
Merge branch 'bnx2x'
Yuval Mintz says: ==================== This patch series contains several enhancements, as well as small fixes: - Patch [1/5] - Prevent a theoretical problem in our GRO implementation. - Patch [2/5] - Support Rx/Tx pause control configuration in autoneg. - Patch [3/5] - Enhance support for VF's MAC setting and removal. - Patch [4/5] - Fix a small memory leak between bnx2x and cnic. - Patch [5/5] - Allow bnx2x to recover after a second slot reset. Please consider applying these patches to `net-next'. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c21
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c5
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c14
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c23
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h5
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c19
6 files changed, 59 insertions, 28 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index d72bd8c40aa1..fd20a4ff0150 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -642,6 +642,14 @@ static void bnx2x_gro_ipv6_csum(struct bnx2x *bp, struct sk_buff *skb)
642 th->check = ~tcp_v6_check(skb->len - skb_transport_offset(skb), 642 th->check = ~tcp_v6_check(skb->len - skb_transport_offset(skb),
643 &iph->saddr, &iph->daddr, 0); 643 &iph->saddr, &iph->daddr, 0);
644} 644}
645
646static void bnx2x_gro_csum(struct bnx2x *bp, struct sk_buff *skb,
647 void (*gro_func)(struct bnx2x*, struct sk_buff*))
648{
649 skb_set_network_header(skb, 0);
650 gro_func(bp, skb);
651 tcp_gro_complete(skb);
652}
645#endif 653#endif
646 654
647static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp, 655static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp,
@@ -649,19 +657,17 @@ static void bnx2x_gro_receive(struct bnx2x *bp, struct bnx2x_fastpath *fp,
649{ 657{
650#ifdef CONFIG_INET 658#ifdef CONFIG_INET
651 if (skb_shinfo(skb)->gso_size) { 659 if (skb_shinfo(skb)->gso_size) {
652 skb_set_network_header(skb, 0);
653 switch (be16_to_cpu(skb->protocol)) { 660 switch (be16_to_cpu(skb->protocol)) {
654 case ETH_P_IP: 661 case ETH_P_IP:
655 bnx2x_gro_ip_csum(bp, skb); 662 bnx2x_gro_csum(bp, skb, bnx2x_gro_ip_csum);
656 break; 663 break;
657 case ETH_P_IPV6: 664 case ETH_P_IPV6:
658 bnx2x_gro_ipv6_csum(bp, skb); 665 bnx2x_gro_csum(bp, skb, bnx2x_gro_ipv6_csum);
659 break; 666 break;
660 default: 667 default:
661 BNX2X_ERR("FW GRO supports only IPv4/IPv6, not 0x%04x\n", 668 BNX2X_ERR("Error: FW GRO supports only IPv4/IPv6, not 0x%04x\n",
662 be16_to_cpu(skb->protocol)); 669 be16_to_cpu(skb->protocol));
663 } 670 }
664 tcp_gro_complete(skb);
665 } 671 }
666#endif 672#endif
667 napi_gro_receive(&fp->napi, skb); 673 napi_gro_receive(&fp->napi, skb);
@@ -2658,7 +2664,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
2658 if (IS_PF(bp)) 2664 if (IS_PF(bp))
2659 rc = bnx2x_set_eth_mac(bp, true); 2665 rc = bnx2x_set_eth_mac(bp, true);
2660 else /* vf */ 2666 else /* vf */
2661 rc = bnx2x_vfpf_set_mac(bp); 2667 rc = bnx2x_vfpf_config_mac(bp, bp->dev->dev_addr, bp->fp->index,
2668 true);
2662 if (rc) { 2669 if (rc) {
2663 BNX2X_ERR("Setting Ethernet MAC failed\n"); 2670 BNX2X_ERR("Setting Ethernet MAC failed\n");
2664 LOAD_ERROR_EXIT(bp, load_error3); 2671 LOAD_ERROR_EXIT(bp, load_error3);
@@ -2927,9 +2934,9 @@ int bnx2x_nic_unload(struct bnx2x *bp, int unload_mode, bool keep_link)
2927 bnx2x_free_fp_mem_cnic(bp); 2934 bnx2x_free_fp_mem_cnic(bp);
2928 2935
2929 if (IS_PF(bp)) { 2936 if (IS_PF(bp)) {
2930 bnx2x_free_mem(bp);
2931 if (CNIC_LOADED(bp)) 2937 if (CNIC_LOADED(bp))
2932 bnx2x_free_mem_cnic(bp); 2938 bnx2x_free_mem_cnic(bp);
2939 bnx2x_free_mem(bp);
2933 } 2940 }
2934 bp->state = BNX2X_STATE_CLOSED; 2941 bp->state = BNX2X_STATE_CLOSED;
2935 bp->cnic_loaded = false; 2942 bp->cnic_loaded = false;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
index 88e9b47a3eb6..397537bb4448 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_ethtool.c
@@ -1889,12 +1889,15 @@ static int bnx2x_set_pauseparam(struct net_device *dev,
1889 bp->link_params.req_flow_ctrl[cfg_idx] = 1889 bp->link_params.req_flow_ctrl[cfg_idx] =
1890 BNX2X_FLOW_CTRL_AUTO; 1890 BNX2X_FLOW_CTRL_AUTO;
1891 } 1891 }
1892 bp->link_params.req_fc_auto_adv = BNX2X_FLOW_CTRL_NONE; 1892 bp->link_params.req_fc_auto_adv = 0;
1893 if (epause->rx_pause) 1893 if (epause->rx_pause)
1894 bp->link_params.req_fc_auto_adv |= BNX2X_FLOW_CTRL_RX; 1894 bp->link_params.req_fc_auto_adv |= BNX2X_FLOW_CTRL_RX;
1895 1895
1896 if (epause->tx_pause) 1896 if (epause->tx_pause)
1897 bp->link_params.req_fc_auto_adv |= BNX2X_FLOW_CTRL_TX; 1897 bp->link_params.req_fc_auto_adv |= BNX2X_FLOW_CTRL_TX;
1898
1899 if (!bp->link_params.req_fc_auto_adv)
1900 bp->link_params.req_fc_auto_adv |= BNX2X_FLOW_CTRL_NONE;
1898 } 1901 }
1899 1902
1900 DP(BNX2X_MSG_ETHTOOL, 1903 DP(BNX2X_MSG_ETHTOOL,
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
index 40f58d73de78..9d64b988ab34 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_link.c
@@ -3426,13 +3426,19 @@ static void bnx2x_calc_ieee_aneg_adv(struct bnx2x_phy *phy,
3426 3426
3427 switch (phy->req_flow_ctrl) { 3427 switch (phy->req_flow_ctrl) {
3428 case BNX2X_FLOW_CTRL_AUTO: 3428 case BNX2X_FLOW_CTRL_AUTO:
3429 if (params->req_fc_auto_adv == BNX2X_FLOW_CTRL_BOTH) 3429 switch (params->req_fc_auto_adv) {
3430 case BNX2X_FLOW_CTRL_BOTH:
3430 *ieee_fc |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH; 3431 *ieee_fc |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_BOTH;
3431 else 3432 break;
3433 case BNX2X_FLOW_CTRL_RX:
3434 case BNX2X_FLOW_CTRL_TX:
3432 *ieee_fc |= 3435 *ieee_fc |=
3433 MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC; 3436 MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC;
3437 break;
3438 default:
3439 break;
3440 }
3434 break; 3441 break;
3435
3436 case BNX2X_FLOW_CTRL_TX: 3442 case BNX2X_FLOW_CTRL_TX:
3437 *ieee_fc |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC; 3443 *ieee_fc |= MDIO_COMBO_IEEE0_AUTO_NEG_ADV_PAUSE_ASYMMETRIC;
3438 break; 3444 break;
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 86d13870399e..fbfff1b3365e 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -7786,7 +7786,7 @@ int bnx2x_alloc_mem_cnic(struct bnx2x *bp)
7786 sizeof(struct 7786 sizeof(struct
7787 host_hc_status_block_e1x)); 7787 host_hc_status_block_e1x));
7788 7788
7789 if (CONFIGURE_NIC_MODE(bp)) 7789 if (CONFIGURE_NIC_MODE(bp) && !bp->t2)
7790 /* allocate searcher T2 table, as it wan't allocated before */ 7790 /* allocate searcher T2 table, as it wan't allocated before */
7791 BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ); 7791 BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ);
7792 7792
@@ -7809,7 +7809,7 @@ int bnx2x_alloc_mem(struct bnx2x *bp)
7809{ 7809{
7810 int i, allocated, context_size; 7810 int i, allocated, context_size;
7811 7811
7812 if (!CONFIGURE_NIC_MODE(bp)) 7812 if (!CONFIGURE_NIC_MODE(bp) && !bp->t2)
7813 /* allocate searcher T2 table */ 7813 /* allocate searcher T2 table */
7814 BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ); 7814 BNX2X_PCI_ALLOC(bp->t2, &bp->t2_mapping, SRC_T2_SZ);
7815 7815
@@ -7930,8 +7930,6 @@ int bnx2x_del_all_macs(struct bnx2x *bp,
7930 7930
7931int bnx2x_set_eth_mac(struct bnx2x *bp, bool set) 7931int bnx2x_set_eth_mac(struct bnx2x *bp, bool set)
7932{ 7932{
7933 unsigned long ramrod_flags = 0;
7934
7935 if (is_zero_ether_addr(bp->dev->dev_addr) && 7933 if (is_zero_ether_addr(bp->dev->dev_addr) &&
7936 (IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp))) { 7934 (IS_MF_STORAGE_SD(bp) || IS_MF_FCOE_AFEX(bp))) {
7937 DP(NETIF_MSG_IFUP | NETIF_MSG_IFDOWN, 7935 DP(NETIF_MSG_IFUP | NETIF_MSG_IFDOWN,
@@ -7939,12 +7937,18 @@ int bnx2x_set_eth_mac(struct bnx2x *bp, bool set)
7939 return 0; 7937 return 0;
7940 } 7938 }
7941 7939
7942 DP(NETIF_MSG_IFUP, "Adding Eth MAC\n"); 7940 if (IS_PF(bp)) {
7941 unsigned long ramrod_flags = 0;
7943 7942
7944 __set_bit(RAMROD_COMP_WAIT, &ramrod_flags); 7943 DP(NETIF_MSG_IFUP, "Adding Eth MAC\n");
7945 /* Eth MAC is set on RSS leading client (fp[0]) */ 7944 __set_bit(RAMROD_COMP_WAIT, &ramrod_flags);
7946 return bnx2x_set_mac_one(bp, bp->dev->dev_addr, &bp->sp_objs->mac_obj, 7945 return bnx2x_set_mac_one(bp, bp->dev->dev_addr,
7947 set, BNX2X_ETH_MAC, &ramrod_flags); 7946 &bp->sp_objs->mac_obj, set,
7947 BNX2X_ETH_MAC, &ramrod_flags);
7948 } else { /* vf */
7949 return bnx2x_vfpf_config_mac(bp, bp->dev->dev_addr,
7950 bp->fp->index, true);
7951 }
7948} 7952}
7949 7953
7950int bnx2x_setup_leading(struct bnx2x *bp) 7954int bnx2x_setup_leading(struct bnx2x *bp)
@@ -12803,6 +12807,7 @@ static pci_ers_result_t bnx2x_io_slot_reset(struct pci_dev *pdev)
12803 12807
12804 pci_set_master(pdev); 12808 pci_set_master(pdev);
12805 pci_restore_state(pdev); 12809 pci_restore_state(pdev);
12810 pci_save_state(pdev);
12806 12811
12807 if (netif_running(dev)) 12812 if (netif_running(dev))
12808 bnx2x_set_power_state(bp, PCI_D0); 12813 bnx2x_set_power_state(bp, PCI_D0);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
index d4b17b7a774e..d67ddc554c0f 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h
@@ -733,7 +733,7 @@ int bnx2x_vfpf_init(struct bnx2x *bp);
733void bnx2x_vfpf_close_vf(struct bnx2x *bp); 733void bnx2x_vfpf_close_vf(struct bnx2x *bp);
734int bnx2x_vfpf_setup_q(struct bnx2x *bp, int fp_idx); 734int bnx2x_vfpf_setup_q(struct bnx2x *bp, int fp_idx);
735int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx); 735int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx);
736int bnx2x_vfpf_set_mac(struct bnx2x *bp); 736int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, u8 vf_qid, bool set);
737int bnx2x_vfpf_set_mcast(struct net_device *dev); 737int bnx2x_vfpf_set_mcast(struct net_device *dev);
738int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp); 738int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp);
739 739
@@ -794,7 +794,8 @@ static inline int bnx2x_vfpf_init(struct bnx2x *bp) {return 0; }
794static inline void bnx2x_vfpf_close_vf(struct bnx2x *bp) {} 794static inline void bnx2x_vfpf_close_vf(struct bnx2x *bp) {}
795static inline int bnx2x_vfpf_setup_q(struct bnx2x *bp, int fp_idx) {return 0; } 795static inline int bnx2x_vfpf_setup_q(struct bnx2x *bp, int fp_idx) {return 0; }
796static inline int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx) {return 0; } 796static inline int bnx2x_vfpf_teardown_queue(struct bnx2x *bp, int qidx) {return 0; }
797static inline int bnx2x_vfpf_set_mac(struct bnx2x *bp) {return 0; } 797static inline int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr,
798 u8 vf_qid, bool set) {return 0; }
798static inline int bnx2x_vfpf_set_mcast(struct net_device *dev) {return 0; } 799static inline int bnx2x_vfpf_set_mcast(struct net_device *dev) {return 0; }
799static inline int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp) {return 0; } 800static inline int bnx2x_vfpf_storm_rx_mode(struct bnx2x *bp) {return 0; }
800static inline int bnx2x_iov_nic_init(struct bnx2x *bp) {return 0; } 801static inline int bnx2x_iov_nic_init(struct bnx2x *bp) {return 0; }
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
index 90fbf9cc2c2c..928b074d7d80 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c
@@ -406,6 +406,9 @@ void bnx2x_vfpf_close_vf(struct bnx2x *bp)
406 for_each_queue(bp, i) 406 for_each_queue(bp, i)
407 bnx2x_vfpf_teardown_queue(bp, i); 407 bnx2x_vfpf_teardown_queue(bp, i);
408 408
409 /* remove mac */
410 bnx2x_vfpf_config_mac(bp, bp->dev->dev_addr, bp->fp->index, false);
411
409 /* clear mailbox and prep first tlv */ 412 /* clear mailbox and prep first tlv */
410 bnx2x_vfpf_prep(bp, &req->first_tlv, CHANNEL_TLV_CLOSE, sizeof(*req)); 413 bnx2x_vfpf_prep(bp, &req->first_tlv, CHANNEL_TLV_CLOSE, sizeof(*req));
411 414
@@ -561,10 +564,11 @@ out:
561} 564}
562 565
563/* request pf to add a mac for the vf */ 566/* request pf to add a mac for the vf */
564int bnx2x_vfpf_set_mac(struct bnx2x *bp) 567int bnx2x_vfpf_config_mac(struct bnx2x *bp, u8 *addr, u8 vf_qid, bool set)
565{ 568{
566 struct vfpf_set_q_filters_tlv *req = &bp->vf2pf_mbox->req.set_q_filters; 569 struct vfpf_set_q_filters_tlv *req = &bp->vf2pf_mbox->req.set_q_filters;
567 struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp; 570 struct pfvf_general_resp_tlv *resp = &bp->vf2pf_mbox->resp.general_resp;
571 struct pf_vf_bulletin_content bulletin = bp->pf2vf_bulletin->content;
568 int rc = 0; 572 int rc = 0;
569 573
570 /* clear mailbox and prep first tlv */ 574 /* clear mailbox and prep first tlv */
@@ -572,16 +576,18 @@ int bnx2x_vfpf_set_mac(struct bnx2x *bp)
572 sizeof(*req)); 576 sizeof(*req));
573 577
574 req->flags = VFPF_SET_Q_FILTERS_MAC_VLAN_CHANGED; 578 req->flags = VFPF_SET_Q_FILTERS_MAC_VLAN_CHANGED;
575 req->vf_qid = 0; 579 req->vf_qid = vf_qid;
576 req->n_mac_vlan_filters = 1; 580 req->n_mac_vlan_filters = 1;
577 req->filters[0].flags = 581
578 VFPF_Q_FILTER_DEST_MAC_VALID | VFPF_Q_FILTER_SET_MAC; 582 req->filters[0].flags = VFPF_Q_FILTER_DEST_MAC_VALID;
583 if (set)
584 req->filters[0].flags |= VFPF_Q_FILTER_SET_MAC;
579 585
580 /* sample bulletin board for new mac */ 586 /* sample bulletin board for new mac */
581 bnx2x_sample_bulletin(bp); 587 bnx2x_sample_bulletin(bp);
582 588
583 /* copy mac from device to request */ 589 /* copy mac from device to request */
584 memcpy(req->filters[0].mac, bp->dev->dev_addr, ETH_ALEN); 590 memcpy(req->filters[0].mac, addr, ETH_ALEN);
585 591
586 /* add list termination tlv */ 592 /* add list termination tlv */
587 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, CHANNEL_TLV_LIST_END, 593 bnx2x_add_tlv(bp, req, req->first_tlv.tl.length, CHANNEL_TLV_LIST_END,
@@ -602,6 +608,9 @@ int bnx2x_vfpf_set_mac(struct bnx2x *bp)
602 DP(BNX2X_MSG_IOV, 608 DP(BNX2X_MSG_IOV,
603 "vfpf SET MAC failed. Check bulletin board for new posts\n"); 609 "vfpf SET MAC failed. Check bulletin board for new posts\n");
604 610
611 /* copy mac from bulletin to device */
612 memcpy(bp->dev->dev_addr, bulletin.mac, ETH_ALEN);
613
605 /* check if bulletin board was updated */ 614 /* check if bulletin board was updated */
606 if (bnx2x_sample_bulletin(bp) == PFVF_BULLETIN_UPDATED) { 615 if (bnx2x_sample_bulletin(bp) == PFVF_BULLETIN_UPDATED) {
607 /* copy mac from device to request */ 616 /* copy mac from device to request */