aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2013-04-18 22:04:27 -0400
committerDavid S. Miller <davem@davemloft.net>2013-04-19 14:45:26 -0400
commitf646968f8f7c624587de729115d802372b9063dd (patch)
tree2b8c6604306f5e74af9e16c17e2b611610982b65 /net
parentc2962897c94605bc8f158a37dee8d867dda9f116 (diff)
net: vlan: rename NETIF_F_HW_VLAN_* feature flags to NETIF_F_HW_VLAN_CTAG_*
Rename the hardware VLAN acceleration features to include "CTAG" to indicate that they only support CTAGs. Follow up patches will introduce 802.1ad server provider tagging (STAGs) and require the distinction for hardware not supporting acclerating both. Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/8021q/vlan.c6
-rw-r--r--net/8021q/vlan_core.c4
-rw-r--r--net/8021q/vlan_dev.c2
-rw-r--r--net/bridge/br_device.c4
-rw-r--r--net/bridge/br_vlan.c6
-rw-r--r--net/core/dev.c9
-rw-r--r--net/core/ethtool.c25
-rw-r--r--net/core/netpoll.c2
-rw-r--r--net/openvswitch/vport-internal_dev.c2
9 files changed, 31 insertions, 29 deletions
diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 85addcd9372b..d913feed0757 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -301,7 +301,7 @@ static void vlan_transfer_features(struct net_device *dev,
301{ 301{
302 vlandev->gso_max_size = dev->gso_max_size; 302 vlandev->gso_max_size = dev->gso_max_size;
303 303
304 if (dev->features & NETIF_F_HW_VLAN_TX) 304 if (dev->features & NETIF_F_HW_VLAN_CTAG_TX)
305 vlandev->hard_header_len = dev->hard_header_len; 305 vlandev->hard_header_len = dev->hard_header_len;
306 else 306 else
307 vlandev->hard_header_len = dev->hard_header_len + VLAN_HLEN; 307 vlandev->hard_header_len = dev->hard_header_len + VLAN_HLEN;
@@ -347,7 +347,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
347 __vlan_device_event(dev, event); 347 __vlan_device_event(dev, event);
348 348
349 if ((event == NETDEV_UP) && 349 if ((event == NETDEV_UP) &&
350 (dev->features & NETIF_F_HW_VLAN_FILTER)) { 350 (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) {
351 pr_info("adding VLAN 0 to HW filter on device %s\n", 351 pr_info("adding VLAN 0 to HW filter on device %s\n",
352 dev->name); 352 dev->name);
353 vlan_vid_add(dev, 0); 353 vlan_vid_add(dev, 0);
@@ -415,7 +415,7 @@ static int vlan_device_event(struct notifier_block *unused, unsigned long event,
415 break; 415 break;
416 416
417 case NETDEV_DOWN: 417 case NETDEV_DOWN:
418 if (dev->features & NETIF_F_HW_VLAN_FILTER) 418 if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
419 vlan_vid_del(dev, 0); 419 vlan_vid_del(dev, 0);
420 420
421 /* Put all VLANs for this dev in the down state too. */ 421 /* Put all VLANs for this dev in the down state too. */
diff --git a/net/8021q/vlan_core.c b/net/8021q/vlan_core.c
index f3b6f515eba6..3df29d344704 100644
--- a/net/8021q/vlan_core.c
+++ b/net/8021q/vlan_core.c
@@ -225,7 +225,7 @@ static int __vlan_vid_add(struct vlan_info *vlan_info, unsigned short vid,
225 if (!vid_info) 225 if (!vid_info)
226 return -ENOMEM; 226 return -ENOMEM;
227 227
228 if (dev->features & NETIF_F_HW_VLAN_FILTER) { 228 if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER) {
229 err = ops->ndo_vlan_rx_add_vid(dev, vid); 229 err = ops->ndo_vlan_rx_add_vid(dev, vid);
230 if (err) { 230 if (err) {
231 kfree(vid_info); 231 kfree(vid_info);
@@ -282,7 +282,7 @@ static void __vlan_vid_del(struct vlan_info *vlan_info,
282 unsigned short vid = vid_info->vid; 282 unsigned short vid = vid_info->vid;
283 int err; 283 int err;
284 284
285 if (dev->features & NETIF_F_HW_VLAN_FILTER) { 285 if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER) {
286 err = ops->ndo_vlan_rx_kill_vid(dev, vid); 286 err = ops->ndo_vlan_rx_kill_vid(dev, vid);
287 if (err) { 287 if (err) {
288 pr_warn("failed to kill vid %d for device %s\n", 288 pr_warn("failed to kill vid %d for device %s\n",
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 19cf81bf9f69..5c4892a86410 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -583,7 +583,7 @@ static int vlan_dev_init(struct net_device *dev)
583#endif 583#endif
584 584
585 dev->needed_headroom = real_dev->needed_headroom; 585 dev->needed_headroom = real_dev->needed_headroom;
586 if (real_dev->features & NETIF_F_HW_VLAN_TX) { 586 if (real_dev->features & NETIF_F_HW_VLAN_CTAG_TX) {
587 dev->header_ops = real_dev->header_ops; 587 dev->header_ops = real_dev->header_ops;
588 dev->hard_header_len = real_dev->hard_header_len; 588 dev->hard_header_len = real_dev->hard_header_len;
589 } else { 589 } else {
diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 314c73ed418f..967312803e41 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -348,10 +348,10 @@ void br_dev_setup(struct net_device *dev)
348 348
349 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | 349 dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
350 NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | NETIF_F_LLTX | 350 NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | NETIF_F_LLTX |
351 NETIF_F_NETNS_LOCAL | NETIF_F_HW_VLAN_TX; 351 NETIF_F_NETNS_LOCAL | NETIF_F_HW_VLAN_CTAG_TX;
352 dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA | 352 dev->hw_features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
353 NETIF_F_GSO_MASK | NETIF_F_HW_CSUM | 353 NETIF_F_GSO_MASK | NETIF_F_HW_CSUM |
354 NETIF_F_HW_VLAN_TX; 354 NETIF_F_HW_VLAN_CTAG_TX;
355 355
356 br->dev = dev; 356 br->dev = dev;
357 spin_lock_init(&br->lock); 357 spin_lock_init(&br->lock);
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 93dde75923f0..0b3dbbec80d0 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -54,7 +54,7 @@ static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
54 dev = br->dev; 54 dev = br->dev;
55 } 55 }
56 56
57 if (p && (dev->features & NETIF_F_HW_VLAN_FILTER)) { 57 if (p && (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) {
58 /* Add VLAN to the device filter if it is supported. 58 /* Add VLAN to the device filter if it is supported.
59 * Stricly speaking, this is not necessary now, since 59 * Stricly speaking, this is not necessary now, since
60 * devices are made promiscuous by the bridge, but if 60 * devices are made promiscuous by the bridge, but if
@@ -82,7 +82,7 @@ static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
82 return 0; 82 return 0;
83 83
84out_filt: 84out_filt:
85 if (p && (dev->features & NETIF_F_HW_VLAN_FILTER)) 85 if (p && (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER))
86 dev->netdev_ops->ndo_vlan_rx_kill_vid(dev, vid); 86 dev->netdev_ops->ndo_vlan_rx_kill_vid(dev, vid);
87 return err; 87 return err;
88} 88}
@@ -98,7 +98,7 @@ static int __vlan_del(struct net_port_vlans *v, u16 vid)
98 if (v->port_idx && vid) { 98 if (v->port_idx && vid) {
99 struct net_device *dev = v->parent.port->dev; 99 struct net_device *dev = v->parent.port->dev;
100 100
101 if (dev->features & NETIF_F_HW_VLAN_FILTER) 101 if (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)
102 dev->netdev_ops->ndo_vlan_rx_kill_vid(dev, vid); 102 dev->netdev_ops->ndo_vlan_rx_kill_vid(dev, vid);
103 } 103 }
104 104
diff --git a/net/core/dev.c b/net/core/dev.c
index 3655ff927315..07a8e9dc43fc 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2435,13 +2435,13 @@ netdev_features_t netif_skb_features(struct sk_buff *skb)
2435 return harmonize_features(skb, protocol, features); 2435 return harmonize_features(skb, protocol, features);
2436 } 2436 }
2437 2437
2438 features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_TX); 2438 features &= (skb->dev->vlan_features | NETIF_F_HW_VLAN_CTAG_TX);
2439 2439
2440 if (protocol != htons(ETH_P_8021Q)) { 2440 if (protocol != htons(ETH_P_8021Q)) {
2441 return harmonize_features(skb, protocol, features); 2441 return harmonize_features(skb, protocol, features);
2442 } else { 2442 } else {
2443 features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | 2443 features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST |
2444 NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_TX; 2444 NETIF_F_GEN_CSUM | NETIF_F_HW_VLAN_CTAG_TX;
2445 return harmonize_features(skb, protocol, features); 2445 return harmonize_features(skb, protocol, features);
2446 } 2446 }
2447} 2447}
@@ -2482,7 +2482,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
2482 features = netif_skb_features(skb); 2482 features = netif_skb_features(skb);
2483 2483
2484 if (vlan_tx_tag_present(skb) && 2484 if (vlan_tx_tag_present(skb) &&
2485 !(features & NETIF_F_HW_VLAN_TX)) { 2485 !(features & NETIF_F_HW_VLAN_CTAG_TX)) {
2486 skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb)); 2486 skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb));
2487 if (unlikely(!skb)) 2487 if (unlikely(!skb))
2488 goto out; 2488 goto out;
@@ -5180,7 +5180,8 @@ int register_netdevice(struct net_device *dev)
5180 } 5180 }
5181 } 5181 }
5182 5182
5183 if (((dev->hw_features | dev->features) & NETIF_F_HW_VLAN_FILTER) && 5183 if (((dev->hw_features | dev->features) &
5184 NETIF_F_HW_VLAN_CTAG_FILTER) &&
5184 (!dev->netdev_ops->ndo_vlan_rx_add_vid || 5185 (!dev->netdev_ops->ndo_vlan_rx_add_vid ||
5185 !dev->netdev_ops->ndo_vlan_rx_kill_vid)) { 5186 !dev->netdev_ops->ndo_vlan_rx_kill_vid)) {
5186 netdev_WARN(dev, "Buggy VLAN acceleration in driver!\n"); 5187 netdev_WARN(dev, "Buggy VLAN acceleration in driver!\n");
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index adc1351e6873..b87712cfd26c 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -60,10 +60,10 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
60 [NETIF_F_IPV6_CSUM_BIT] = "tx-checksum-ipv6", 60 [NETIF_F_IPV6_CSUM_BIT] = "tx-checksum-ipv6",
61 [NETIF_F_HIGHDMA_BIT] = "highdma", 61 [NETIF_F_HIGHDMA_BIT] = "highdma",
62 [NETIF_F_FRAGLIST_BIT] = "tx-scatter-gather-fraglist", 62 [NETIF_F_FRAGLIST_BIT] = "tx-scatter-gather-fraglist",
63 [NETIF_F_HW_VLAN_TX_BIT] = "tx-vlan-hw-insert", 63 [NETIF_F_HW_VLAN_CTAG_TX_BIT] = "tx-vlan-ctag-hw-insert",
64 64
65 [NETIF_F_HW_VLAN_RX_BIT] = "rx-vlan-hw-parse", 65 [NETIF_F_HW_VLAN_CTAG_RX_BIT] = "rx-vlan-ctag-hw-parse",
66 [NETIF_F_HW_VLAN_FILTER_BIT] = "rx-vlan-filter", 66 [NETIF_F_HW_VLAN_CTAG_FILTER_BIT] = "rx-vlan-ctag-filter",
67 [NETIF_F_VLAN_CHALLENGED_BIT] = "vlan-challenged", 67 [NETIF_F_VLAN_CHALLENGED_BIT] = "vlan-challenged",
68 [NETIF_F_GSO_BIT] = "tx-generic-segmentation", 68 [NETIF_F_GSO_BIT] = "tx-generic-segmentation",
69 [NETIF_F_LLTX_BIT] = "tx-lockless", 69 [NETIF_F_LLTX_BIT] = "tx-lockless",
@@ -267,18 +267,19 @@ static int ethtool_set_one_feature(struct net_device *dev,
267 267
268#define ETH_ALL_FLAGS (ETH_FLAG_LRO | ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN | \ 268#define ETH_ALL_FLAGS (ETH_FLAG_LRO | ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN | \
269 ETH_FLAG_NTUPLE | ETH_FLAG_RXHASH) 269 ETH_FLAG_NTUPLE | ETH_FLAG_RXHASH)
270#define ETH_ALL_FEATURES (NETIF_F_LRO | NETIF_F_HW_VLAN_RX | \ 270#define ETH_ALL_FEATURES (NETIF_F_LRO | NETIF_F_HW_VLAN_CTAG_RX | \
271 NETIF_F_HW_VLAN_TX | NETIF_F_NTUPLE | NETIF_F_RXHASH) 271 NETIF_F_HW_VLAN_CTAG_TX | NETIF_F_NTUPLE | \
272 NETIF_F_RXHASH)
272 273
273static u32 __ethtool_get_flags(struct net_device *dev) 274static u32 __ethtool_get_flags(struct net_device *dev)
274{ 275{
275 u32 flags = 0; 276 u32 flags = 0;
276 277
277 if (dev->features & NETIF_F_LRO) flags |= ETH_FLAG_LRO; 278 if (dev->features & NETIF_F_LRO) flags |= ETH_FLAG_LRO;
278 if (dev->features & NETIF_F_HW_VLAN_RX) flags |= ETH_FLAG_RXVLAN; 279 if (dev->features & NETIF_F_HW_VLAN_CTAG_RX) flags |= ETH_FLAG_RXVLAN;
279 if (dev->features & NETIF_F_HW_VLAN_TX) flags |= ETH_FLAG_TXVLAN; 280 if (dev->features & NETIF_F_HW_VLAN_CTAG_TX) flags |= ETH_FLAG_TXVLAN;
280 if (dev->features & NETIF_F_NTUPLE) flags |= ETH_FLAG_NTUPLE; 281 if (dev->features & NETIF_F_NTUPLE) flags |= ETH_FLAG_NTUPLE;
281 if (dev->features & NETIF_F_RXHASH) flags |= ETH_FLAG_RXHASH; 282 if (dev->features & NETIF_F_RXHASH) flags |= ETH_FLAG_RXHASH;
282 283
283 return flags; 284 return flags;
284} 285}
@@ -291,8 +292,8 @@ static int __ethtool_set_flags(struct net_device *dev, u32 data)
291 return -EINVAL; 292 return -EINVAL;
292 293
293 if (data & ETH_FLAG_LRO) features |= NETIF_F_LRO; 294 if (data & ETH_FLAG_LRO) features |= NETIF_F_LRO;
294 if (data & ETH_FLAG_RXVLAN) features |= NETIF_F_HW_VLAN_RX; 295 if (data & ETH_FLAG_RXVLAN) features |= NETIF_F_HW_VLAN_CTAG_RX;
295 if (data & ETH_FLAG_TXVLAN) features |= NETIF_F_HW_VLAN_TX; 296 if (data & ETH_FLAG_TXVLAN) features |= NETIF_F_HW_VLAN_CTAG_TX;
296 if (data & ETH_FLAG_NTUPLE) features |= NETIF_F_NTUPLE; 297 if (data & ETH_FLAG_NTUPLE) features |= NETIF_F_NTUPLE;
297 if (data & ETH_FLAG_RXHASH) features |= NETIF_F_RXHASH; 298 if (data & ETH_FLAG_RXHASH) features |= NETIF_F_RXHASH;
298 299
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index a3a17aed3639..8de961e67cf7 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -383,7 +383,7 @@ void netpoll_send_skb_on_dev(struct netpoll *np, struct sk_buff *skb,
383 if (__netif_tx_trylock(txq)) { 383 if (__netif_tx_trylock(txq)) {
384 if (!netif_xmit_stopped(txq)) { 384 if (!netif_xmit_stopped(txq)) {
385 if (vlan_tx_tag_present(skb) && 385 if (vlan_tx_tag_present(skb) &&
386 !(netif_skb_features(skb) & NETIF_F_HW_VLAN_TX)) { 386 !(netif_skb_features(skb) & NETIF_F_HW_VLAN_CTAG_TX)) {
387 skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb)); 387 skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb));
388 if (unlikely(!skb)) 388 if (unlikely(!skb))
389 break; 389 break;
diff --git a/net/openvswitch/vport-internal_dev.c b/net/openvswitch/vport-internal_dev.c
index 9604760494b1..73682de8dc69 100644
--- a/net/openvswitch/vport-internal_dev.c
+++ b/net/openvswitch/vport-internal_dev.c
@@ -137,7 +137,7 @@ static void do_setup(struct net_device *netdev)
137 NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_TSO; 137 NETIF_F_HIGHDMA | NETIF_F_HW_CSUM | NETIF_F_TSO;
138 138
139 netdev->vlan_features = netdev->features; 139 netdev->vlan_features = netdev->features;
140 netdev->features |= NETIF_F_HW_VLAN_TX; 140 netdev->features |= NETIF_F_HW_VLAN_CTAG_TX;
141 netdev->hw_features = netdev->features & ~NETIF_F_LLTX; 141 netdev->hw_features = netdev->features & ~NETIF_F_LLTX;
142 eth_hw_addr_random(netdev); 142 eth_hw_addr_random(netdev);
143} 143}