Commit 3326c784 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

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: default avatarJiri Pirko <jpirko@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 5622e404
...@@ -820,9 +820,6 @@ struct fe_priv { ...@@ -820,9 +820,6 @@ struct fe_priv {
struct nv_skb_map *tx_end_flip; struct nv_skb_map *tx_end_flip;
int tx_stop; int tx_stop;
/* vlan fields */
struct vlan_group *vlangrp;
/* msi/msi-x fields */ /* msi/msi-x fields */
u32 msi_flags; u32 msi_flags;
struct msix_entry msi_x_entry[NV_MSI_X_MAX_VECTORS]; 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,17 +2763,13 @@ static int nv_rx_process_optimized(struct net_device *dev, int limit)
skb->protocol = eth_type_trans(skb, dev); skb->protocol = eth_type_trans(skb, dev);
prefetch(skb->data); prefetch(skb->data);
if (likely(!np->vlangrp)) {
napi_gro_receive(&np->napi, skb);
} else {
vlanflags = le32_to_cpu(np->get_rx.ex->buflow); vlanflags = le32_to_cpu(np->get_rx.ex->buflow);
if (vlanflags & NV_RX3_VLAN_TAG_PRESENT) { if (vlanflags & NV_RX3_VLAN_TAG_PRESENT) {
vlan_gro_receive(&np->napi, np->vlangrp, u16 vid = vlanflags & NV_RX3_VLAN_TAG_MASK;
vlanflags & NV_RX3_VLAN_TAG_MASK, skb);
} else { __vlan_hwaccel_put_tag(skb, vid);
napi_gro_receive(&np->napi, skb);
}
} }
napi_gro_receive(&np->napi, skb);
dev->stats.rx_packets++; dev->stats.rx_packets++;
dev->stats.rx_bytes += len; dev->stats.rx_bytes += len;
...@@ -4484,6 +4477,27 @@ static u32 nv_fix_features(struct net_device *dev, u32 features) ...@@ -4484,6 +4477,27 @@ static u32 nv_fix_features(struct net_device *dev, u32 features)
return features; return features;
} }
static void nv_vlan_mode(struct net_device *dev, u32 features)
{
struct fe_priv *np = get_nvpriv(dev);
spin_lock_irq(&np->lock);
if (features & NETIF_F_HW_VLAN_RX)
np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP;
else
np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP;
if (features & NETIF_F_HW_VLAN_TX)
np->txrxctl_bits |= NVREG_TXRXCTL_VLANINS;
else
np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS;
writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
spin_unlock_irq(&np->lock);
}
static int nv_set_features(struct net_device *dev, u32 features) static int nv_set_features(struct net_device *dev, u32 features)
{ {
struct fe_priv *np = netdev_priv(dev); struct fe_priv *np = netdev_priv(dev);
...@@ -4504,6 +4518,9 @@ static int nv_set_features(struct net_device *dev, u32 features) ...@@ -4504,6 +4518,9 @@ static int nv_set_features(struct net_device *dev, u32 features)
spin_unlock_irq(&np->lock); spin_unlock_irq(&np->lock);
} }
if (changed & (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX))
nv_vlan_mode(dev, features);
return 0; return 0;
} }
...@@ -4879,29 +4896,6 @@ static const struct ethtool_ops ops = { ...@@ -4879,29 +4896,6 @@ static const struct ethtool_ops ops = {
.self_test = nv_self_test, .self_test = nv_self_test,
}; };
static void nv_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
{
struct fe_priv *np = get_nvpriv(dev);
spin_lock_irq(&np->lock);
/* save vlan group */
np->vlangrp = grp;
if (grp) {
/* enable vlan on MAC */
np->txrxctl_bits |= NVREG_TXRXCTL_VLANSTRIP | NVREG_TXRXCTL_VLANINS;
} else {
/* disable vlan on MAC */
np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANSTRIP;
np->txrxctl_bits &= ~NVREG_TXRXCTL_VLANINS;
}
writel(np->txrxctl_bits, get_hwbase(dev) + NvRegTxRxControl);
spin_unlock_irq(&np->lock);
}
/* The mgmt unit and driver use a semaphore to access the phy during init */ /* The mgmt unit and driver use a semaphore to access the phy during init */
static int nv_mgmt_acquire_sema(struct net_device *dev) static int nv_mgmt_acquire_sema(struct net_device *dev)
{ {
...@@ -5208,7 +5202,6 @@ static const struct net_device_ops nv_netdev_ops = { ...@@ -5208,7 +5202,6 @@ static const struct net_device_ops nv_netdev_ops = {
.ndo_validate_addr = eth_validate_addr, .ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = nv_set_mac_address, .ndo_set_mac_address = nv_set_mac_address,
.ndo_set_multicast_list = nv_set_multicast, .ndo_set_multicast_list = nv_set_multicast,
.ndo_vlan_rx_register = nv_vlan_rx_register,
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = nv_poll_controller, .ndo_poll_controller = nv_poll_controller,
#endif #endif
...@@ -5226,7 +5219,6 @@ static const struct net_device_ops nv_netdev_ops_optimized = { ...@@ -5226,7 +5219,6 @@ static const struct net_device_ops nv_netdev_ops_optimized = {
.ndo_validate_addr = eth_validate_addr, .ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = nv_set_mac_address, .ndo_set_mac_address = nv_set_mac_address,
.ndo_set_multicast_list = nv_set_multicast, .ndo_set_multicast_list = nv_set_multicast,
.ndo_vlan_rx_register = nv_vlan_rx_register,
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = nv_poll_controller, .ndo_poll_controller = nv_poll_controller,
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment