aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/forcedeth.c
diff options
context:
space:
mode:
authorJiri Pirko <jpirko@redhat.com>2011-07-20 00:54:38 -0400
committerDavid S. Miller <davem@davemloft.net>2011-07-21 16:47:57 -0400
commit3326c784c9f492e988617d93f647ae0cfd4c8d09 (patch)
tree364c18095af09b6aceb986b9541905d72bdeef3c /drivers/net/forcedeth.c
parent5622e4044a916de1af84bfcc4d437ce0c799d531 (diff)
forcedeth: do vlan cleanup
- unify vlan and nonvlan rx path - kill np->vlangrp and nv_vlan_rx_register - allow to turn on/off rx vlan accel via ethtool (set_features) Signed-off-by: Jiri Pirko <jpirko@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/forcedeth.c')
-rw-r--r--drivers/net/forcedeth.c68
1 files changed, 30 insertions, 38 deletions
diff --git a/drivers/net/forcedeth.c b/drivers/net/forcedeth.c
index 537b6957bb7..e64cd9ceac3 100644
--- a/drivers/net/forcedeth.c
+++ b/drivers/net/forcedeth.c
@@ -820,9 +820,6 @@ struct fe_priv {
820 struct nv_skb_map *tx_end_flip; 820 struct nv_skb_map *tx_end_flip;
821 int tx_stop; 821 int tx_stop;
822 822
823 /* vlan fields */
824 struct vlan_group *vlangrp;
825
826 /* msi/msi-x fields */ 823 /* msi/msi-x fields */
827 u32 msi_flags; 824 u32 msi_flags;
828 struct msix_entry msi_x_entry[NV_MSI_X_MAX_VECTORS]; 825 struct msix_entry msi_x_entry[NV_MSI_X_MAX_VECTORS];
@@ -2766,17 +2763,13 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
2766 skb->protocol = eth_type_trans(skb, dev); 2763 skb->protocol = eth_type_trans(skb, dev);
2767 prefetch(skb->data); 2764 prefetch(skb->data);
2768 2765
2769 if (likely(!np->vlangrp)) { 2766 vlanflags = le32_to_cpu(np->get_rx.ex->buflow);
2770 napi_gro_receive(&np->napi, skb); 2767 if (vlanflags & NV_RX3_VLAN_TAG_PRESENT) {
2771 } else { 2768 u16 vid = vlanflags & NV_RX3_VLAN_TAG_MASK;
2772 vlanflags = le32_to_cpu(np->get_rx.ex->buflow); 2769
2773 if (vlanflags & NV_RX3_VLAN_TAG_PRESENT) { 2770 __vlan_hwaccel_put_tag(skb, vid);
2774 vlan_gro_receive(&np->napi, np->vlangrp,
2775 vlanflags & NV_RX3_VLAN_TAG_MASK, skb);
2776 } else {
2777 napi_gro_receive(&np->napi, skb);
2778 }
2779 } 2771 }
2772 napi_gro_receive(&np->napi, skb);
2780 2773
2781 dev->stats.rx_packets++; 2774 dev->stats.rx_packets++;
2782 dev->stats.rx_bytes += len; 2775 dev->stats.rx_bytes += len;
@@ -4484,6 +4477,27 @@ static u32 nv_fix_features(struct net_device *dev, u32 features)
4484 return features; 4477 return features;
4485} 4478}
4486 4479
4480static void nv_vlan_mode(struct net_device *dev, u32 features)
4481{
4482 struct fe_priv *np = get_nvpriv(dev);
4483
4484 spin_lock_irq(&np->lock);
4485
4486 if (features & NETIF_F_HW_VLAN_RX)
4487 np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP;
4488 else
4489 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP;
4490
4491 if (features & NETIF_F_HW_VLAN_TX)
4492 np->txrxctl_bits |= NVREG_TXRXCTL_VLANINS;
4493 else
4494 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS;
4495
4496 writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
4497
4498 spin_unlock_irq(&np->lock);
4499}
4500
4487static int nv_set_features(struct net_device *dev, u32 features) 4501static int nv_set_features(struct net_device *dev, u32 features)
4488{ 4502{
4489 struct fe_priv *np = netdev_priv(dev); 4503 struct fe_priv *np = netdev_priv(dev);
@@ -4504,6 +4518,9 @@ static int nv_set_features(struct net_device *dev, u32 features)
4504 spin_unlock_irq(&np->lock); 4518 spin_unlock_irq(&np->lock);
4505 } 4519 }
4506 4520
4521 if (changed & (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX))
4522 nv_vlan_mode(dev, features);
4523
4507 return 0; 4524 return 0;
4508} 4525}
4509 4526
@@ -4879,29 +4896,6 @@ static const struct ethtool_ops ops = {
4879 .self_test = nv_self_test, 4896 .self_test = nv_self_test,
4880}; 4897};
4881 4898
4882static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
4883{
4884 struct fe_priv *np = get_nvpriv(dev);
4885
4886 spin_lock_irq(&np->lock);
4887
4888 /* save vlan group */
4889 np->vlangrp = grp;
4890
4891 if (grp) {
4892 /* enable vlan on MAC */
4893 np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP | NVREG_TXRXCTL_VLANINS;
4894 } else {
4895 /* disable vlan on MAC */
4896 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP;
4897 np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS;
4898 }
4899
4900 writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
4901
4902 spin_unlock_irq(&np->lock);
4903}
4904
4905/* The mgmt unit and driver use a semaphore to access the phy during init */ 4899/* The mgmt unit and driver use a semaphore to access the phy during init */
4906static int nv_mgmt_acquire_sema(struct net_device *dev) 4900static int nv_mgmt_acquire_sema(struct net_device *dev)
4907{ 4901{
@@ -5208,7 +5202,6 @@ static const struct net_device_ops nv_netdev_ops = {
5208 .ndo_validate_addr = eth_validate_addr, 5202 .ndo_validate_addr = eth_validate_addr,
5209 .ndo_set_mac_address = nv_set_mac_address, 5203 .ndo_set_mac_address = nv_set_mac_address,
5210 .ndo_set_multicast_list = nv_set_multicast, 5204 .ndo_set_multicast_list = nv_set_multicast,
5211 .ndo_vlan_rx_register = nv_vlan_rx_register,
5212#ifdef CONFIG_NET_POLL_CONTROLLER 5205#ifdef CONFIG_NET_POLL_CONTROLLER
5213 .ndo_poll_controller = nv_poll_controller, 5206 .ndo_poll_controller = nv_poll_controller,
5214#endif 5207#endif
@@ -5226,7 +5219,6 @@ static const struct net_device_ops nv_netdev_ops_optimized = {
5226 .ndo_validate_addr = eth_validate_addr, 5219 .ndo_validate_addr = eth_validate_addr,
5227 .ndo_set_mac_address = nv_set_mac_address, 5220 .ndo_set_mac_address = nv_set_mac_address,
5228 .ndo_set_multicast_list = nv_set_multicast, 5221 .ndo_set_multicast_list = nv_set_multicast,
5229 .ndo_vlan_rx_register = nv_vlan_rx_register,
5230#ifdef CONFIG_NET_POLL_CONTROLLER 5222#ifdef CONFIG_NET_POLL_CONTROLLER
5231 .ndo_poll_controller = nv_poll_controller, 5223 .ndo_poll_controller = nv_poll_controller,
5232#endif 5224#endif