enic: updates to version 2.1.1.38
Subsystems (3)
cover enic: updates to version 2.1.1.38
This patch series implements the following enic driver sriov related updates:
01/4 - enic: rename CMD_MAC_ADDR to CMD_SET_MAC_ADDR
02/4 - enic: Add new fw devcmd to set mac address of an interface 03/4 - enic: Fix ndo_set_vf_mac and ndo_set_vf_port to set/get the sriov vf's mac 04/4 - enic: Add support for fw init command on sriov vf's
PATCH 1/4 enic: rename CMD_MAC_ADDR to CMD_GET_MAC_ADDR
From: Roopa Prabhu <[email protected]>
firmware devcmd CMD_MAC_ADDR gets the mac address of a vnic from adapter. This patch renames it to CMD_GET_MAC_ADDR more appropriately.
--- drivers/net/ethernet/cisco/enic/enic_res.c | 2 +- drivers/net/ethernet/cisco/enic/vnic_dev.c | 6 +++--- drivers/net/ethernet/cisco/enic/vnic_dev.h | 2 +- drivers/net/ethernet/cisco/enic/vnic_devcmd.h | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/ethernet/cisco/enic/enic_res.c +1 -1
@@ -44,7 +44,7 @@ int enic_get_vnic_config(struct enic *enic)struct vnic_enet_config *c = &enic->config;int err; - err =vnic_dev_mac_addr (enic->vdev, enic->mac_addr); + err =vnic_dev_get_mac_addr (enic->vdev, enic->mac_addr);if (err) {dev_err (enic_get_dev (enic),"Error getting MAC addr, %d\n" , err);
drivers/net/ethernet/cisco/enic/vnic_dev.c +3 -3
@@ -613,7 +613,7 @@ int vnic_dev_hang_notify(struct vnic_dev *vdev)return vnic_dev_cmd (vdev,CMD_HANG_NOTIFY , &a0, &a1, wait); } -int vnic_dev_mac_addr (struct vnic_dev *vdev,u8 *mac_addr) +int vnic_dev_get_mac_addr (struct vnic_dev *vdev,u8 *mac_addr) {u64 a0, a1;int wait =1000 ;
@@ -622,7 +622,7 @@ int vnic_dev_mac_addr(struct vnic_dev *vdev, u8 *mac_addr)for (i =0 ; i <ETH_ALEN ; i++) mac_addr[i] =0 ; - err =vnic_dev_cmd (vdev,CMD_MAC_ADDR , &a0, &a1, wait); + err =vnic_dev_cmd (vdev,CMD_GET_MAC_ADDR , &a0, &a1, wait);if (err)return err;
@@ -803,7 +803,7 @@ int vnic_dev_init(struct vnic_dev *vdev, int arg)/* Emulate these for old CMD_INIT_v1 which * didn't pass a0 so no CMD_INITF_*. */ -vnic_dev_cmd (vdev,CMD_MAC_ADDR , &a0, &a1, wait); +vnic_dev_cmd (vdev,CMD_GET_MAC_ADDR , &a0, &a1, wait);vnic_dev_cmd (vdev,CMD_ADDR_ADD , &a0, &a1, wait); } }
drivers/net/ethernet/cisco/enic/vnic_dev.h +1 -1
@@ -97,7 +97,7 @@ int vnic_dev_packet_filter(struct vnic_dev *vdev, int directed, int multicast, int broadcast, int promisc, int allmulti);int vnic_dev_add_addr (struct vnic_dev *vdev,u8 *addr);int vnic_dev_del_addr (struct vnic_dev *vdev,u8 *addr); -int vnic_dev_mac_addr (struct vnic_dev *vdev,u8 *mac_addr); +int vnic_dev_get_mac_addr (struct vnic_dev *vdev,u8 *mac_addr);int vnic_dev_notify_set (struct vnic_dev *vdev,u16 intr);int vnic_dev_notify_unset (struct vnic_dev *vdev);int vnic_dev_link_status (struct vnic_dev *vdev);
drivers/net/ethernet/cisco/enic/vnic_devcmd.h +1 -1
@@ -131,7 +131,7 @@ enum vnic_devcmd_cmd {CMD_HANG_NOTIFY =_CMDC (_CMD_DIR_NONE, _CMD_VTYPE_ALL,8 ),/* MAC address in (u48)a0 */ -CMD_MAC_ADDR =_CMDC (_CMD_DIR_READ, +CMD_GET_MAC_ADDR =_CMDC (_CMD_DIR_READ, _CMD_VTYPE_ENET | _CMD_VTYPE_FC, 9),/* add addr from (u48)a0 */
PATCH 2/4 enic: Add new fw devcmd to set mac address of an interface
In reply to Roopa PrabhuFrom: Roopa Prabhu <[email protected]>
This patch adds a new devcmd CMD_SET_MAC_ADDR to set the mac address of an interface.
--- drivers/net/ethernet/cisco/enic/enic.h | 2 +- drivers/net/ethernet/cisco/enic/vnic_dev.c | 12 ++++++++++++ drivers/net/ethernet/cisco/enic/vnic_dev.h | 1 + drivers/net/ethernet/cisco/enic/vnic_devcmd.h | 9 +++++++++ 4 files changed, 23 insertions(+), 1 deletions(-)
drivers/net/ethernet/cisco/enic/enic.h +1 -1
@@ -32,7 +32,7 @@#define DRV_NAME "enic"#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" -#define DRV_VERSION "2.1.1.35" +#define DRV_VERSION "2.1.1.36"#define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc"#define ENIC_BARS_MAX 6
drivers/net/ethernet/cisco/enic/vnic_dev.c +12 -0
@@ -1023,3 +1023,15 @@ int vnic_dev_deinit_done(struct vnic_dev *vdev, int *status) {return vnic_dev_cmd_status (vdev,CMD_DEINIT , status); } + +int vnic_dev_set_mac_addr (struct vnic_dev *vdev,u8 *mac_addr) +{ +u64 a0, a1; +int wait =1000 ; +int i; + +for (i =0 ; i <ETH_ALEN ; i++) + ((u8 *)&a0)[i] = mac_addr[i]; + +return vnic_dev_cmd (vdev,CMD_SET_MAC_ADDR , &a0, &a1, wait); +}
drivers/net/ethernet/cisco/enic/vnic_dev.h +1 -0
@@ -131,5 +131,6 @@ int vnic_dev_init_prov2(struct vnic_dev *vdev, u8 *buf, u32 len);int vnic_dev_enable2 (struct vnic_dev *vdev,int active);int vnic_dev_enable2_done (struct vnic_dev *vdev,int *status);int vnic_dev_deinit_done (struct vnic_dev *vdev,int *status); +int vnic_dev_set_mac_addr (struct vnic_dev *vdev,u8 *mac_addr);#endif /* _VNIC_DEV_H_ */
drivers/net/ethernet/cisco/enic/vnic_devcmd.h +9 -0
@@ -337,6 +337,15 @@ enum vnic_devcmd_cmd {* (u32)a2 = maximum timer value in usec */ CMD_INTR_COAL_CONVERT =_CMDC (_CMD_DIR_READ, _CMD_VTYPE_ALL,50 ), + +/* +* cmd_set_mac_addr +* set mac address +* in: +* (u48)a0 = mac addr +* +*/ + CMD_SET_MAC_ADDR = _CMDC(_CMD_DIR_WRITE, _CMD_VTYPE_ENET, 55), };/* CMD_ENABLE2 flags */
PATCH 3/4 enic: Fix ndo_set_vf_mac and ndo_set_vf_port to set/get the sriov vf's mac
In reply to Roopa PrabhuFrom: Roopa Prabhu <[email protected]>
This patch fixes the ndo_set_vf_mac netdev op to set the sriov vf mac in adapter using the new fw devcmd CMD_SET_MAC_ADDR. During port profile associate the pf driver gets the vf mac using CMD_GET_MAC_ADDR.
--- drivers/net/ethernet/cisco/enic/enic.h | 2 + drivers/net/ethernet/cisco/enic/enic_main.c | 37 +++++++++++++++++++++------ 2 files changed, 30 insertions(+), 9 deletions(-)
drivers/net/ethernet/cisco/enic/enic.h +1 -1
@@ -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
drivers/net/ethernet/cisco/enic/enic_main.c +29 -8
@@ -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 ; }
@@ -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) {
@@ -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; }
PATCH 4/4 enic: Add support for fw init command on sriov vf's
In reply to Roopa PrabhuFrom: Roopa Prabhu <[email protected]>
This patch fixes enic_probe to do a fw init devcmd for sriov vfs. This enables vf driver in the guest to get into adapter init state without having to explicitly issue an init fw cmd with portprofile info. But a successful init on the vf will require the port profile information to be pre-provisioned by the hypervisor via the pf
--- drivers/net/ethernet/cisco/enic/enic.h | 2 +- drivers/net/ethernet/cisco/enic/enic_main.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/cisco/enic/enic.h +1 -1
@@ -32,7 +32,7 @@#define DRV_NAME "enic"#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" -#define DRV_VERSION "2.1.1.37" +#define DRV_VERSION "2.1.1.38"#define DRV_COPYRIGHT "Copyright 2008-2011 Cisco Systems, Inc"#define ENIC_BARS_MAX 6
drivers/net/ethernet/cisco/enic/enic_main.c +1 -1
@@ -2452,7 +2452,7 @@ static int __devinit enic_probe(struct pci_dev *pdev,* called later by an upper layer. */ -if (!enic_is_dynamic (enic) && !enic_is_sriov_vf (enic)) { +if (!enic_is_dynamic (enic)) { err =vnic_dev_init (enic->vdev,0 );if (err) {dev_err (dev,"vNIC dev init failed, aborting\n" );