Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 290217
b: refs/heads/master
c: b476583
h: refs/heads/master
i:
  290215: d103bbb
v: v3
  • Loading branch information
Roopa Prabhu authored and David S. Miller committed Feb 20, 2012
1 parent 5e98bae commit 8fb115f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: d6c81bc6dca768dff1a3f127beee11e8102669a7
refs/heads/master: b476583354fc62cae433eb24d4027597c03be4c9
2 changes: 1 addition & 1 deletion trunk/drivers/net/ethernet/cisco/enic/enic.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

#define DRV_NAME "enic"
#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver"
#define DRV_VERSION "2.1.1.36"
#define DRV_VERSION "2.1.1.37"
#define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc"

#define ENIC_BARS_MAX 6
Expand Down
37 changes: 29 additions & 8 deletions trunk/drivers/net/ethernet/cisco/enic/enic_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1070,8 +1070,17 @@ static int enic_set_vf_mac(struct net_device *netdev, int vf, u8 *mac)
return err;

if (is_valid_ether_addr(mac)) {
memcpy(pp->vf_mac, mac, ETH_ALEN);
return 0;
if (vf == PORT_SELF_VF) {
memcpy(pp->vf_mac, mac, ETH_ALEN);
return 0;
} else {
/*
* For sriov vf's set the mac in hw
*/
ENIC_DEVCMD_PROXY_BY_INDEX(vf, err, enic,
vnic_dev_set_mac_addr, mac);
return enic_dev_status_to_errno(err);
}
} else
return -EINVAL;
}
Expand Down Expand Up @@ -1115,12 +1124,23 @@ static int enic_set_vf_port(struct net_device *netdev, int vf,
nla_data(port[IFLA_PORT_HOST_UUID]), PORT_UUID_MAX);
}

/* Special case handling: mac came from IFLA_VF_MAC */
if (!is_zero_ether_addr(prev_pp.vf_mac))
memcpy(pp->mac_addr, prev_pp.vf_mac, ETH_ALEN);
if (vf == PORT_SELF_VF) {
/* Special case handling: mac came from IFLA_VF_MAC */
if (!is_zero_ether_addr(prev_pp.vf_mac))
memcpy(pp->mac_addr, prev_pp.vf_mac, ETH_ALEN);

if (vf == PORT_SELF_VF && is_zero_ether_addr(netdev->dev_addr))
eth_hw_addr_random(netdev);
if (is_zero_ether_addr(netdev->dev_addr))
eth_hw_addr_random(netdev);
} else {
/* SR-IOV VF: get mac from adapter */
ENIC_DEVCMD_PROXY_BY_INDEX(vf, err, enic,
vnic_dev_get_mac_addr, pp->mac_addr);
if (err) {
netdev_err(netdev, "Error getting mac for vf %d\n", vf);
memcpy(pp, &prev_pp, sizeof(*pp));
return enic_dev_status_to_errno(err);
}
}

err = enic_process_set_pp_request(enic, vf, &prev_pp, &restore_pp);
if (err) {
Expand Down Expand Up @@ -1148,7 +1168,8 @@ static int enic_set_vf_port(struct net_device *netdev, int vf,
}
}

memset(pp->vf_mac, 0, ETH_ALEN);
if (vf == PORT_SELF_VF)
memset(pp->vf_mac, 0, ETH_ALEN);

return err;
}
Expand Down

0 comments on commit 8fb115f

Please sign in to comment.