aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/intel/igb/igb_main.c
diff options
context:
space:
mode:
authorMoshe Shemesh <moshe@mellanox.com>2016-09-22 05:11:15 -0400
committerDavid S. Miller <davem@davemloft.net>2016-09-24 08:01:26 -0400
commit79aab093a0b5370d7fc4e99df75996f4744dc03f (patch)
tree335687dd409f13fcadcd420e63ca9425016d4d54 /drivers/net/ethernet/intel/igb/igb_main.c
parent0815fe3a86a01cdf81361459c465761be7138665 (diff)
net: Update API for VF vlan protocol 802.1ad support
Introduce new rtnl UAPI that exposes a list of vlans per VF, giving the ability for user-space application to specify it for the VF, as an option to support 802.1ad. We adjusted IP Link tool to support this option. For future use cases, the new UAPI supports multiple vlans. For now we limit the list size to a single vlan in kernel. Add IFLA_VF_VLAN_LIST in addition to IFLA_VF_VLAN to keep backward compatibility with older versions of IP Link tool. Add a vlan protocol parameter to the ndo_set_vf_vlan callback. We kept 802.1Q as the drivers' default vlan protocol. Suitable ip link tool command examples: Set vf vlan protocol 802.1ad: ip link set eth0 vf 1 vlan 100 proto 802.1ad Set vf to VST (802.1Q) mode: ip link set eth0 vf 1 vlan 100 proto 802.1Q Or by omitting the new parameter ip link set eth0 vf 1 vlan 100 Signed-off-by: Moshe Shemesh <moshe@mellanox.com> Signed-off-by: Tariq Toukan <tariqt@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/intel/igb/igb_main.c')
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index af75eac5fa16..a83aa13a5bf4 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -169,7 +169,7 @@ static int igb_set_vf_mac(struct igb_adapter *, int, unsigned char *);
169static void igb_restore_vf_multicasts(struct igb_adapter *adapter); 169static void igb_restore_vf_multicasts(struct igb_adapter *adapter);
170static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac); 170static int igb_ndo_set_vf_mac(struct net_device *netdev, int vf, u8 *mac);
171static int igb_ndo_set_vf_vlan(struct net_device *netdev, 171static int igb_ndo_set_vf_vlan(struct net_device *netdev,
172 int vf, u16 vlan, u8 qos); 172 int vf, u16 vlan, u8 qos, __be16 vlan_proto);
173static int igb_ndo_set_vf_bw(struct net_device *, int, int, int); 173static int igb_ndo_set_vf_bw(struct net_device *, int, int, int);
174static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf, 174static int igb_ndo_set_vf_spoofchk(struct net_device *netdev, int vf,
175 bool setting); 175 bool setting);
@@ -6222,14 +6222,17 @@ static int igb_disable_port_vlan(struct igb_adapter *adapter, int vf)
6222 return 0; 6222 return 0;
6223} 6223}
6224 6224
6225static int igb_ndo_set_vf_vlan(struct net_device *netdev, 6225static int igb_ndo_set_vf_vlan(struct net_device *netdev, int vf,
6226 int vf, u16 vlan, u8 qos) 6226 u16 vlan, u8 qos, __be16 vlan_proto)
6227{ 6227{
6228 struct igb_adapter *adapter = netdev_priv(netdev); 6228 struct igb_adapter *adapter = netdev_priv(netdev);
6229 6229
6230 if ((vf >= adapter->vfs_allocated_count) || (vlan > 4095) || (qos > 7)) 6230 if ((vf >= adapter->vfs_allocated_count) || (vlan > 4095) || (qos > 7))
6231 return -EINVAL; 6231 return -EINVAL;
6232 6232
6233 if (vlan_proto != htons(ETH_P_8021Q))
6234 return -EPROTONOSUPPORT;
6235
6233 return (vlan || qos) ? igb_enable_port_vlan(adapter, vf, vlan, qos) : 6236 return (vlan || qos) ? igb_enable_port_vlan(adapter, vf, vlan, qos) :
6234 igb_disable_port_vlan(adapter, vf); 6237 igb_disable_port_vlan(adapter, vf);
6235} 6238}