diff options
author | Jiri Pirko <jpirko@redhat.com> | 2011-07-20 00:54:29 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-07-21 16:47:56 -0400 |
commit | 08dddfc3f6e39fc81238ef4804815c559f314066 (patch) | |
tree | e4726f916debe3e64db3529a0d1aa4395ece5daa /drivers/net/acenic.c | |
parent | dadcd65f52921456112183fde543fc214bb0a227 (diff) |
acenic: do vlan cleanup
- unify vlan and nonvlan rx path
- kill ap->vlgrp and ace_vlan_rx_register
- enable vlan hw accel always (kill vlan ifdefs)
Signed-off-by: Jiri Pirko <jpirko@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/acenic.c')
-rw-r--r-- | drivers/net/acenic.c | 60 |
1 files changed, 7 insertions, 53 deletions
diff --git a/drivers/net/acenic.c b/drivers/net/acenic.c index d7c1bfe4b6ec..02fcb5c997ec 100644 --- a/drivers/net/acenic.c +++ b/drivers/net/acenic.c | |||
@@ -69,10 +69,7 @@ | |||
69 | #include <linux/firmware.h> | 69 | #include <linux/firmware.h> |
70 | #include <linux/slab.h> | 70 | #include <linux/slab.h> |
71 | #include <linux/prefetch.h> | 71 | #include <linux/prefetch.h> |
72 | |||
73 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | ||
74 | #include <linux/if_vlan.h> | 72 | #include <linux/if_vlan.h> |
75 | #endif | ||
76 | 73 | ||
77 | #ifdef SIOCETHTOOL | 74 | #ifdef SIOCETHTOOL |
78 | #include <linux/ethtool.h> | 75 | #include <linux/ethtool.h> |
@@ -171,15 +168,6 @@ MODULE_DEVICE_TABLE(pci, acenic_pci_tbl); | |||
171 | #define BOARD_IDX_STATIC 0 | 168 | #define BOARD_IDX_STATIC 0 |
172 | #define BOARD_IDX_OVERFLOW -1 | 169 | #define BOARD_IDX_OVERFLOW -1 |
173 | 170 | ||
174 | #if (defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)) && \ | ||
175 | defined(NETIF_F_HW_VLAN_RX) | ||
176 | #define ACENIC_DO_VLAN 1 | ||
177 | #define ACE_RCB_VLAN_FLAG RCB_FLG_VLAN_ASSIST | ||
178 | #else | ||
179 | #define ACENIC_DO_VLAN 0 | ||
180 | #define ACE_RCB_VLAN_FLAG 0 | ||
181 | #endif | ||
182 | |||
183 | #include "acenic.h" | 171 | #include "acenic.h" |
184 | 172 | ||
185 | /* | 173 | /* |
@@ -465,9 +453,6 @@ static const struct net_device_ops ace_netdev_ops = { | |||
465 | .ndo_validate_addr = eth_validate_addr, | 453 | .ndo_validate_addr = eth_validate_addr, |
466 | .ndo_set_mac_address = ace_set_mac_addr, | 454 | .ndo_set_mac_address = ace_set_mac_addr, |
467 | .ndo_change_mtu = ace_change_mtu, | 455 | .ndo_change_mtu = ace_change_mtu, |
468 | #if ACENIC_DO_VLAN | ||
469 | .ndo_vlan_rx_register = ace_vlan_rx_register, | ||
470 | #endif | ||
471 | }; | 456 | }; |
472 | 457 | ||
473 | static int __devinit acenic_probe_one(struct pci_dev *pdev, | 458 | static int __devinit acenic_probe_one(struct pci_dev *pdev, |
@@ -491,9 +476,7 @@ static int __devinit acenic_probe_one(struct pci_dev *pdev, | |||
491 | ap->name = pci_name(pdev); | 476 | ap->name = pci_name(pdev); |
492 | 477 | ||
493 | dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; | 478 | dev->features |= NETIF_F_SG | NETIF_F_IP_CSUM; |
494 | #if ACENIC_DO_VLAN | ||
495 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; | 479 | dev->features |= NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; |
496 | #endif | ||
497 | 480 | ||
498 | dev->watchdog_timeo = 5*HZ; | 481 | dev->watchdog_timeo = 5*HZ; |
499 | 482 | ||
@@ -1248,7 +1231,7 @@ static int __devinit ace_init(struct net_device *dev) | |||
1248 | set_aceaddr(&info->rx_std_ctrl.rngptr, ap->rx_ring_base_dma); | 1231 | set_aceaddr(&info->rx_std_ctrl.rngptr, ap->rx_ring_base_dma); |
1249 | info->rx_std_ctrl.max_len = ACE_STD_BUFSIZE; | 1232 | info->rx_std_ctrl.max_len = ACE_STD_BUFSIZE; |
1250 | info->rx_std_ctrl.flags = | 1233 | info->rx_std_ctrl.flags = |
1251 | RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG; | 1234 | RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | RCB_FLG_VLAN_ASSIST; |
1252 | 1235 | ||
1253 | memset(ap->rx_std_ring, 0, | 1236 | memset(ap->rx_std_ring, 0, |
1254 | RX_STD_RING_ENTRIES * sizeof(struct rx_desc)); | 1237 | RX_STD_RING_ENTRIES * sizeof(struct rx_desc)); |
@@ -1264,7 +1247,7 @@ static int __devinit ace_init(struct net_device *dev) | |||
1264 | (sizeof(struct rx_desc) * RX_STD_RING_ENTRIES))); | 1247 | (sizeof(struct rx_desc) * RX_STD_RING_ENTRIES))); |
1265 | info->rx_jumbo_ctrl.max_len = 0; | 1248 | info->rx_jumbo_ctrl.max_len = 0; |
1266 | info->rx_jumbo_ctrl.flags = | 1249 | info->rx_jumbo_ctrl.flags = |
1267 | RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG; | 1250 | RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | RCB_FLG_VLAN_ASSIST; |
1268 | 1251 | ||
1269 | memset(ap->rx_jumbo_ring, 0, | 1252 | memset(ap->rx_jumbo_ring, 0, |
1270 | RX_JUMBO_RING_ENTRIES * sizeof(struct rx_desc)); | 1253 | RX_JUMBO_RING_ENTRIES * sizeof(struct rx_desc)); |
@@ -1286,7 +1269,7 @@ static int __devinit ace_init(struct net_device *dev) | |||
1286 | RX_JUMBO_RING_ENTRIES)))); | 1269 | RX_JUMBO_RING_ENTRIES)))); |
1287 | info->rx_mini_ctrl.max_len = ACE_MINI_SIZE; | 1270 | info->rx_mini_ctrl.max_len = ACE_MINI_SIZE; |
1288 | info->rx_mini_ctrl.flags = | 1271 | info->rx_mini_ctrl.flags = |
1289 | RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR|ACE_RCB_VLAN_FLAG; | 1272 | RCB_FLG_TCP_UDP_SUM|RCB_FLG_NO_PSEUDO_HDR|RCB_FLG_VLAN_ASSIST; |
1290 | 1273 | ||
1291 | for (i = 0; i < RX_MINI_RING_ENTRIES; i++) | 1274 | for (i = 0; i < RX_MINI_RING_ENTRIES; i++) |
1292 | ap->rx_mini_ring[i].flags = | 1275 | ap->rx_mini_ring[i].flags = |
@@ -1332,7 +1315,7 @@ static int __devinit ace_init(struct net_device *dev) | |||
1332 | } | 1315 | } |
1333 | 1316 | ||
1334 | info->tx_ctrl.max_len = ACE_TX_RING_ENTRIES(ap); | 1317 | info->tx_ctrl.max_len = ACE_TX_RING_ENTRIES(ap); |
1335 | tmp = RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | ACE_RCB_VLAN_FLAG; | 1318 | tmp = RCB_FLG_TCP_UDP_SUM | RCB_FLG_NO_PSEUDO_HDR | RCB_FLG_VLAN_ASSIST; |
1336 | 1319 | ||
1337 | /* | 1320 | /* |
1338 | * The Tigon I does not like having the TX ring in host memory ;-( | 1321 | * The Tigon I does not like having the TX ring in host memory ;-( |
@@ -2038,12 +2021,9 @@ static void ace_rx_int(struct net_device *dev, u32 rxretprd, u32 rxretcsm) | |||
2038 | } | 2021 | } |
2039 | 2022 | ||
2040 | /* send it up */ | 2023 | /* send it up */ |
2041 | #if ACENIC_DO_VLAN | 2024 | if ((bd_flags & BD_FLG_VLAN_TAG)) |
2042 | if (ap->vlgrp && (bd_flags & BD_FLG_VLAN_TAG)) { | 2025 | __vlan_hwaccel_put_tag(skb, retdesc->vlan); |
2043 | vlan_hwaccel_rx(skb, ap->vlgrp, retdesc->vlan); | 2026 | netif_rx(skb); |
2044 | } else | ||
2045 | #endif | ||
2046 | netif_rx(skb); | ||
2047 | 2027 | ||
2048 | dev->stats.rx_packets++; | 2028 | dev->stats.rx_packets++; |
2049 | dev->stats.rx_bytes += retdesc->size; | 2029 | dev->stats.rx_bytes += retdesc->size; |
@@ -2262,24 +2242,6 @@ static irqreturn_t ace_interrupt(int irq, void *dev_id) | |||
2262 | return IRQ_HANDLED; | 2242 | return IRQ_HANDLED; |
2263 | } | 2243 | } |
2264 | 2244 | ||
2265 | |||
2266 | #if ACENIC_DO_VLAN | ||
2267 | static void ace_vlan_rx_register(struct net_device *dev, struct vlan_group *grp) | ||
2268 | { | ||
2269 | struct ace_private *ap = netdev_priv(dev); | ||
2270 | unsigned long flags; | ||
2271 | |||
2272 | local_irq_save(flags); | ||
2273 | ace_mask_irq(dev); | ||
2274 | |||
2275 | ap->vlgrp = grp; | ||
2276 | |||
2277 | ace_unmask_irq(dev); | ||
2278 | local_irq_restore(flags); | ||
2279 | } | ||
2280 | #endif /* ACENIC_DO_VLAN */ | ||
2281 | |||
2282 | |||
2283 | static int ace_open(struct net_device *dev) | 2245 | static int ace_open(struct net_device *dev) |
2284 | { | 2246 | { |
2285 | struct ace_private *ap = netdev_priv(dev); | 2247 | struct ace_private *ap = netdev_priv(dev); |
@@ -2449,16 +2411,12 @@ ace_load_tx_bd(struct ace_private *ap, struct tx_desc *desc, u64 addr, | |||
2449 | writel(addr >> 32, &io->addr.addrhi); | 2411 | writel(addr >> 32, &io->addr.addrhi); |
2450 | writel(addr & 0xffffffff, &io->addr.addrlo); | 2412 | writel(addr & 0xffffffff, &io->addr.addrlo); |
2451 | writel(flagsize, &io->flagsize); | 2413 | writel(flagsize, &io->flagsize); |
2452 | #if ACENIC_DO_VLAN | ||
2453 | writel(vlan_tag, &io->vlanres); | 2414 | writel(vlan_tag, &io->vlanres); |
2454 | #endif | ||
2455 | } else { | 2415 | } else { |
2456 | desc->addr.addrhi = addr >> 32; | 2416 | desc->addr.addrhi = addr >> 32; |
2457 | desc->addr.addrlo = addr; | 2417 | desc->addr.addrlo = addr; |
2458 | desc->flagsize = flagsize; | 2418 | desc->flagsize = flagsize; |
2459 | #if ACENIC_DO_VLAN | ||
2460 | desc->vlanres = vlan_tag; | 2419 | desc->vlanres = vlan_tag; |
2461 | #endif | ||
2462 | } | 2420 | } |
2463 | } | 2421 | } |
2464 | 2422 | ||
@@ -2486,12 +2444,10 @@ restart: | |||
2486 | flagsize = (skb->len << 16) | (BD_FLG_END); | 2444 | flagsize = (skb->len << 16) | (BD_FLG_END); |
2487 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 2445 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
2488 | flagsize |= BD_FLG_TCP_UDP_SUM; | 2446 | flagsize |= BD_FLG_TCP_UDP_SUM; |
2489 | #if ACENIC_DO_VLAN | ||
2490 | if (vlan_tx_tag_present(skb)) { | 2447 | if (vlan_tx_tag_present(skb)) { |
2491 | flagsize |= BD_FLG_VLAN_TAG; | 2448 | flagsize |= BD_FLG_VLAN_TAG; |
2492 | vlan_tag = vlan_tx_tag_get(skb); | 2449 | vlan_tag = vlan_tx_tag_get(skb); |
2493 | } | 2450 | } |
2494 | #endif | ||
2495 | desc = ap->tx_ring + idx; | 2451 | desc = ap->tx_ring + idx; |
2496 | idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); | 2452 | idx = (idx + 1) % ACE_TX_RING_ENTRIES(ap); |
2497 | 2453 | ||
@@ -2509,12 +2465,10 @@ restart: | |||
2509 | flagsize = (skb_headlen(skb) << 16); | 2465 | flagsize = (skb_headlen(skb) << 16); |
2510 | if (skb->ip_summed == CHECKSUM_PARTIAL) | 2466 | if (skb->ip_summed == CHECKSUM_PARTIAL) |
2511 | flagsize |= BD_FLG_TCP_UDP_SUM; | 2467 | flagsize |= BD_FLG_TCP_UDP_SUM; |
2512 | #if ACENIC_DO_VLAN | ||
2513 | if (vlan_tx_tag_present(skb)) { | 2468 | if (vlan_tx_tag_present(skb)) { |
2514 | flagsize |= BD_FLG_VLAN_TAG; | 2469 | flagsize |= BD_FLG_VLAN_TAG; |
2515 | vlan_tag = vlan_tx_tag_get(skb); | 2470 | vlan_tag = vlan_tx_tag_get(skb); |
2516 | } | 2471 | } |
2517 | #endif | ||
2518 | 2472 | ||
2519 | ace_load_tx_bd(ap, ap->tx_ring + idx, mapping, flagsize, vlan_tag); | 2473 | ace_load_tx_bd(ap, ap->tx_ring + idx, mapping, flagsize, vlan_tag); |
2520 | 2474 | ||