Patchwork when the MTU interface is modified, the promiscuous mode is reset in gianfar driver

login
register
mail settings
Submitter 近沢 =?ISO-2022-JP?B?IBskQkUvO0sbKEI=?=
Date Aug. 27, 2012, 8:38 a.m.
Message ID <201208270838.AA02326@VF09040P.jp.fujitsu.com>
Download mbox | patch
Permalink /patch/180156/
State Changes Requested
Delegated to: David Miller
Headers show

Comments

Hi

 I am using the gianfar ethernet driver. I am having a problem with the
 interface settings.
 Under promiscuous mode, when the MTU interface is modified, the promiscuous
 mode setting is turned off in gianfar driver when it should not be.
The details are as follows:
 After changing MTU with ifconfig, I could see that the interface flag of
 eth0 is still PROMISC.
 However, when I checked value of RCTL register with ethtool, PROM bit of
 RTCL register is cleared.
 It seems to be cause that is the gfar_init_mac() function, it doesn't set
 the PROM bit after the interface MTU is changed.
 This problem was detected on linux-2.6.32.2, but it seems to same on
 linux-3.6.0-rc3.
Is this behavior on purpose?

I also attach the amended file,I think it would be so.

Signed-off-by: Akifumi Chikazawa <chikazawa.akifu@jp.fujitsu.com>
---
 gianfar.c |    3 +++
 1 file changed, 3 insertions(+)

-----------
Fujitsu Computer Technologies Limited
Firmware Engineering Dept.

Akifumi Chikazawa
email: chikazawa.akifu@jp.fujitsu.com



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller - Sept. 3, 2012, 7:53 p.m.
From: chikazawa.akifu@jp.fujitsu.com (近沢 哲史)
Date: Mon, 27 Aug 2012 17:38:34 +0900

>  I am using the gianfar ethernet driver. I am having a problem with the
>  interface settings.
>  Under promiscuous mode, when the MTU interface is modified, the promiscuous
>  mode setting is turned off in gianfar driver when it should not be.
> The details are as follows:
>  After changing MTU with ifconfig, I could see that the interface flag of
>  eth0 is still PROMISC.
>  However, when I checked value of RCTL register with ethtool, PROM bit of
>  RTCL register is cleared.
>  It seems to be cause that is the gfar_init_mac() function, it doesn't set
>  the PROM bit after the interface MTU is changed.
>  This problem was detected on linux-2.6.32.2, but it seems to same on
>  linux-3.6.0-rc3.
> Is this behavior on purpose?
> 
> I also attach the amended file,I think it would be so.
> 
> Signed-off-by: Akifumi Chikazawa <chikazawa.akifu@jp.fujitsu.com>

It seems like we also lose all of the multicast configurations as
well.

Therefore, the thing to do is to simply call gfar_set_multi() at the
appropriate location.  That will take care of both the promiscuous
bit, as well as the multicast addresses.

You can then remove some of the code in gfar_init_mac() that does
things like gfar_clear_exact_match(), because gfar_set_multi() will
take care of that if necessary.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 4605f72..6991e0e 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -389,6 +389,9 @@  static void gfar_init_mac(struct net_device *ndev)
        if (ndev->features & NETIF_F_HW_VLAN_RX)
                rctrl |= RCTRL_VLEX | RCTRL_PRSDEP_INIT;

+       if (ndev->flags & IFF_PROMISC)
+               rctrl |= RCTRL_PROM;
+
        /* Init rctrl based on our settings */
        gfar_write(&regs->rctrl, rctrl);