cxgb4: update to utilize the newer VLAN infrastructure
authorDimitris Michailidis <dm@chelsio.com>
Thu, 21 Oct 2010 11:29:56 +0000 (11:29 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sun, 24 Oct 2010 22:52:31 +0000 (15:52 -0700)
Signed-off-by: Dimitris Michailidis <dm@chelsio.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/cxgb4/cxgb4.h
drivers/net/cxgb4/cxgb4_main.c
drivers/net/cxgb4/sge.c

index eaa49e4119f146c047903a37dfda408086910faa..3d4253d311eb50972c3037fb5e7b52ef2b18395b 100644 (file)
@@ -281,7 +281,6 @@ struct sge_rspq;
 
 struct port_info {
        struct adapter *adapter;
-       struct vlan_group *vlan_grp;
        u16    viid;
        s16    xact_addr_filt;        /* index of exact MAC address filter */
        u16    rss_size;              /* size of VI's RSS table slice */
index 2a01a23ed409cc1f9059f6ca952786aec03b92fc..f17703f410b3673a096aec05f9085329650c5c52 100644 (file)
@@ -403,7 +403,7 @@ static int link_start(struct net_device *dev)
         * that step explicitly.
         */
        ret = t4_set_rxmode(pi->adapter, mb, pi->viid, dev->mtu, -1, -1, -1,
-                           pi->vlan_grp != NULL, true);
+                           !!(dev->features & NETIF_F_HW_VLAN_RX), true);
        if (ret == 0) {
                ret = t4_change_mac(pi->adapter, mb, pi->viid,
                                    pi->xact_addr_filt, dev->dev_addr, true,
@@ -1881,7 +1881,24 @@ static int set_tso(struct net_device *dev, u32 value)
 
 static int set_flags(struct net_device *dev, u32 flags)
 {
-       return ethtool_op_set_flags(dev, flags, ETH_FLAG_RXHASH);
+       int err;
+       unsigned long old_feat = dev->features;
+
+       err = ethtool_op_set_flags(dev, flags, ETH_FLAG_RXHASH |
+                                  ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN);
+       if (err)
+               return err;
+
+       if ((old_feat ^ dev->features) & NETIF_F_HW_VLAN_RX) {
+               const struct port_info *pi = netdev_priv(dev);
+
+               err = t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1,
+                                   -1, -1, -1, !!(flags & ETH_FLAG_RXVLAN),
+                                   true);
+               if (err)
+                       dev->features = old_feat;
+       }
+       return err;
 }
 
 static int get_rss_table(struct net_device *dev, struct ethtool_rxfh_indir *p)
@@ -2842,15 +2859,6 @@ static int cxgb_set_mac_addr(struct net_device *dev, void *p)
        return 0;
 }
 
-static void vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
-{
-       struct port_info *pi = netdev_priv(dev);
-
-       pi->vlan_grp = grp;
-       t4_set_rxmode(pi->adapter, pi->adapter->fn, pi->viid, -1, -1, -1, -1,
-                     grp != NULL, true);
-}
-
 #ifdef CONFIG_NET_POLL_CONTROLLER
 static void cxgb_netpoll(struct net_device *dev)
 {
@@ -2878,7 +2886,6 @@ static const struct net_device_ops cxgb4_netdev_ops = {
        .ndo_validate_addr    = eth_validate_addr,
        .ndo_do_ioctl         = cxgb_ioctl,
        .ndo_change_mtu       = cxgb_change_mtu,
-       .ndo_vlan_rx_register = vlan_rx_register,
 #ifdef CONFIG_NET_POLL_CONTROLLER
        .ndo_poll_controller  = cxgb_netpoll,
 #endif
index 9967f3debce7e1010bd6ff58df5d6ad2060543d3..17022258ed689101e940ce977c57a4c5540f9e98 100644 (file)
@@ -1530,18 +1530,11 @@ static void do_gro(struct sge_eth_rxq *rxq, const struct pkt_gl *gl,
                skb->rxhash = (__force u32)pkt->rsshdr.hash_val;
 
        if (unlikely(pkt->vlan_ex)) {
-               struct port_info *pi = netdev_priv(rxq->rspq.netdev);
-               struct vlan_group *grp = pi->vlan_grp;
-
+               __vlan_hwaccel_put_tag(skb, ntohs(pkt->vlan));
                rxq->stats.vlan_ex++;
-               if (likely(grp)) {
-                       ret = vlan_gro_frags(&rxq->rspq.napi, grp,
-                                            ntohs(pkt->vlan));
-                       goto stats;
-               }
        }
        ret = napi_gro_frags(&rxq->rspq.napi);
-stats: if (ret == GRO_HELD)
+       if (ret == GRO_HELD)
                rxq->stats.lro_pkts++;
        else if (ret == GRO_MERGED || ret == GRO_MERGED_FREE)
                rxq->stats.lro_merged++;
@@ -1608,16 +1601,10 @@ int t4_ethrx_handler(struct sge_rspq *q, const __be64 *rsp,
                skb_checksum_none_assert(skb);
 
        if (unlikely(pkt->vlan_ex)) {
-               struct vlan_group *grp = pi->vlan_grp;
-
+               __vlan_hwaccel_put_tag(skb, ntohs(pkt->vlan));
                rxq->stats.vlan_ex++;
-               if (likely(grp))
-                       vlan_hwaccel_receive_skb(skb, grp, ntohs(pkt->vlan));
-               else
-                       dev_kfree_skb_any(skb);
-       } else
-               netif_receive_skb(skb);
-
+       }
+       netif_receive_skb(skb);
        return 0;
 }