Subject: Re: [PATCH 2/2] sky2: convert to new VLAN model

From: Stephen Hemminger <[email-masked]>
Date: Fri, 7 Jan 2011 09:27:58 -0800

On Fri, 7 Jan 2011 12:14:51 -0500
Jesse Gross <[email-masked]> wrote:

> On Thu, Jan 6, 2011 at 11:41 PM, Stephen Hemminger
> <[email-masked]> wrote:
> > +/* Features available on VLAN with transmit tag stripped */
> > +#define VLAN_FEAT (NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_TSO)
> > +
> > +static void sky2_vlan_mode(struct net_device *dev)
> >  {
> > -       if (onoff) {
> > +       struct sky2_port *sky2 = netdev_priv(dev);
> > +       struct sky2_hw *hw = sky2->hw;
> > +       u16 port = sky2->port;
> > +
> > +       if (dev->features & NETIF_F_HW_VLAN_RX)
> >                sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
> >                             RX_VLAN_STRIP_ON);
> > +       else
> > +               sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
> > +                            RX_VLAN_STRIP_OFF);
> > +
> > +       if (dev->features & NETIF_F_HW_VLAN_TX) {
> >                sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
> >                             TX_VLAN_TAG_ON);
> > +               dev->vlan_features = dev->features & VLAN_FEAT;
> >        } else {
> > -               sky2_write32(hw, SK_REG(port, RX_GMF_CTRL_T),
> > -                            RX_VLAN_STRIP_OFF);
> >                sky2_write32(hw, SK_REG(port, TX_GMF_CTRL_T),
> >                             TX_VLAN_TAG_OFF);
> > +               dev->vlan_features = dev->features & NETIF_F_HIGHDMA;
> 
> Hmm, the chip supports SG only when TX vlan is on and HIGHDMA only
> when it is off?  Currently skb_needs_linearize() assumes that when not
> using vlan acceleration, the DMA engine doesn't care about the
> presence of a vlan tag and directly uses dev->features.

The chip supports checksum offload only if TX_VLAN is enabled.
Scatter/gather without checksum offload is not allowed by kernel
because checksum offload is needed for sendfile.

highdma should always be on

> Also, can't we enable NETIF_F_GRO in vlan_features?  It will be set
> initially by register_netdevice() but if we change the flags it gets
> blown away.

I will revise. GRO is independent of all this.

--