aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/broadcom
diff options
context:
space:
mode:
authorDmitry Kravkov <dmitry@broadcom.com>2013-04-23 21:45:00 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-24 16:33:53 -0400
commitf8f4f61a5a358841c5acf144f6fa13a6b475ec2c (patch)
treea356155092e8ca681a6af64bdfee042c3f9a0e96 /drivers/net/ethernet/broadcom
parentba35a0fd1ff7b5e91a6eee145e56887edffa194c (diff)
bnx2x: Enhance MAC configuration for VFs
Improved support for adding/removing vf mac addresses. This includes the case where HyperVisor forced the address (sampled from bulletin board), and the case where it did not in which the VF can configure its own mac address. Signed-off-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: Ariel Elior <ariele@broadcom.com> Signed-off-by: Yuval Mintz <yuvalmin@broadcom.com> Signed-off-by: Eilon Greenstein <eilong@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/broadcom')
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c3
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c18
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.h5
-rw-r--r--drivers/net/ethernet/broadcom/bnx2x/bnx2x_vfpf.c19
4 files changed, 30 insertions, 15 deletions
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
index 5a815ce7dee0..e8ed78f64007 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c
@@ -2664,7 +2664,8 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
2664 if (IS_PF(bp)) 2664 if (IS_PF(bp))
2665 rc = bnx2x_set_eth_mac(bp, true); 2665 rc = bnx2x_set_eth_mac(bp, true);
2666 else /* vf */ 2666 else /* vf */
2667 rc = bnx2x_vfpf_set_mac(bp); 2667 rc = bnx2x_vfpf_config_mac(bp, bp->dev->dev_addr, bp->fp->index,
2668 true);
2668 if (rc) { 2669 if (rc) {
2669 BNX2X_ERR("Setting Ethernet MAC failed\n"); 2670 BNX2X_ERR("Setting Ethernet MAC failed\n");
2670 LOAD_ERROR_EXIT(bp, load_error3); 2671 LOAD_ERROR_EXIT(bp, load_error3);
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 86d13870399e..a46bc720b992 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -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)
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 */