Commit 133b0851 authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

chelsio: do vlan cleanup

- unify vlan and nonvlan rx path
- kill adapter->vlan_grp and t1_vlan_rx_register
- allow to turn on/off rx/tx 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 f859d7cb
...@@ -240,8 +240,6 @@ struct adapter { ...@@ -240,8 +240,6 @@ struct adapter {
struct work_struct ext_intr_handler_task; struct work_struct ext_intr_handler_task;
struct adapter_params params; struct adapter_params params;
struct vlan_group *vlan_grp;
/* Terminator modules. */ /* Terminator modules. */
struct sge *sge; struct sge *sge;
struct peespi *espi; struct peespi *espi;
......
...@@ -263,6 +263,8 @@ static int cxgb_open(struct net_device *dev) ...@@ -263,6 +263,8 @@ static int cxgb_open(struct net_device *dev)
if (!other_ports && adapter->params.stats_update_period) if (!other_ports && adapter->params.stats_update_period)
schedule_mac_stats_update(adapter, schedule_mac_stats_update(adapter,
adapter->params.stats_update_period); adapter->params.stats_update_period);
t1_vlan_mode(adapter, dev->features);
return 0; return 0;
} }
...@@ -849,19 +851,30 @@ static int t1_set_mac_addr(struct net_device *dev, void *p) ...@@ -849,19 +851,30 @@ static int t1_set_mac_addr(struct net_device *dev, void *p)
return 0; return 0;
} }
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) static u32 t1_fix_features(struct net_device *dev, u32 features)
static void t1_vlan_rx_register(struct net_device *dev,
struct vlan_group *grp)
{ {
struct adapter *adapter = dev->ml_priv; /*
* Since there is no support for separate rx/tx vlan accel
* enable/disable make sure tx flag is always in same state as rx.
*/
if (features & NETIF_F_HW_VLAN_RX)
features |= NETIF_F_HW_VLAN_TX;
else
features &= ~NETIF_F_HW_VLAN_TX;
spin_lock_irq(&adapter->async_lock); return features;
adapter->vlan_grp = grp;
t1_set_vlan_accel(adapter, grp != NULL);
spin_unlock_irq(&adapter->async_lock);
} }
#endif
static int t1_set_features(struct net_device *dev, u32 features)
{
u32 changed = dev->features ^ features;
struct adapter *adapter = dev->ml_priv;
if (changed & NETIF_F_HW_VLAN_RX)
t1_vlan_mode(adapter, features);
return 0;
}
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
static void t1_netpoll(struct net_device *dev) static void t1_netpoll(struct net_device *dev)
{ {
...@@ -955,9 +968,8 @@ static const struct net_device_ops cxgb_netdev_ops = { ...@@ -955,9 +968,8 @@ static const struct net_device_ops cxgb_netdev_ops = {
.ndo_do_ioctl = t1_ioctl, .ndo_do_ioctl = t1_ioctl,
.ndo_change_mtu = t1_change_mtu, .ndo_change_mtu = t1_change_mtu,
.ndo_set_mac_address = t1_set_mac_addr, .ndo_set_mac_address = t1_set_mac_addr,
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) .ndo_fix_features = t1_fix_features,
.ndo_vlan_rx_register = t1_vlan_rx_register, .ndo_set_features = t1_set_features,
#endif
#ifdef CONFIG_NET_POLL_CONTROLLER #ifdef CONFIG_NET_POLL_CONTROLLER
.ndo_poll_controller = t1_netpoll, .ndo_poll_controller = t1_netpoll,
#endif #endif
...@@ -1080,10 +1092,9 @@ static int __devinit init_one(struct pci_dev *pdev, ...@@ -1080,10 +1092,9 @@ static int __devinit init_one(struct pci_dev *pdev,
if (pci_using_dac) if (pci_using_dac)
netdev->features |= NETIF_F_HIGHDMA; netdev->features |= NETIF_F_HIGHDMA;
if (vlan_tso_capable(adapter)) { if (vlan_tso_capable(adapter)) {
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
netdev->features |= netdev->features |=
NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX; NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX;
#endif netdev->hw_features |= NETIF_F_HW_VLAN_RX;
/* T204: disable TSO */ /* T204: disable TSO */
if (!(is_T2(adapter)) || bi->port_number != 4) { if (!(is_T2(adapter)) || bi->port_number != 4) {
......
...@@ -742,13 +742,14 @@ static inline void setup_ring_params(struct adapter *adapter, u64 addr, ...@@ -742,13 +742,14 @@ static inline void setup_ring_params(struct adapter *adapter, u64 addr,
/* /*
* Enable/disable VLAN acceleration. * Enable/disable VLAN acceleration.
*/ */
void t1_set_vlan_accel(struct adapter *adapter, int on_off) void t1_vlan_mode(struct adapter *adapter, u32 features)
{ {
struct sge *sge = adapter->sge; struct sge *sge = adapter->sge;
sge->sge_control &= ~F_VLAN_XTRACT; if (features & NETIF_F_HW_VLAN_RX)
if (on_off)
sge->sge_control |= F_VLAN_XTRACT; sge->sge_control |= F_VLAN_XTRACT;
else
sge->sge_control &= ~F_VLAN_XTRACT;
if (adapter->open_device_map) { if (adapter->open_device_map) {
writel(sge->sge_control, adapter->regs + A_SG_CONTROL); writel(sge->sge_control, adapter->regs + A_SG_CONTROL);
readl(adapter->regs + A_SG_CONTROL); /* flush */ readl(adapter->regs + A_SG_CONTROL); /* flush */
...@@ -1397,11 +1398,10 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len) ...@@ -1397,11 +1398,10 @@ static void sge_rx(struct sge *sge, struct freelQ *fl, unsigned int len)
} else } else
skb_checksum_none_assert(skb); skb_checksum_none_assert(skb);
if (unlikely(adapter->vlan_grp && p->vlan_valid)) { if (p->vlan_valid) {
st->vlan_xtract++; st->vlan_xtract++;
vlan_hwaccel_receive_skb(skb, adapter->vlan_grp, __vlan_hwaccel_put_tag(skb, ntohs(p->vlan));
ntohs(p->vlan)); }
} else
netif_receive_skb(skb); netif_receive_skb(skb);
} }
...@@ -1875,13 +1875,11 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev) ...@@ -1875,13 +1875,11 @@ netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev)
} }
cpl->iff = dev->if_port; cpl->iff = dev->if_port;
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
if (vlan_tx_tag_present(skb)) { if (vlan_tx_tag_present(skb)) {
cpl->vlan_valid = 1; cpl->vlan_valid = 1;
cpl->vlan = htons(vlan_tx_tag_get(skb)); cpl->vlan = htons(vlan_tx_tag_get(skb));
st->vlan_insert++; st->vlan_insert++;
} else } else
#endif
cpl->vlan_valid = 0; cpl->vlan_valid = 0;
send: send:
......
...@@ -79,7 +79,7 @@ irqreturn_t t1_interrupt(int irq, void *cookie); ...@@ -79,7 +79,7 @@ irqreturn_t t1_interrupt(int irq, void *cookie);
int t1_poll(struct napi_struct *, int); int t1_poll(struct napi_struct *, int);
netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev); netdev_tx_t t1_start_xmit(struct sk_buff *skb, struct net_device *dev);
void t1_set_vlan_accel(struct adapter *adapter, int on_off); void t1_vlan_mode(struct adapter *adapter, u32 features);
void t1_sge_start(struct sge *); void t1_sge_start(struct sge *);
void t1_sge_stop(struct sge *); void t1_sge_stop(struct sge *);
int t1_sge_intr_error_handler(struct sge *); int t1_sge_intr_error_handler(struct sge *);
......
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