Netdev List
 help / color / mirror / Atom feed
* [PATCH 001/001] forcedeth: Don't enable hardware vlan support on hardware that doesn't support it
@ 2011-06-15 20:17 Antoine Reversat
  0 siblings, 0 replies; 4+ messages in thread
From: Antoine Reversat @ 2011-06-15 20:17 UTC (permalink / raw)
  To: netdev

In the forcedeth driver hardware vlan support is used even on hardware
that doesn't support it leading to incorrect tagging of some packets
when using vlan.

Signed-off-by: Antoine Reversat <a.reversat@gmail.com>
---
--- linux-2.6.39/drivers/net/forcedeth.c	2011-05-19 00:06:34.000000000 -0400
+++ linux-2.6.39-fixed/drivers/net/forcedeth.c	2011-06-15
15:57:45.331158001 -0400
@@ -4915,6 +4915,10 @@ static void nv_vlan_rx_register(struct n
 {
 	struct fe_priv *np = get_nvpriv(dev);

+	/* Don't do anything if device doesn't support VLAN */
+	if (!(np->driver_data & DEV_HAS_VLAN))
+		return;
+
 	spin_lock_irq(&np->lock);

 	/* save vlan group */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 001/001] forcedeth: Don't enable hardware vlan support on hardware that doesn't support it
       [not found] <25664046.71236.1308171027618.JavaMail.root@tahiti.vyatta.com>
@ 2011-06-15 20:53 ` Stephen Hemminger
  2011-06-15 21:08   ` Antoine Reversat
  0 siblings, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2011-06-15 20:53 UTC (permalink / raw)
  To: Antoine Reversat; +Cc: netdev


> In the forcedeth driver hardware vlan support is used even on hardware
> that doesn't support it leading to incorrect tagging of some packets
> when using vlan.
> 
> Signed-off-by: Antoine Reversat <a.reversat@gmail.com>
> ---
> --- linux-2.6.39/drivers/net/forcedeth.c 2011-05-19 00:06:34.000000000
> -0400 +++ linux-2.6.39-fixed/drivers/net/forcedeth.c 2011-06-15
> 15:57:45.331158001 -0400
> @@ -4915,6 +4915,10 @@ static void nv_vlan_rx_register(struct n
> { struct fe_priv *np = get_nvpriv(dev);
> 
> + /* Don't do anything if device doesn't support VLAN */
> + if (!(np->driver_data & DEV_HAS_VLAN))
> + return;
> + spin_lock_irq(&np->lock);
> 
> /* save vlan group */

This shouldn't be necessary. rx_register should not be called
unless NETIF_F_HW_VLAN_RX is set; and device should not be setting
NETIF_F_HW_VLAN_RX unless DEV_HAS_VLAN is set.

The real problem is vlan_dev.c, and applies to all devices.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 001/001] forcedeth: Don't enable hardware vlan support on hardware that doesn't support it
  2011-06-15 20:53 ` [PATCH 001/001] forcedeth: Don't enable hardware vlan support on hardware that doesn't support it Stephen Hemminger
@ 2011-06-15 21:08   ` Antoine Reversat
  2011-06-16 15:42     ` Stephen Hemminger
  0 siblings, 1 reply; 4+ messages in thread
From: Antoine Reversat @ 2011-06-15 21:08 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev

On Wed, Jun 15, 2011 at 4:53 PM, Stephen Hemminger
<stephen.hemminger@vyatta.com> wrote:
>
> This shouldn't be necessary. rx_register should not be called
> unless NETIF_F_HW_VLAN_RX is set; and device should not be setting
> NETIF_F_HW_VLAN_RX unless DEV_HAS_VLAN is set.

I can confirm that rx_register gets called on hardware that doesn't
have vlan support (namely MCP79).

>From what I can see in vlan.c (in register_vlan_dev) there is no check
on the features of the device before calling the register function :

    if (ngrp) {
        if (ops->ndo_vlan_rx_register)
            ops->ndo_vlan_rx_register(real_dev, ngrp);
        rcu_assign_pointer(real_dev->vlgrp, ngrp);
    }

If the function exists, it's called. Should I send a patch to call the
function only if the hardware supports it ?

>
> The real problem is vlan_dev.c, and applies to all devices.
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 001/001] forcedeth: Don't enable hardware vlan support on hardware that doesn't support it
  2011-06-15 21:08   ` Antoine Reversat
@ 2011-06-16 15:42     ` Stephen Hemminger
  0 siblings, 0 replies; 4+ messages in thread
From: Stephen Hemminger @ 2011-06-16 15:42 UTC (permalink / raw)
  To: Antoine Reversat; +Cc: Stephen Hemminger, netdev

On Wed, 15 Jun 2011 17:08:18 -0400
Antoine Reversat <a.reversat@gmail.com> wrote:

> On Wed, Jun 15, 2011 at 4:53 PM, Stephen Hemminger
> <stephen.hemminger@vyatta.com> wrote:
> >
> > This shouldn't be necessary. rx_register should not be called
> > unless NETIF_F_HW_VLAN_RX is set; and device should not be setting
> > NETIF_F_HW_VLAN_RX unless DEV_HAS_VLAN is set.
> 
> I can confirm that rx_register gets called on hardware that doesn't
> have vlan support (namely MCP79).
> 
> From what I can see in vlan.c (in register_vlan_dev) there is no check
> on the features of the device before calling the register function :
> 
>     if (ngrp) {
>         if (ops->ndo_vlan_rx_register)
>             ops->ndo_vlan_rx_register(real_dev, ngrp);
>         rcu_assign_pointer(real_dev->vlgrp, ngrp);
>     }
> 
> If the function exists, it's called. Should I send a patch to call the
> function only if the hardware supports it ?
> 
> >
> > The real problem is vlan_dev.c, and applies to all devices.

That is was suggesting because other drivers may have the same issue
where they need to define rx_register for some hardware and control
usage of vlan by the feature bits.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-06-16 15:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <25664046.71236.1308171027618.JavaMail.root@tahiti.vyatta.com>
2011-06-15 20:53 ` [PATCH 001/001] forcedeth: Don't enable hardware vlan support on hardware that doesn't support it Stephen Hemminger
2011-06-15 21:08   ` Antoine Reversat
2011-06-16 15:42     ` Stephen Hemminger
2011-06-15 20:17 Antoine Reversat

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox