Add VF Port representor support for SR-IOV VFs
Subsystems (2)
v2 cover Add VF Port representor support for SR-IOV VFs
Patch 1 in this patchset adds support to create VF port representor netdevs associated with SR-IOV VFs that can be used to control/configure VFs from PF name space.
Patch 2 enables VF statistics to be exposed via ethtool on VF representor netdevs.
Patch 3 adds devlink interface to change the switch mode to control the creation of VF representor netdevs.
Sridhar Samudrala (3):
i40e: Introduce VF port representor/control netdevs.
i40e: Enable VF specific ethtool statistics via VF Port representor
netdevs.
i40e: Introduce devlink interface.
drivers/net/ethernet/intel/Kconfig | 1 + drivers/net/ethernet/intel/i40e/i40e.h | 4 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 67 ++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_main.c | 91 ++++++++++++++++++++-- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 91 ++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 14 ++++ 6 files changed, 260 insertions(+), 8 deletions(-)
Signature · 1 line
2.5.5
PATCH v2 1/3 i40e: Introduce VF port representor/control netdevs.
This patch enables creation of a VF Port representor/Control netdev associated with each VF. These netdevs can be used to control and configure VFs from PFs namespace. They enable exposing VF statistics, configuring link state, mtu, fdb/vlan entries etc.
# echo 2 > /sys/class/net/enp5s0f0/device/sriov_numvfs
# ip l show
297: enp5s0f0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop portid 6805ca2e7268 state DOWN mode DEFAULT group default qlen 1000
link/ether 68:05:ca:2e:72:68 brd ff:ff:ff:ff:ff:ff
vf 0 MAC 00:00:00:00:00:00, spoof checking on, link-state auto, trust off
vf 1 MAC 00:00:00:00:00:00, spoof checking on, link-state auto, trust off
299: enp5s0f0-vf0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
300: enp5s0f0-vf1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 88 ++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 14 ++++ 2 files changed, 102 insertions(+)
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +88 -0
@@ -1003,6 +1003,90 @@ complete_reset:clear_bit (__I40E_VF_DISABLE, &pf->state); } +static int i40e_vf_netdev_open (struct net_device *dev) +{ +return 0 ; +} + +static int i40e_vf_netdev_stop (struct net_device *dev) +{ +return 0 ; +} + +static const struct net_device_ops i40e_vf_netdev_ops = { + .ndo_open = i40e_vf_netdev_open, + .ndo_stop = i40e_vf_netdev_stop, +}; + +/** +* i40e_alloc_vf_netdev +* @vf: pointer to the VF structure +* @vf_num: VF number +* +* Create VF representor/control netdev +**/ +int i40e_alloc_vf_netdev (struct i40e_vf *vf,u16 vf_num) +{ +struct net_device *netdev; +char netdev_name[IFNAMSIZ ]; +struct i40e_vf_netdev_priv *priv; +struct i40e_pf *pf = vf->pf; +struct i40e_vsi *vsi = pf->vsi[pf->lan_vsi]; +int err; + +snprintf (netdev_name,IFNAMSIZ ,"%s-vf%d" , vsi->netdev->name, vf_num); + netdev =alloc_netdev (sizeof (struct i40e_vf_netdev_priv ), netdev_name, +NET_NAME_UNKNOWN , ether_setup); +if (!netdev) { +dev_err (&pf->pdev->dev,"alloc_netdev failed for vf:%d\n" , + vf_num); +return -ENOMEM ; + } + + pf->vf[vf_num].ctrl_netdev = netdev; + + priv =netdev_priv (netdev); + priv->vf = &(pf->vf[vf_num]); + + netdev->netdev_ops = &i40e_vf_netdev_ops; + +netif_carrier_off (netdev); +netif_tx_disable (netdev); + + err =register_netdev (netdev); +if (err) { +dev_err (&pf->pdev->dev,"register_netdev failed for vf: %s\n" , + vf->ctrl_netdev->name); +free_netdev (netdev); +return err; + } + +dev_info (&pf->pdev->dev,"VF representor(%s) created for VF %d\n" , + vf->ctrl_netdev->name, vf_num); + +return 0 ; +} + +/** +* i40e_free_vf_netdev +* @vf: pointer to the VF structure +* +* Free VF representor/control netdev +**/ +void i40e_free_vf_netdev (struct i40e_vf *vf) +{ +struct i40e_pf *pf = vf->pf; + +if (!vf->ctrl_netdev) +return ; + +dev_info (&pf->pdev->dev,"Freeing VF representor(%s)\n" , + vf->ctrl_netdev->name); + +unregister_netdev (vf->ctrl_netdev); +free_netdev (vf->ctrl_netdev); +} +/** * i40e_free_vfs * @pf: pointer to the PF structure
@@ -1045,6 +1129,8 @@ void i40e_free_vfs(struct i40e_pf *pf)i40e_free_vf_res (&pf->vf[i]);/* disable qp mappings */ i40e_disable_vf_mappings (&pf->vf[i]); + +i40e_free_vf_netdev (&pf->vf[i]); }kfree (pf->vf);
@@ -1112,6 +1198,8 @@ int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)/* VF resources get allocated during reset */ i40e_reset_vf (&vfs[i], false); +i40e_alloc_vf_netdev (&vfs[i], i); + } pf->num_alloc_vfs = num_alloc_vfs;
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h +14 -0
@@ -72,10 +72,21 @@ enum i40e_vf_capabilities { I40E_VIRTCHNL_VF_CAP_IWARP, }; +/* VF Ctrl netdev private structure */ +struct i40e_vf_netdev_priv { +struct i40e_vf *vf; +}; +/* VF information structure */ struct i40e_vf {struct i40e_pf *pf; +/* VF Port representor netdev that allows control and configuration +* of VFs from the host. Enables returning VF stats, configuring link +* state, mtu, fdb/vlans etc. +*/ +struct net_device *ctrl_netdev; +/* VF id in the PF space */ s16 vf_id;/* all VF vsis connect to the same parent */
@@ -142,4 +153,7 @@ int i40e_ndo_set_vf_spoofchk(struct net_device *netdev, int vf_id, bool enable);void i40e_vc_notify_link_state (struct i40e_pf *pf);void i40e_vc_notify_reset (struct i40e_pf *pf); +int i40e_alloc_vf_netdev (struct i40e_vf *vf,u16 vf_num); +void i40e_free_vf_netdev (struct i40e_vf *vf); +#endif /* _I40E_VIRTCHNL_PF_H_ */
Signature · 1 line
2.5.5
Bowers
PATCH v2 1/3 i40e: Introduce VF port representor/control netdevs.
Quoted 31 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Sridhar Samudrala
Sent: Thursday, August 18, 2016 10:55 AM
To: intel-wired-lan at lists.osuosl.org; Singhai, Anjali <[email protected]>; Fastabend, John R <[email protected]>; Nambiar, Amritha <[email protected]>; Duyck, Alexander H <[email protected]>
Subject: [Intel-wired-lan] [dev-queue PATCH v2 1/3] i40e: Introduce VF port representor/control netdevs.This patch enables creation of a VF Port representor/Control netdev associated with each VF. These netdevs can be used to control and configure VFs from PFs namespace. They enable exposing VF statistics, configuring link state, mtu, fdb/vlan entries etc.
# echo 2 > /sys/class/net/enp5s0f0/device/sriov_numvfs # ip l show 297: enp5s0f0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop portid 6805ca2e7268 state DOWN mode DEFAULT group default qlen 1000 link/ether 68:05:ca:2e:72:68 brd ff:ff:ff:ff:ff:ff vf 0 MAC 00:00:00:00:00:00, spoof checking on, link-state auto, trust off vf 1 MAC 00:00:00:00:00:00, spoof checking on, link-state auto, trust off 299: enp5s0f0-vf0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff 300: enp5s0f0-vf1: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000 link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
Quoted 6 lines
Signed-off-by Sridhar Samudrala <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 88 ++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.h | 14 ++++ 2 files changed, 102 insertions(+)
Functions as expected
PATCH v2 2/3 i40e: Enable VF specific ethtool statistics via VF Port representor netdevs.
In reply to Sridhar SamudralaSample script that shows ethtool stats on VF representor netdev
PF: enp5s0f0, VF0: enp5s2 VF_REP0: enp5s0f0-vf0
# echo 2 > /sys/class/net/enp5s0f0/device/sriov_numvfs
# ip link set enp5s2 up
# ethtool -S enp5s0f0-vf0
NIC statistics:
rx_bytes: 0
rx_unicast: 0
rx_multicast: 0
rx_broadcast: 0
rx_discards: 0
rx_unknown_protocol: 0
tx_bytes: 140
tx_unicast: 0
tx_multicast: 2
tx_broadcast: 0
tx_discards: 0
tx_errors: 0--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 67 ++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 1 + 3 files changed, 69 insertions(+)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
@@ -869,4 +869,5 @@ i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf);i40e_status i40e_set_npar_bw_setting (struct i40e_pf *pf);i40e_status i40e_commit_npar_bw_setting (struct i40e_pf *pf);void i40e_print_link_message (struct i40e_vsi *vsi,bool isup); +void i40e_set_vf_netdev_ethtool_ops (struct net_device *netdev);#endif /* _I40E_H_ */
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +67 -0
70 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1 -0
@@ -1049,6 +1049,7 @@ int i40e_alloc_vf_netdev(struct i40e_vf *vf, u16 vf_num) priv->vf = &(pf->vf[vf_num]); netdev->netdev_ops = &i40e_vf_netdev_ops; +i40e_set_vf_netdev_ethtool_ops (netdev);netif_carrier_off (netdev);netif_tx_disable (netdev);
Signature · 1 line
2.5.5
Bowers
PATCH v2 2/3 i40e: Enable VF specific ethtool statistics via VF Port representor netdevs.
Quoted 32 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Sridhar Samudrala
Sent: Thursday, August 18, 2016 10:55 AM
To: intel-wired-lan at lists.osuosl.org; Singhai, Anjali <[email protected]>; Fastabend, John R <[email protected]>; Nambiar, Amritha <[email protected]>; Duyck, Alexander H <[email protected]>
Subject: [Intel-wired-lan] [dev-queue PATCH v2 2/3] i40e: Enable VF specific ethtool statistics via VF Port representor netdevs.Sample script that shows ethtool stats on VF representor netdev
PF: enp5s0f0, VF0: enp5s2VF_REP0: enp5s0f0-vf0# echo 2 > /sys/class/net/enp5s0f0/device/sriov_numvfs # ip link set enp5s2 up # ethtool -S enp5s0f0-vf0 NIC statistics: rx_bytes: 0 rx_unicast: 0 rx_multicast: 0 rx_broadcast: 0 rx_discards: 0 rx_unknown_protocol: 0 tx_bytes: 140 tx_unicast: 0 tx_multicast: 2 tx_broadcast: 0 tx_discards: 0 tx_errors: 0
Quoted 7 lines
Signed-off-by Sridhar Samudrala <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 67 ++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 1 + 3 files changed, 69 insertions(+)
Statistics on VF port representor work as expected
PATCH v2 2/3 i40e: Enable VF specific ethtool statistics via VF Port representor netdevs.
In reply to Sridhar SamudralaQuoted 51 lines · Sridhar Samudrala
Sample script that shows ethtool stats on VF representor netdev
PF: enp5s0f0, VF0: enp5s2VF_REP0: enp5s0f0-vf0# echo 2 > /sys/class/net/enp5s0f0/device/sriov_numvfs # ip link set enp5s2 up # ethtool -S enp5s0f0-vf0 NIC statistics: rx_bytes: 0 rx_unicast: 0 rx_multicast: 0 rx_broadcast: 0 rx_discards: 0 rx_unknown_protocol: 0 tx_bytes: 140 tx_unicast: 0 tx_multicast: 2 tx_broadcast: 0 tx_discards: 0 tx_errors: 0Signed-off-by Sridhar Samudrala <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 67 ++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 1 + 3 files changed, 69 insertions(+)drivers/net/ethernet/intel/i40e/i40e.h +1
-0@@ -869,4 +869,5 @@ i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf);i40e_status i40e_set_npar_bw_setting (struct i40e_pf *pf);i40e_status i40e_commit_npar_bw_setting (struct i40e_pf *pf);void i40e_print_link_message (struct i40e_vsi *vsi,bool isup); +void i40e_set_vf_netdev_ethtool_ops (struct net_device *netdev);#endif /* _I40E_H_ */ drivers/net/ethernet/intel/i40e/i40e_ethtool.c +6
-0@@ -3116,3 +3116,70 @@ void i40e_set_ethtool_ops(struct net_device *netdev) { netdev->ethtool_ops = &i40e_ethtool_ops; } + +static const char i40e_vf_netdev_ethtool_sset[][ETH_GSTRING_LEN ] = { +"rx_bytes" , +"rx_unicast" , +"rx_multicast" , +"rx_broadcast" ,
drivers/net/ethernet/intel/i40e/i40e_ethtool.c void i40e_set_ethtool_ops(struct net_device *netdev) · line 3134
Quoted 10 lines
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +10
-0+"rx_discards" , +"rx_unknown_protocol" , +"tx_bytes" , +"tx_unicast" , +"tx_multicast" , +"tx_broadcast" , +"tx_discards" , + "tx_errors", +}; +
So one change you need to this is to swap the rx_ and tx_ portion of the strings. You have to keep in mind this is a switch port representation so the Rx and Tx values are swapped. Every byte the VF receives is actually a byte that we transmitted to the VF.
You could probably also add a comment above this block stating that the two were swapped and why.
Quoted 63 lines
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +51
-0+#define I40E_VF_NETDEV_ETHTOOL_STAT_COUNT \ + ARRAY_SIZE(i40e_vf_netdev_ethtool_sset) + +static void i40e_vf_netdev_ethtool_get_strings (struct net_device *dev, +u32 stringset, +u8 *ethtool_strings) +{ +switch (stringset) { +case ETH_SS_STATS : +memcpy (ethtool_strings, &i40e_vf_netdev_ethtool_sset, +sizeof (i40e_vf_netdev_ethtool_sset)); +break ; + } +} + +static int i40e_vf_netdev_ethtool_get_sset_count (struct net_device *dev, +int stringset) +{ +switch (stringset) { +case ETH_SS_STATS : +return I40E_VF_NETDEV_ETHTOOL_STAT_COUNT ; +default : +return -EOPNOTSUPP ; + } +} + +static void i40e_vf_netdev_ethtool_get_stats (struct net_device *dev, +struct ethtool_stats *target_ethtool_stats, +u64 *target_stat_values) +{ +struct i40e_vf_netdev_priv *priv =netdev_priv (dev); +struct i40e_vf *vf = priv->vf; +struct i40e_pf *pf = vf->pf; +struct i40e_vsi *vsi; + + vsi = pf->vsi[vf->lan_vsi_idx]; +i40e_update_stats (vsi); +memcpy (target_stat_values, &vsi->eth_stats, +I40E_VF_NETDEV_ETHTOOL_STAT_COUNT *8 ); +} + +static const struct ethtool_ops i40e_vf_netdev_ethtool_ops = { + .get_strings = i40e_vf_netdev_ethtool_get_strings, + .get_ethtool_stats = i40e_vf_netdev_ethtool_get_stats, + .get_sset_count = i40e_vf_netdev_ethtool_get_sset_count, +}; + +void i40e_set_vf_netdev_ethtool_ops (struct net_device *netdev) +{ + netdev->ethtool_ops = &i40e_vf_netdev_ethtool_ops; +}drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +1
-0@@ -1049,6 +1049,7 @@ int i40e_alloc_vf_netdev(struct i40e_vf *vf, u16 vf_num) priv->vf = &(pf->vf[vf_num]); netdev->netdev_ops = &i40e_vf_netdev_ops; +i40e_set_vf_netdev_ethtool_ops (netdev);netif_carrier_off (netdev);netif_tx_disable (netdev);
Samudrala
PATCH v2 2/3 i40e: Enable VF specific ethtool statistics via VF Port representor netdevs.
Quoted 68 lines · Alexander Duyck
Quoted 51 lines · Sridhar Samudrala
Sample script that shows ethtool stats on VF representor netdev
PF: enp5s0f0, VF0: enp5s2VF_REP0: enp5s0f0-vf0# echo 2 > /sys/class/net/enp5s0f0/device/sriov_numvfs # ip link set enp5s2 up # ethtool -S enp5s0f0-vf0 NIC statistics: rx_bytes: 0 rx_unicast: 0 rx_multicast: 0 rx_broadcast: 0 rx_discards: 0 rx_unknown_protocol: 0 tx_bytes: 140 tx_unicast: 0 tx_multicast: 2 tx_broadcast: 0 tx_discards: 0 tx_errors: 0Signed-off-by Sridhar Samudrala <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 67 ++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 1 + 3 files changed, 69 insertions(+)drivers/net/ethernet/intel/i40e/i40e.h +1
-0@@ -869,4 +869,5 @@ i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf);i40e_status i40e_set_npar_bw_setting (struct i40e_pf *pf);i40e_status i40e_commit_npar_bw_setting (struct i40e_pf *pf);void i40e_print_link_message (struct i40e_vsi *vsi,bool isup); +void i40e_set_vf_netdev_ethtool_ops (struct net_device *netdev);#endif /* _I40E_H_ */ drivers/net/ethernet/intel/i40e/i40e_ethtool.c +6
-0@@ -3116,3 +3116,70 @@ void i40e_set_ethtool_ops(struct net_device *netdev) { netdev->ethtool_ops = &i40e_ethtool_ops; } + +static const char i40e_vf_netdev_ethtool_sset[][ETH_GSTRING_LEN ] = { +"rx_bytes" , +"rx_unicast" , +"rx_multicast" , +"rx_broadcast" ,drivers/net/ethernet/intel/i40e/i40e_ethtool.c void i40e_set_ethtool_ops(struct net_device *netdev) · line 3134
Quoted 10 lines
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +10
-0+"rx_discards" , +"rx_unknown_protocol" , +"tx_bytes" , +"tx_unicast" , +"tx_multicast" , +"tx_broadcast" , +"tx_discards" , + "tx_errors", +}; +So one change you need to this is to swap the
rx_andtx_portion of the strings. You have to keep in mind this is a switch port representation so the Rx and Tx values are swapped. Every byte the VF receives is actually a byte that we transmitted to the VF.
Quoted 3 lines
You could probably also add a comment above this block stating that the two were swapped and why.
Yes. As we are saying that this netdev represents the switch port corresponding to the VF, it makes
sense to swap the rx and tx stats.
Jeff,
Should i submit a patch on top of this patchset as it is already in dev-queue branch?
Or resubmit the patchset as a v3 with this update.
Thanks
Sridhar
PATCH v2 2/3 i40e: Enable VF specific ethtool statistics via VF Port representor netdevs.
Quoted 84 lines · Sridhar
Quoted 76 lines · Alexander Duyck
Quoted 57 lines · Sridhar Samudrala
Sample script that shows ethtool stats on VF representor netdev
PF: enp5s0f0, VF0: enp5s2VF_REP0: enp5s0f0-vf0# echo 2 > /sys/class/net/enp5s0f0/device/sriov_numvfs # ip link set enp5s2 up # ethtool -S enp5s0f0-vf0 NIC statistics: rx_bytes: 0 rx_unicast: 0 rx_multicast: 0 rx_broadcast: 0 rx_discards: 0 rx_unknown_protocol: 0 tx_bytes: 140 tx_unicast: 0 tx_multicast: 2 tx_broadcast: 0 tx_discards: 0 tx_errors: 0Signed-off-by Sridhar Samudrala <[email protected]>--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 67 ++++++++++++++++++++++ drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 1 + 3 files changed, 69 insertions(+)drivers/net/ethernet/intel/i40e/i40e.h +1
-0@@ -869,4 +869,5 @@ i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf);i40e_status i40e_set_npar_bw_setting (struct i40e_pf *pf);i40e_status i40e_commit_npar_bw_setting (struct i40e_pf *pf);void i40e_print_link_message (struct i40e_vsi *vsi,bool isup); +void i40e_set_vf_netdev_ethtool_ops (struct net_device *netdev);#endif /* _I40E_H_ */drivers/net/ethernet/intel/i40e/i40e_ethtool.c +6
-0@@ -3116,3 +3116,70 @@ void i40e_set_ethtool_ops(struct net_device *netdev) { netdev->ethtool_ops = &i40e_ethtool_ops; } + +static const char i40e_vf_netdev_ethtool_sset[][ETH_GSTRING_LEN ] = { +"rx_bytes" , +"rx_unicast" , +"rx_multicast" , +"rx_broadcast" ,drivers/net/ethernet/intel/i40e/i40e_ethtool.c void i40e_set_ethtool_ops(struct net_device · line 3134
Quoted 10 lines
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +10
-0+"rx_discards" , +"rx_unknown_protocol" , +"tx_bytes" , +"tx_unicast" , +"tx_multicast" , +"tx_broadcast" , +"tx_discards" , + "tx_errors", +}; +So one change you need to this is to swap the
rx_andtx_portion of the strings. You have to keep in mind this is a switch port representation so the Rx and Tx values are swapped. Every byte the VF receives is actually a byte that we transmitted to the VF.Quoted 3 lines
You could probably also add a comment above this block stating that the two were swapped and why.
Yes. As we are saying that this netdev represents the switch port corresponding to the VF, it makes
sense to swap the rx and tx stats.
Quoted 7 lines
Jeff,
Should i submit a patch on top of this patchset as it is already in dev-queue branch?
Or resubmit the patchset as a v3 with this update.Thanks
Sridhar
You should probably resubmit. No point in adding patches to this to fix stuff that hasn't been applied to Dave's tree yet.
- Alex
PATCH v2 2/3 i40e: Enable VF specific ethtool statistics via VF Port representor netdevs.
In reply to SamudralaQuoted 8 lines · Sridhar
Quoted 8 lines
So one change you need to this is to swap the
rx_andtx_portion of the strings.? You have to keep in mind this is a switch port representation so the Rx and Tx values are swapped.? Every byte the VF receives is actually a byte that we transmitted to the VF.You could probably also add a comment above this block stating that the two were swapped and why.
Quoted 8 lines
Yes. As we are saying that this netdev represents the switch port? corresponding to the VF, it makes
sense to swap the rx and tx stats.Jeff,
Should i submit a patch on top of this patchset as it is already in? dev-queue branch?
Or resubmit the patchset as a v3 with this update.
Alex is correct, please re-submit the series with the desired changes to
this and any other patches, please. ?I can drop this series from my tree if
that helps you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://lists.osuosl.org/pipermail/intel-wired-lan/attachments/20160822/788f622d/attachment-0001.asc>
Samudrala
PATCH v2 2/3 i40e: Enable VF specific ethtool statistics via VF Port representor netdevs.
Quoted 13 lines · Jeff Kirsher
Quoted 12 lines · Sridhar
Quoted 8 lines
So one change you need to this is to swap the
rx_andtx_portion of the strings. You have to keep in mind this is a switch port representation so the Rx and Tx values are swapped. Every byte the VF receives is actually a byte that we transmitted to the VF.You could probably also add a comment above this block stating that the two were swapped and why.
Yes. As we are saying that this netdev represents the switch port corresponding to the VF, it makes
sense to swap the rx and tx stats.
Quoted 7 lines
Quoted 4 lines
Jeff,
Should i submit a patch on top of this patchset as it is already in dev-queue branch?
Or resubmit the patchset as a v3 with this update.Alex is correct, please re-submit the series with the desired changes to this and any other patches, please. I can drop this series from my tree if that helps you.
I submitted a v3 version of these patches that should apply cleanly after you drop the v2 series.
Amritha's switchid patch should apply cleanly on top this patchset.
Thanks
Sridhar
PATCH v2 3/3 i40e: Introduce devlink interface.
In reply to Sridhar SamudralaAdd initial devlink support to set/get the mode of SRIOV switch. By default the switch mode is set to 'switchdev' as VF Port representors are created by default.
This patch allows the mode to be set to 'legacy' to disable creation of VF Port representor netdevs.
With smode support in iproute2 'devlink' utility, switch mode can be set and get via following commands.
# devlink dev smode pci/0000:05:00.0
mode: switchdev
# devlink dev set pci/0000:05:00.0 smode legacy
# devlink dev smode pci/0000:05:00.0
mode: legacy--- drivers/net/ethernet/intel/Kconfig | 1 + drivers/net/ethernet/intel/i40e/i40e.h | 3 + drivers/net/ethernet/intel/i40e/i40e_main.c | 91 ++++++++++++++++++++-- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 +- 4 files changed, 91 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/Kconfig +1 -0
@@ -215,6 +215,7 @@ config I40E tristate "Intel(R) Ethernet Controller XL710 Family support" select PTP_1588_CLOCK depends on PCI + depends on MAY_USE_DEVLINK ---help--- This driver supports Intel(R) Ethernet Controller XL710 Family of devices. For more information on how to identify your adapter, go
drivers/net/ethernet/intel/i40e/i40e.h +3 -0
@@ -53,6 +53,8 @@#include <linux/clocksource.h> #include <linux/net_tstamp.h> #include <linux/ptp_clock_kernel.h> +#include <net/devlink.h> +#include "i40e_type.h" #include "i40e_prototype.h" #ifdef I40E_FCOE
@@ -446,6 +448,7 @@ struct i40e_pf {u32 ioremap_len;u32 fd_inv;u16 phy_led_val; +enum devlink_eswitch_mode eswitch_mode; };enum i40e_filter_state {
drivers/net/ethernet/intel/i40e/i40e_main.c +83 -8
136 lines not on this page · raw message
drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c +4 -2
@@ -1131,7 +1131,8 @@ void i40e_free_vfs(struct i40e_pf *pf)/* disable qp mappings */ i40e_disable_vf_mappings (&pf->vf[i]); -i40e_free_vf_netdev (&pf->vf[i]); +if (pf->eswitch_mode ==DEVLINK_ESWITCH_MODE_SWITCHDEV ) +i40e_free_vf_netdev (&pf->vf[i]); }kfree (pf->vf);
@@ -1199,7 +1200,8 @@ int i40e_alloc_vfs(struct i40e_pf *pf, u16 num_alloc_vfs)/* VF resources get allocated during reset */ i40e_reset_vf (&vfs[i], false); -i40e_alloc_vf_netdev (&vfs[i], i); +if (pf->eswitch_mode ==DEVLINK_ESWITCH_MODE_SWITCHDEV ) +i40e_alloc_vf_netdev (&vfs[i], i); } pf->num_alloc_vfs = num_alloc_vfs;
Signature · 1 line
2.5.5
Bowers
PATCH v2 3/3 i40e: Introduce devlink interface.
Quoted 27 lines
-----Original Message-----
From: Intel-wired-lan [mailto:intel-wired-lan-bounces at lists.osuosl.org] On Behalf Of Sridhar Samudrala
Sent: Thursday, August 18, 2016 10:55 AM
To: intel-wired-lan at lists.osuosl.org; Singhai, Anjali <[email protected]>; Fastabend, John R <[email protected]>; Nambiar, Amritha <[email protected]>; Duyck, Alexander H <[email protected]>
Subject: [Intel-wired-lan] [dev-queue PATCH v2 3/3] i40e: Introduce devlink interface.Add initial devlink support to set/get the mode of SRIOV switch. By default the switch mode is set to 'switchdev' as VF Port representors are created by default.
This patch allows the mode to be set to 'legacy' to disable creation of VF Port representor netdevs.With smode support in iproute2 'devlink' utility, switch mode can be set and get via following commands.
# devlink dev smode pci/0000:05:00.0 mode: switchdev # devlink dev set pci/0000:05:00.0 smode legacy # devlink dev smode pci/0000:05:00.0 mode: legacy
Quoted 8 lines
Signed-off-by Sridhar Samudrala <[email protected]>--- drivers/net/ethernet/intel/Kconfig | 1 + drivers/net/ethernet/intel/i40e/i40e.h | 3 + drivers/net/ethernet/intel/i40e/i40e_main.c | 91 ++++++++++++++++++++-- drivers/net/ethernet/intel/i40e/i40e_virtchnl_pf.c | 6 +- 4 files changed, 91 insertions(+), 10 deletions(-)
Works as expected