Netdev List
 help / color / mirror / Atom feed
* [PATCH net 3/4] bridge: Fix the way the PVID is referenced
From: Toshiaki Makita @ 2013-09-10 10:37 UTC (permalink / raw)
  To: David S. Miller, Vlad Yasevich, netdev; +Cc: Toshiaki Makita
In-Reply-To: <1378808874.3988.2.camel@ubuntu-vm-makita>

We are using the VLAN_TAG_PRESENT bit to detect whether the PVID is
set or not at br_get_pvid(), while we don't care about the bit in
adding/deleting the PVID, which makes it impossible to forward any
incomming untagged frame with vlan_filtering enabled.

Since vid 0 cannot be used for the PVID, we can use vid 0 to indicate
that the PVID is not set, which is slightly more efficient than using
the VLAN_TAG_PRESENT.

Fix the problem by getting rid of using the VLAN_TAG_PRESENT.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---
 net/bridge/br_private.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 598cb0b..435ca4d 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -646,9 +646,7 @@ static inline u16 br_get_pvid(const struct net_port_vlans *v)
 	 * vid wasn't set
 	 */
 	smp_rmb();
-	return (v->pvid & VLAN_TAG_PRESENT) ?
-			(v->pvid & ~VLAN_TAG_PRESENT) :
-			VLAN_N_VID;
+	return v->pvid ?: VLAN_N_VID;
 }
 
 #else
-- 
1.8.1.2

^ permalink raw reply related

* [PATCH net 2/4] bridge: Handle priority-tagged frames properly
From: Toshiaki Makita @ 2013-09-10 10:34 UTC (permalink / raw)
  To: David S. Miller, Vlad Yasevich, netdev; +Cc: Toshiaki Makita
In-Reply-To: <1378808874.3988.2.camel@ubuntu-vm-makita>

IEEE 802.1Q says that when we receive priority-tagged (VID 0) frames
use the PVID for the port as its VID.
(See IEEE 802.1Q-2005 6.7.1 and Table 9-2)

Apply the PVID to not only untagged frames but also priority-tagged frames.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---
 net/bridge/br_vlan.c | 27 ++++++++++++++++++++-------
 1 file changed, 20 insertions(+), 7 deletions(-)

diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 21b6d21..5a9c44a 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -189,6 +189,8 @@ out:
 bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
 			struct sk_buff *skb, u16 *vid)
 {
+	int err;
+
 	/* If VLAN filtering is disabled on the bridge, all packets are
 	 * permitted.
 	 */
@@ -201,20 +203,31 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
 	if (!v)
 		return false;
 
-	if (br_vlan_get_tag(skb, vid)) {
+	err = br_vlan_get_tag(skb, vid);
+	if (!*vid) {
 		u16 pvid = br_get_pvid(v);
 
-		/* Frame did not have a tag.  See if pvid is set
-		 * on this port.  That tells us which vlan untagged
-		 * traffic belongs to.
+		/* Frame had a tag with VID 0 or did not have a tag.
+		 * See if pvid is set on this port.  That tells us which
+		 * vlan untagged or priority-tagged traffic belongs to.
 		 */
 		if (pvid == VLAN_N_VID)
 			return false;
 
-		/* PVID is set on this port.  Any untagged ingress
-		 * frame is considered to belong to this vlan.
+		/* PVID is set on this port.  Any untagged or priority-tagged
+		 * ingress frame is considered to belong to this vlan.
 		 */
-		__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), pvid);
+		if (likely(err))
+			/* Untagged Frame. */
+			__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q), pvid);
+		else
+			/* Priority-tagged Frame.
+			 * At this point, We know that skb->vlan_tci had
+			 * VLAN_TAG_PRESENT bit and its VID field was 0x000.
+			 * We update only VID field and preserve PCP field.
+			 */
+			skb->vlan_tci |= pvid;
+
 		return true;
 	}
 
-- 
1.8.1.2

^ permalink raw reply related

* [PATCH net 1/4] bridge: Don't use VID 0 and 4095 in vlan filtering
From: Toshiaki Makita @ 2013-09-10 10:32 UTC (permalink / raw)
  To: David S. Miller, Vlad Yasevich, netdev; +Cc: Toshiaki Makita
In-Reply-To: <1378808874.3988.2.camel@ubuntu-vm-makita>

IEEE 802.1Q says that:
- VID 0 shall not be configured as a PVID, or configured in any Filtering
Database entry.
- VID 4095 shall not be configured as a PVID, or transmitted in a tag
header. This VID value may be used to indicate a wildcard match for the VID
in management operations or Filtering Database entries.
(See IEEE 802.1Q-2005 6.7.1 and Table 9-2)

Don't accept adding these VIDs in the vlan_filtering implementation.

Signed-off-by: Toshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
---
 net/bridge/br_fdb.c     |  4 +-
 net/bridge/br_netlink.c |  2 +-
 net/bridge/br_vlan.c    | 97 +++++++++++++++++++++++--------------------------
 3 files changed, 49 insertions(+), 54 deletions(-)

diff --git a/net/bridge/br_fdb.c b/net/bridge/br_fdb.c
index ffd5874..33e8f23 100644
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@ -700,7 +700,7 @@ int br_fdb_add(struct ndmsg *ndm, struct nlattr *tb[],
 
 		vid = nla_get_u16(tb[NDA_VLAN]);
 
-		if (vid >= VLAN_N_VID) {
+		if (!vid || vid >= VLAN_VID_MASK) {
 			pr_info("bridge: RTM_NEWNEIGH with invalid vlan id %d\n",
 				vid);
 			return -EINVAL;
@@ -794,7 +794,7 @@ int br_fdb_delete(struct ndmsg *ndm, struct nlattr *tb[],
 
 		vid = nla_get_u16(tb[NDA_VLAN]);
 
-		if (vid >= VLAN_N_VID) {
+		if (!vid || vid >= VLAN_VID_MASK) {
 			pr_info("bridge: RTM_NEWNEIGH with invalid vlan id %d\n",
 				vid);
 			return -EINVAL;
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index b9259ef..9bac61e 100644
--- a/net/bridge/br_netlink.c
+++ b/net/bridge/br_netlink.c
@@ -243,7 +243,7 @@ static int br_afspec(struct net_bridge *br,
 
 		vinfo = nla_data(tb[IFLA_BRIDGE_VLAN_INFO]);
 
-		if (vinfo->vid >= VLAN_N_VID)
+		if (!vinfo->vid || vinfo->vid >= VLAN_VID_MASK)
 			return -EINVAL;
 
 		switch (cmd) {
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 9a9ffe7..21b6d21 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -45,37 +45,34 @@ static int __vlan_add(struct net_port_vlans *v, u16 vid, u16 flags)
 		return 0;
 	}
 
-	if (vid) {
-		if (v->port_idx) {
-			p = v->parent.port;
-			br = p->br;
-			dev = p->dev;
-		} else {
-			br = v->parent.br;
-			dev = br->dev;
-		}
-		ops = dev->netdev_ops;
-
-		if (p && (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) {
-			/* Add VLAN to the device filter if it is supported.
-			 * Stricly speaking, this is not necessary now, since
-			 * devices are made promiscuous by the bridge, but if
-			 * that ever changes this code will allow tagged
-			 * traffic to enter the bridge.
-			 */
-			err = ops->ndo_vlan_rx_add_vid(dev, htons(ETH_P_8021Q),
-						       vid);
-			if (err)
-				return err;
-		}
-
-		err = br_fdb_insert(br, p, dev->dev_addr, vid);
-		if (err) {
-			br_err(br, "failed insert local address into bridge "
-			       "forwarding table\n");
-			goto out_filt;
-		}
+	if (v->port_idx) {
+		p = v->parent.port;
+		br = p->br;
+		dev = p->dev;
+	} else {
+		br = v->parent.br;
+		dev = br->dev;
+	}
+	ops = dev->netdev_ops;
+
+	if (p && (dev->features & NETIF_F_HW_VLAN_CTAG_FILTER)) {
+		/* Add VLAN to the device filter if it is supported.
+		 * Stricly speaking, this is not necessary now, since
+		 * devices are made promiscuous by the bridge, but if
+		 * that ever changes this code will allow tagged
+		 * traffic to enter the bridge.
+		 */
+		err = ops->ndo_vlan_rx_add_vid(dev, htons(ETH_P_8021Q),
+					       vid);
+		if (err)
+			return err;
+	}
 
+	err = br_fdb_insert(br, p, dev->dev_addr, vid);
+	if (err) {
+		br_err(br, "failed insert local address into bridge "
+		       "forwarding table\n");
+		goto out_filt;
 	}
 
 	set_bit(vid, v->vlan_bitmap);
@@ -98,7 +95,7 @@ static int __vlan_del(struct net_port_vlans *v, u16 vid)
 	__vlan_delete_pvid(v, vid);
 	clear_bit(vid, v->untagged_bitmap);
 
-	if (v->port_idx && vid) {
+	if (v->port_idx) {
 		struct net_device *dev = v->parent.port->dev;
 		const struct net_device_ops *ops = dev->netdev_ops;
 
@@ -248,7 +245,9 @@ bool br_allowed_egress(struct net_bridge *br,
 	return false;
 }
 
-/* Must be protected by RTNL */
+/* Must be protected by RTNL.
+ * Must be called with vid in range from 1 to 4094 inclusive.
+ */
 int br_vlan_add(struct net_bridge *br, u16 vid, u16 flags)
 {
 	struct net_port_vlans *pv = NULL;
@@ -278,7 +277,9 @@ out:
 	return err;
 }
 
-/* Must be protected by RTNL */
+/* Must be protected by RTNL.
+ * Must be called with vid in range from 1 to 4094 inclusive.
+ */
 int br_vlan_delete(struct net_bridge *br, u16 vid)
 {
 	struct net_port_vlans *pv;
@@ -289,14 +290,9 @@ int br_vlan_delete(struct net_bridge *br, u16 vid)
 	if (!pv)
 		return -EINVAL;
 
-	if (vid) {
-		/* If the VID !=0 remove fdb for this vid. VID 0 is special
-		 * in that it's the default and is always there in the fdb.
-		 */
-		spin_lock_bh(&br->hash_lock);
-		fdb_delete_by_addr(br, br->dev->dev_addr, vid);
-		spin_unlock_bh(&br->hash_lock);
-	}
+	spin_lock_bh(&br->hash_lock);
+	fdb_delete_by_addr(br, br->dev->dev_addr, vid);
+	spin_unlock_bh(&br->hash_lock);
 
 	__vlan_del(pv, vid);
 	return 0;
@@ -329,7 +325,9 @@ unlock:
 	return 0;
 }
 
-/* Must be protected by RTNL */
+/* Must be protected by RTNL.
+ * Must be called with vid in range from 1 to 4094 inclusive.
+ */
 int nbp_vlan_add(struct net_bridge_port *port, u16 vid, u16 flags)
 {
 	struct net_port_vlans *pv = NULL;
@@ -363,7 +361,9 @@ clean_up:
 	return err;
 }
 
-/* Must be protected by RTNL */
+/* Must be protected by RTNL.
+ * Must be called with vid in range from 1 to 4094 inclusive.
+ */
 int nbp_vlan_delete(struct net_bridge_port *port, u16 vid)
 {
 	struct net_port_vlans *pv;
@@ -374,14 +374,9 @@ int nbp_vlan_delete(struct net_bridge_port *port, u16 vid)
 	if (!pv)
 		return -EINVAL;
 
-	if (vid) {
-		/* If the VID !=0 remove fdb for this vid. VID 0 is special
-		 * in that it's the default and is always there in the fdb.
-		 */
-		spin_lock_bh(&port->br->hash_lock);
-		fdb_delete_by_addr(port->br, port->dev->dev_addr, vid);
-		spin_unlock_bh(&port->br->hash_lock);
-	}
+	spin_lock_bh(&port->br->hash_lock);
+	fdb_delete_by_addr(port->br, port->dev->dev_addr, vid);
+	spin_unlock_bh(&port->br->hash_lock);
 
 	return __vlan_del(pv, vid);
 }
-- 
1.8.1.2

^ permalink raw reply related

* [PATCH net 0/4] bridge: Fix problems around the PVID
From: Toshiaki Makita @ 2013-09-10 10:27 UTC (permalink / raw)
  To: David S. Miller, Vlad Yasevich, netdev; +Cc: Toshiaki Makita

There seem to be some undesirable behaviors related with PVID.
1. It has no effect assigning PVID to a port. PVID cannot be applied
to any frame regardless of whether we set it or not.
2. FDB entries learned via frames applied PVID are registered with
VID 0 rather than VID value of PVID.
3. We can set 0 or 4095 as a PVID that are not allowed in IEEE 802.1Q.
This leads interoperational problems such as sending frames with VID
4095, which is not allowed in IEEE 802.1Q, and treating frames with VID
0 as they belong to VLAN 0, which is expected to be handled as they have
no VID according to IEEE 802.1Q.

Note: 2nd and 3rd problems are potential and not exposed unless 1st problem
is fixed, because we cannot activate PVID due to it.

This is my analysis for each behavior.
1. We are using VLAN_TAG_PRESENT bit when getting PVID, and not when
adding/deleting PVID.
It can be fixed in either way using or not using VLAN_TAG_PRESENT,
but I think the latter is slightly more efficient.

2. We are setting skb->vlan_tci with the value of PVID but the variable
vid, which is used in FDB later, is set to 0 at br_allowed_ingress()
when untagged frames arrive at a port with PVID valid. I'm afraid that
vid should be updated to the value of PVID if PVID is valid.

3. According to IEEE 802.1Q-2005 (6.7.1 and Table 9-2), we cannot use
VID 0 or 4095 as a PVID.
It looks like that there are more stuff to consider.

- VID 0:
VID 0 shall not be configured in any FDB entry and used in a tag header
to indicate it is a 802.1p priority-tagged frame.
Priority-tagged frames should be applied PVID (from IEEE 802.1Q 6.7.1).
In my opinion, since we can filter incomming priority-tagged frames by
deleting PVID, we don't need to filter them by vlan_bitmap.
In other words, priority-tagged frames don't have VID 0 but have no VID,
which is the same as untagged frames, and should be filtered by unsetting
PVID.
So, not only we cannot set PVID as 0, but also we don't need to add 0 to
vlan_bitmap, which enable us to simply forbid to add vlan 0.

- VID 4095:
VID 4095 shall not be transmitted in a tag header. This VID value may be
used to indicate a wildcard match for the VID in management operations or
FDB entries (from IEEE 802.1Q Table 9-2).
In current implementation, we can create a static FDB entry with all
existing VIDs by not specifying any VID when creating it.
I don't think this way to add wildcard-like entries needs to change,
and VID 4095 looks no use and can be unacceptable to add.

Consequently, I believe what we should do for 3rd problem is below:
- Not allowing VID 0 and 4095 to be added.
- Applying PVID to priority-tagged (VID 0) frames.

Patch set follows this mail.
The order of patches is not the same as described above, because the way
to fix 1st problem is based on the assumption that we don't use VID 0 as
a PVID, which is realized by fixing 3rd problem.
(1/4)(2/4): Fix 3rd problem.
(3/4): Fix 1st problem.
(4/4): Fix 2nd probelm.

If something wrong or any misunderstanding is found, please comment.
If another way to fix is better such as using VLAN_TAG_PRESENT, I can
submit modified patches.

Thanks,

Toshiaki Makita

Toshiaki Makita (4):
  bridge: Don't use VID 0 and 4095 in vlan filtering
  bridge: Handle priority-tagged frames properly
  bridge: Fix the way the PVID is referenced
  bridge: Fix updating FDB entries when the PVID is applied

 net/bridge/br_fdb.c     |   4 +-
 net/bridge/br_netlink.c |   2 +-
 net/bridge/br_private.h |   4 +-
 net/bridge/br_vlan.c    | 125 ++++++++++++++++++++++++++----------------------
 4 files changed, 71 insertions(+), 64 deletions(-)

-- 
1.8.1.2

^ permalink raw reply

* [PATCH 1/1] sfc: Staticize efx_ef10_filter_update_rx_scatter
From: Sachin Kamat @ 2013-09-10  9:49 UTC (permalink / raw)
  To: netdev; +Cc: bhutchings, linux-net-drivers, sachin.kamat

'efx_ef10_filter_update_rx_scatter' is used only in this file.
Make it static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/net/ethernet/sfc/ef10.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/sfc/ef10.c b/drivers/net/ethernet/sfc/ef10.c
index 5f42313..6956bd2 100644
--- a/drivers/net/ethernet/sfc/ef10.c
+++ b/drivers/net/ethernet/sfc/ef10.c
@@ -2121,7 +2121,7 @@ out_unlock:
 	return rc;
 }
 
-void efx_ef10_filter_update_rx_scatter(struct efx_nic *efx)
+static void efx_ef10_filter_update_rx_scatter(struct efx_nic *efx)
 {
 	/* no need to do anything here on EF10 */
 }
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 1/1] sfc: Staticize efx_ethtool_get_ts_info
From: Sachin Kamat @ 2013-09-10  9:43 UTC (permalink / raw)
  To: netdev; +Cc: bhutchings, linux-net-drivers, sachin.kamat

'efx_ethtool_get_ts_info' is used only in this file.
Make it static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/net/ethernet/sfc/ethtool.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/sfc/ethtool.c b/drivers/net/ethernet/sfc/ethtool.c
index 5b471cf..c8dc407 100644
--- a/drivers/net/ethernet/sfc/ethtool.c
+++ b/drivers/net/ethernet/sfc/ethtool.c
@@ -1035,8 +1035,8 @@ static int efx_ethtool_set_rxfh_indir(struct net_device *net_dev,
 	return 0;
 }
 
-int efx_ethtool_get_ts_info(struct net_device *net_dev,
-			    struct ethtool_ts_info *ts_info)
+static int efx_ethtool_get_ts_info(struct net_device *net_dev,
+				   struct ethtool_ts_info *ts_info)
 {
 	struct efx_nic *efx = netdev_priv(net_dev);
 
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH 1/1] net: bnx2x: Staticize local symbols
From: Sachin Kamat @ 2013-09-10  9:35 UTC (permalink / raw)
  To: Ariel Elior; +Cc: netdev@vger.kernel.org, davem@davemloft.net, Eilon Greenstein
In-Reply-To: <6AE768456CEC4B4A9B2248CB6B87EB3E1BEE8FD8@SJEXCHMB05.corp.ad.broadcom.com>

On 10 September 2013 13:53, Ariel Elior <ariele@broadcom.com> wrote:
>> -----Original Message-----
>> From: netdev-owner@vger.kernel.org [mailto:netdev-
>> owner@vger.kernel.org] On Behalf Of Sachin Kamat
>> Sent: Tuesday, September 10, 2013 9:43 AM
>> To: netdev@vger.kernel.org
>> Cc: davem@davemloft.net; Eilon Greenstein; sachin.kamat@linaro.org
>> Subject: [PATCH 1/1] net: bnx2x: Staticize local symbols

>>
>> -int bnx2x_vf_ndo_prep(struct bnx2x *bp, int vfidx, struct bnx2x_virtf **vf,
>> +static int
> I don't like this form. Better to put the last variable in the next line.

OK. Will change it.

>
> Thanks for suggesting the fix.
> Not sure this is appropriate for net though...

Sorry, did not get this. Please elaborate.

-- 
With warm regards,
Sachin

^ permalink raw reply

* [PATCH] net: fec: fix phy reset operation to let imx6sl evk work
From: Fugang Duan @ 2013-09-10  9:07 UTC (permalink / raw)
  To: shawn.guo, davem; +Cc: netdev, bhutchings, stephen, b20596, s.hauer, b38611

The patch do correct phy reset operation to let imx6sl evk
ethernet work.

Current driver only do phy reset in probe function, which is
not right. Since some phy clock is disabled after module probe,
the phy enter abnormal status, which needs do reset to recovery
the phy. And do ifconfig ethx up/down test, the phy also enter
abnormal status.

The log as:
libphy: 2188000.ethernet:04 - Link is Up - 10/Full
libphy: 2188000.ethernet:04 - Link is Up - 100/Full
libphy: 2188000.ethernet:04 - Link is Down
libphy: 2188000.ethernet:04 - Link is Up - 10/Half
libphy: 2188000.ethernet:04 - Link is Up - 10/Full
libphy: 2188000.ethernet:04 - Link is Up - 100/Full
...

So, do phy reset if ethx up/down or clock enable/disable.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Reviewed-by: Shawn Guo <R65073@freescale.com>
CC: Shawn Guo <shawn.guo@linaro.org>
CC: Li Frank <B20596@freescale.com>
CC: "David S. Miller" <davem@davemloft.net>
---
 drivers/net/ethernet/freescale/fec.h      |    3 +
 drivers/net/ethernet/freescale/fec_main.c |   59 +++++++++++++++++-----------
 2 files changed, 39 insertions(+), 23 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index 0120217..473d5fb 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -321,6 +321,9 @@ struct fec_enet_private {
 	struct	napi_struct napi;
 	int	csum_flags;
 
+	int	phy_reset_gpio;
+	int	reset_duration;
+
 	struct ptp_clock *ptp_clock;
 	struct ptp_clock_info ptp_caps;
 	unsigned long last_overflow_check;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index f9aacf5..0c17df2 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -61,6 +61,7 @@
 #include "fec.h"
 
 static void set_multicast_list(struct net_device *ndev);
+static void fec_enet_reset_phy(struct platform_device *pdev);
 
 #if defined(CONFIG_ARM)
 #define FEC_ALIGNMENT	0xf
@@ -1780,6 +1781,10 @@ fec_enet_open(struct net_device *ndev)
 	phy_start(fep->phy_dev);
 	netif_start_queue(ndev);
 	fep->opened = 1;
+
+	/* reset phy */
+	fec_enet_reset_phy(fep->pdev);
+
 	return 0;
 }
 
@@ -2029,43 +2034,52 @@ static int fec_enet_init(struct net_device *ndev)
 	return 0;
 }
 
-#ifdef CONFIG_OF
-static void fec_reset_phy(struct platform_device *pdev)
+static void fec_enet_of_init(struct platform_device *pdev)
 {
-	int err, phy_reset;
-	int msec = 1;
 	struct device_node *np = pdev->dev.of_node;
+	struct net_device *ndev = platform_get_drvdata(pdev);
+	struct fec_enet_private *fep = netdev_priv(ndev);
+	int err;
+
+	/*
+	 * init phy-reset-gpio to one invalid GPIO for no phy
+	 * gpio reset platform
+	 */
+	fep->phy_reset_gpio = -1;
 
 	if (!np)
 		return;
 
-	of_property_read_u32(np, "phy-reset-duration", &msec);
+	of_property_read_u32(np, "phy-reset-duration",
+				&fep->reset_duration);
 	/* A sane reset duration should not be longer than 1s */
-	if (msec > 1000)
-		msec = 1;
+	if ((fep->reset_duration > 1000) || (fep->reset_duration == 0))
+		fep->reset_duration = 1;
 
-	phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
-	if (!gpio_is_valid(phy_reset))
+	fep->phy_reset_gpio = of_get_named_gpio(np, "phy-reset-gpios", 0);
+	if (!gpio_is_valid(fep->phy_reset_gpio))
 		return;
 
-	err = devm_gpio_request_one(&pdev->dev, phy_reset,
-				    GPIOF_OUT_INIT_LOW, "phy-reset");
+	err = devm_gpio_request_one(&pdev->dev, fep->phy_reset_gpio,
+				GPIOF_OUT_INIT_HIGH, "phy-reset");
 	if (err) {
 		dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
-		return;
+		fep->phy_reset_gpio = -1;
 	}
-	msleep(msec);
-	gpio_set_value(phy_reset, 1);
 }
-#else /* CONFIG_OF */
-static void fec_reset_phy(struct platform_device *pdev)
+
+static void fec_enet_reset_phy(struct platform_device *pdev)
 {
-	/*
-	 * In case of platform probe, the reset has been done
-	 * by machine code.
-	 */
+	struct net_device *ndev = platform_get_drvdata(pdev);
+	struct fec_enet_private *fep = netdev_priv(ndev);
+
+	/* check GPIO valid to avoid kernel print warning when no gpio reset */
+	if (gpio_is_valid(fep->phy_reset_gpio)) {
+		gpio_set_value(fep->phy_reset_gpio, 0);
+		msleep(fep->reset_duration);
+		gpio_set_value(fep->phy_reset_gpio, 1);
+	}
 }
-#endif /* CONFIG_OF */
 
 static int
 fec_probe(struct platform_device *pdev)
@@ -2113,6 +2127,7 @@ fec_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, ndev);
 
+	fec_enet_of_init(pdev);
 	ret = of_get_phy_mode(pdev->dev.of_node);
 	if (ret < 0) {
 		pdata = dev_get_platdata(&pdev->dev);
@@ -2181,8 +2196,6 @@ fec_probe(struct platform_device *pdev)
 		fep->reg_phy = NULL;
 	}
 
-	fec_reset_phy(pdev);
-
 	if (fep->bufdesc_ex)
 		fec_ptp_init(pdev);
 
-- 
1.7.1

^ permalink raw reply related

* RE: [PATCH 1/1] net: bnx2x: Staticize local symbols
From: Ariel Elior @ 2013-09-10  8:23 UTC (permalink / raw)
  To: Sachin Kamat, netdev@vger.kernel.org
  Cc: davem@davemloft.net, Eilon Greenstein
In-Reply-To: <1378798960-6572-1-git-send-email-sachin.kamat@linaro.org>

> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org] On Behalf Of Sachin Kamat
> Sent: Tuesday, September 10, 2013 9:43 AM
> To: netdev@vger.kernel.org
> Cc: davem@davemloft.net; Eilon Greenstein; sachin.kamat@linaro.org
> Subject: [PATCH 1/1] net: bnx2x: Staticize local symbols
> 
> Local symbols used only in this file are made static.
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
> b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
> index 2604b62..5ec30cc 100644
> --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
> +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
> @@ -2802,7 +2802,7 @@ struct set_vf_state_cookie {
>  	u8 state;
>  };
> 
> -void bnx2x_set_vf_state(void *cookie)
> +static void bnx2x_set_vf_state(void *cookie)
>  {
>  	struct set_vf_state_cookie *p = (struct set_vf_state_cookie
> *)cookie;
> 
> @@ -3222,7 +3222,8 @@ void bnx2x_disable_sriov(struct bnx2x *bp)
>  	pci_disable_sriov(bp->pdev);
>  }
> 
> -int bnx2x_vf_ndo_prep(struct bnx2x *bp, int vfidx, struct bnx2x_virtf **vf,
> +static int
I don't like this form. Better to put the last variable in the next line.

> +bnx2x_vf_ndo_prep(struct bnx2x *bp, int vfidx, struct bnx2x_virtf **vf,
>  			struct pf_vf_bulletin_content **bulletin)
>  {
>  	if (bp->state != BNX2X_STATE_OPEN) {
> --
> 1.7.9.5
> 
> --
> 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

Thanks for suggesting the fix.
Not sure this is appropriate for net though...
Ariel

^ permalink raw reply

* RE: [PATCH] net: fec: fix phy reset operation to let imx6sl evk work
From: Duan Fugang-B38611 @ 2013-09-10  8:21 UTC (permalink / raw)
  To: Shawn Guo
  Cc: davem@davemloft.net, netdev@vger.kernel.org,
	bhutchings@solarflare.com, stephen@networkplumber.org,
	Li Frank-B20596, s.hauer@pengutronix.de
In-Reply-To: <20130910081434.GG5815@S2101-09.ap.freescale.net>

From: Shawn Guo [mailto:shawn.guo@linaro.org]
Data: Tuesday, September 10, 2013 4:15 PM

> To: Duan Fugang-B38611
> Cc: davem@davemloft.net; netdev@vger.kernel.org; bhutchings@solarflare.com;
> stephen@networkplumber.org; Li Frank-B20596; s.hauer@pengutronix.de
> Subject: Re: [PATCH] net: fec: fix phy reset operation to let imx6sl evk
> work
> 
> First of all, the patch does not apply on linux-next which means it will
> likely not apply on David's tree either.  Please generate the patch
> against the tree which your patch will go through.
> 
Sorry, pls drop to review the patch, there have two changes in local (Linux-next) not commit amend to the patch.
But I tested the patch (+ changes) on imx6sl evk and pass.

I send the integrated patch again.

^ permalink raw reply

* Re: [PATCH] net: fec: fix phy reset operation to let imx6sl evk work
From: Shawn Guo @ 2013-09-10  8:15 UTC (permalink / raw)
  To: Fugang Duan; +Cc: davem, netdev, bhutchings, stephen, b20596, s.hauer
In-Reply-To: <1378780505-23102-1-git-send-email-B38611@freescale.com>

First of all, the patch does not apply on linux-next which means it will
likely not apply on David's tree either.  Please generate the patch
against the tree which your patch will go through.

On Tue, Sep 10, 2013 at 10:35:05AM +0800, Fugang Duan wrote:
> The patch do correct phy reset operation to let imx6sl evk
> ethernet work.
> 
> Current driver only do phy reset in probe function, which is
> not right. Since some phy clock is disabled after module probe,
> the phy enter abnormal status, which needs do reset to recovery
> the phy. And do ifconfig ethx up/down test, the phy also enter
> abnormal status.
> 
> The log as:
> libphy: 2188000.ethernet:04 - Link is Up - 10/Full
> libphy: 2188000.ethernet:04 - Link is Up - 100/Full
> libphy: 2188000.ethernet:04 - Link is Down
> libphy: 2188000.ethernet:04 - Link is Up - 10/Half
> libphy: 2188000.ethernet:04 - Link is Up - 10/Full
> libphy: 2188000.ethernet:04 - Link is Up - 100/Full
> ...
> 
> So, do phy reset if ethx up/down or clock enable/disable.
> 
> Signed-off-by: Fugang Duan <B38611@freescale.com>
> Reviewed-by: Shawn Guo <R65073@freescale.com>
> CC: Shawn Guo <R65073@freescale.com>
> CC: Li Frank <B20596@freescale.com>
> CC: "David S. Miller" <davem@davemloft.net>
> ---
>  drivers/net/ethernet/freescale/fec.h      |    3 +
>  drivers/net/ethernet/freescale/fec_main.c |   61 +++++++++++++++++-----------
>  2 files changed, 40 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
> index 0120217..b33c92d 100644
> --- a/drivers/net/ethernet/freescale/fec.h
> +++ b/drivers/net/ethernet/freescale/fec.h
> @@ -321,6 +321,9 @@ struct fec_enet_private {
>  	struct	napi_struct napi;
>  	int	csum_flags;
>  
> +	int	phy_reset_gpio;
> +	int     reset_duration;
> +
>  	struct ptp_clock *ptp_clock;
>  	struct ptp_clock_info ptp_caps;
>  	unsigned long last_overflow_check;
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> index 7a87012..5a9ba1d 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -18,7 +18,7 @@
>   * Bug fixes and cleanup by Philippe De Muyter (phdm@macqel.be)
>   * Copyright (c) 2004-2006 Macq Electronique SA.
>   *
> - * Copyright (C) 2010-2011 Freescale Semiconductor, Inc.
> + * Copyright (C) 2010-2013 Freescale Semiconductor, Inc.
>   */
>  
>  #include <linux/module.h>
> @@ -61,6 +61,7 @@
>  #include "fec.h"
>  
>  static void set_multicast_list(struct net_device *ndev);
> +static void fec_reset_phy(struct platform_device *pdev);

You probably mean fec_enet_reset_phy()?

>  
>  #if defined(CONFIG_ARM)
>  #define FEC_ALIGNMENT	0xf
> @@ -1781,6 +1782,10 @@ fec_enet_open(struct net_device *ndev)
>  	phy_start(fep->phy_dev);
>  	netif_start_queue(ndev);
>  	fep->opened = 1;
> +
> +	/* reset phy */
> +	fec_enet_reset_phy(fep->pdev);
> +
>  	return 0;
>  }
>  
> @@ -2030,43 +2035,52 @@ static int fec_enet_init(struct net_device *ndev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_OF
> -static void fec_reset_phy(struct platform_device *pdev)
> +static void fec_enet_of_init(struct platform_device *pdev)
>  {
> -	int err, phy_reset;
> -	int msec = 1;
>  	struct device_node *np = pdev->dev.of_node;
> +	struct net_device *ndev = platform_get_drvdata(pdev);
> +	struct fec_enet_private *fep = netdev_priv(ndev);
> +	int err;
> +
> +	/*
> +	 * init phy-reset-gpio to one invalid GPIO for no phy
> +	 * gpio reset platform
> +	 */
> +	fep->phy_reset_gpio = -1;
>  
>  	if (!np)
>  		return;
>  
> -	of_property_read_u32(np, "phy-reset-duration", &msec);
> +	of_property_read_u32(np, "phy-reset-duration"

It misses one comma at the end of the line.

Shawn

> +				&fep->reset_duration);
>  	/* A sane reset duration should not be longer than 1s */
> -	if (msec > 1000)
> -		msec = 1;
> +	if ((fep->reset_duration > 1000) || (fep->reset_duration == 0))
> +		fep->reset_duration = 1;
>  
> -	phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
> -	if (!gpio_is_valid(phy_reset))
> +	fep->phy_reset_gpio = of_get_named_gpio(np, "phy-reset-gpios", 0);
> +	if (!gpio_is_valid(fep->phy_reset_gpio))
>  		return;
>  
> -	err = devm_gpio_request_one(&pdev->dev, phy_reset,
> -				    GPIOF_OUT_INIT_LOW, "phy-reset");
> +	err = devm_gpio_request_one(&pdev->dev, fep->phy_reset_gpio,
> +				    GPIOF_OUT_INIT_HIGH, "phy-reset");
>  	if (err) {
>  		dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
> -		return;
> +		fep->phy_reset_gpio = -1;
>  	}
> -	msleep(msec);
> -	gpio_set_value(phy_reset, 1);
>  }
> -#else /* CONFIG_OF */
> -static void fec_reset_phy(struct platform_device *pdev)
> +
> +static void fec_enet_reset_phy(struct platform_device *pdev)
>  {
> -	/*
> -	 * In case of platform probe, the reset has been done
> -	 * by machine code.
> -	 */
> +	struct net_device *ndev = platform_get_drvdata(pdev);
> +	struct fec_enet_private *fep = netdev_priv(ndev);
> +
> +	/* check GPIO valid to avoid kernel print warning when no gpio reset */
> +	if (gpio_is_valid(fep->phy_reset_gpio)) {
> +		gpio_set_value(fep->phy_reset_gpio, 0);
> +		msleep(fep->reset_duration);
> +		gpio_set_value(fep->phy_reset_gpio, 1);
> +	}
>  }
> -#endif /* CONFIG_OF */
>  
>  static int
>  fec_probe(struct platform_device *pdev)
> @@ -2117,6 +2131,7 @@ fec_probe(struct platform_device *pdev)
>  
>  	platform_set_drvdata(pdev, ndev);
>  
> +	fec_enet_of_init(pdev);
>  	ret = of_get_phy_mode(pdev->dev.of_node);
>  	if (ret < 0) {
>  		pdata = pdev->dev.platform_data;
> @@ -2170,8 +2185,6 @@ fec_probe(struct platform_device *pdev)
>  		fep->reg_phy = NULL;
>  	}
>  
> -	fec_reset_phy(pdev);
> -
>  	if (fep->bufdesc_ex)
>  		fec_ptp_init(pdev);
>  
> -- 
> 1.7.1
> 
> 

^ permalink raw reply

* [PATCH 1/1] net: cxgb4vf: Staticize local symbols
From: Sachin Kamat @ 2013-09-10  7:52 UTC (permalink / raw)
  To: netdev; +Cc: leedom, davem, sachin.kamat

Local symbols used only in this file are made static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/net/ethernet/chelsio/cxgb4vf/sge.c |   11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
index df296af..8475c4c 100644
--- a/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
+++ b/drivers/net/ethernet/chelsio/cxgb4vf/sge.c
@@ -1396,8 +1396,9 @@ static inline void copy_frags(struct sk_buff *skb,
  *	Builds an sk_buff from the given packet gather list.  Returns the
  *	sk_buff or %NULL if sk_buff allocation failed.
  */
-struct sk_buff *t4vf_pktgl_to_skb(const struct pkt_gl *gl,
-				  unsigned int skb_len, unsigned int pull_len)
+static struct sk_buff *t4vf_pktgl_to_skb(const struct pkt_gl *gl,
+					 unsigned int skb_len,
+					 unsigned int pull_len)
 {
 	struct sk_buff *skb;
 
@@ -1443,7 +1444,7 @@ out:
  *	Releases the pages of a packet gather list.  We do not own the last
  *	page on the list and do not free it.
  */
-void t4vf_pktgl_free(const struct pkt_gl *gl)
+static void t4vf_pktgl_free(const struct pkt_gl *gl)
 {
 	int frag;
 
@@ -1640,7 +1641,7 @@ static inline void rspq_next(struct sge_rspq *rspq)
  *	on this queue.  If the system is under memory shortage use a fairly
  *	long delay to help recovery.
  */
-int process_responses(struct sge_rspq *rspq, int budget)
+static int process_responses(struct sge_rspq *rspq, int budget)
 {
 	struct sge_eth_rxq *rxq = container_of(rspq, struct sge_eth_rxq, rspq);
 	int budget_left = budget;
@@ -1893,7 +1894,7 @@ static unsigned int process_intrq(struct adapter *adapter)
  * The MSI interrupt handler handles data events from SGE response queues as
  * well as error and other async events as they all use the same MSI vector.
  */
-irqreturn_t t4vf_intr_msi(int irq, void *cookie)
+static irqreturn_t t4vf_intr_msi(int irq, void *cookie)
 {
 	struct adapter *adapter = cookie;
 
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH net 1/1] r8169: enforce RX_MULTI_EN for the 8168f.
From: Frédéric Leroy @ 2013-09-10  8:08 UTC (permalink / raw)
  To: Francois Romieu
  Cc: hayeswang, netdev, 'David Miller', 'David R',
	'nic_swsd'
In-Reply-To: <20130909225050.GA2529@electric-eye.fr.zoreil.com>

Le 10/09/2013 00:50, Francois Romieu a écrit :
> hayeswang <hayeswang@realtek.com> :
> [...]
> > I don't have any issue reported about the fetching numbers, so I have no
> > idea about why it could fix you problem.
>
> Thanks Hayes.
>
> Frédéric, David (R not M), do your systems include some Marvell SATA controller ?
>

I have an amd one :

    [fredo:~] $ lspci  | grep SATA
    00:11.0 SATA controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] (rev 40)

But I know I have sata ncq errors and stability problems with kernels >=
3.11
from git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6

I don't try to debug it for the moment because it is on my main computer
and have valuable data on my ssd.

For completeness, here is the full list of pci devices on my pc :

    [fredo:~] $ lspci
    00:00.0 Host bridge: Advanced Micro Devices [AMD] nee ATI RD890 PCI
to PCI bridge (external gfx0 port B) (rev 02)
    00:00.2 IOMMU: Advanced Micro Devices [AMD] nee ATI RD990 I/O Memory
Management Unit (IOMMU)
    00:02.0 PCI bridge: Advanced Micro Devices [AMD] nee ATI RD890 PCI
to PCI bridge (PCI express gpp port B)
    00:04.0 PCI bridge: Advanced Micro Devices [AMD] nee ATI RD890 PCI
to PCI bridge (PCI express gpp port D)
    00:05.0 PCI bridge: Advanced Micro Devices [AMD] nee ATI RD890 PCI
to PCI bridge (PCI express gpp port E)
    00:07.0 PCI bridge: Advanced Micro Devices [AMD] nee ATI RD890 PCI
to PCI bridge (PCI express gpp port G)
    00:11.0 SATA controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 SATA Controller [AHCI mode] (rev 40)
    00:12.0 USB controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
    00:12.2 USB controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 USB EHCI Controller
    00:13.0 USB controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
    00:13.2 USB controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 USB EHCI Controller
    00:14.0 SMBus: Advanced Micro Devices [AMD] nee ATI SBx00 SMBus
Controller (rev 42)
    00:14.2 Audio device: Advanced Micro Devices [AMD] nee ATI SBx00
Azalia (Intel HDA) (rev 40)
    00:14.3 ISA bridge: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 LPC host controller (rev 40)
    00:14.4 PCI bridge: Advanced Micro Devices [AMD] nee ATI SBx00 PCI
to PCI Bridge (rev 40)
    00:14.5 USB controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 USB OHCI2 Controller
    00:16.0 USB controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 USB OHCI0 Controller
    00:16.2 USB controller: Advanced Micro Devices [AMD] nee ATI
SB7x0/SB8x0/SB9x0 USB EHCI Controller
    00:18.0 Host bridge: Advanced Micro Devices [AMD] Family 15h
Processor Function 0
    00:18.1 Host bridge: Advanced Micro Devices [AMD] Family 15h
Processor Function 1
    00:18.2 Host bridge: Advanced Micro Devices [AMD] Family 15h
Processor Function 2
    00:18.3 Host bridge: Advanced Micro Devices [AMD] Family 15h
Processor Function 3
    00:18.4 Host bridge: Advanced Micro Devices [AMD] Family 15h
Processor Function 4
    00:18.5 Host bridge: Advanced Micro Devices [AMD] Family 15h
Processor Function 5
    01:00.0 VGA compatible controller: Advanced Micro Devices [AMD] nee
ATI Caicos [Radeon HD 6450]
    01:00.1 Audio device: Advanced Micro Devices [AMD] nee ATI Caicos
HDMI Audio [Radeon HD 6400 Series]
    02:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd.
RTL8111/8168 PCI Express Gigabit Ethernet controller (rev 09)
    03:00.0 USB controller: ASMedia Technology Inc. ASM1042 SuperSpeed
USB Host Controller
    04:00.0 USB controller: ASMedia Technology Inc. ASM1042 SuperSpeed
USB Host Controller
    05:05.0 Ethernet controller: 3Com Corporation 3c940
10/100/1000Base-T [Marvell] (rev 10)
    [fredo:~] $

^ permalink raw reply

* [PATCH 1/1] net: bnx2x: Staticize local symbols
From: Sachin Kamat @ 2013-09-10  7:42 UTC (permalink / raw)
  To: netdev; +Cc: davem, eilong, sachin.kamat

Local symbols used only in this file are made static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
index 2604b62..5ec30cc 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_sriov.c
@@ -2802,7 +2802,7 @@ struct set_vf_state_cookie {
 	u8 state;
 };
 
-void bnx2x_set_vf_state(void *cookie)
+static void bnx2x_set_vf_state(void *cookie)
 {
 	struct set_vf_state_cookie *p = (struct set_vf_state_cookie *)cookie;
 
@@ -3222,7 +3222,8 @@ void bnx2x_disable_sriov(struct bnx2x *bp)
 	pci_disable_sriov(bp->pdev);
 }
 
-int bnx2x_vf_ndo_prep(struct bnx2x *bp, int vfidx, struct bnx2x_virtf **vf,
+static int
+bnx2x_vf_ndo_prep(struct bnx2x *bp, int vfidx, struct bnx2x_virtf **vf,
 			struct pf_vf_bulletin_content **bulletin)
 {
 	if (bp->state != BNX2X_STATE_OPEN) {
-- 
1.7.9.5

^ permalink raw reply related

* Re: TSQ accounting skb->truesize degrades throughput for large packets
From: Jason Wang @ 2013-09-10  7:45 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Zoltan Kiss, Wei Liu, Jonathan Davies, Ian Campbell, netdev,
	xen-devel, Michael S. Tsirkin
In-Reply-To: <1378734444.26319.28.camel@edumazet-glaptop>

On 09/09/2013 09:47 PM, Eric Dumazet wrote:
> On Mon, 2013-09-09 at 17:27 +0800, Jason Wang wrote:
>
>> Virtio-net orphan the skb in .ndo_start_xmit() so TSQ can not throttle
>> packets in device accurately, and it also can't do BQL. Does this means
>> TSQ should be disabled for virtio-net?
>>
> If skb are orphaned, there is no way TSQ can work at all.

For example, virtio-net will stop the tx queue when it finds the tx
queue may full and enable the queue when some packets were sent. In this
case, tsq works and throttles the total bytes queued in qdisc. This
usually happen during heavy network load such as two sessions of netperf.
>
> It is already disabled, so why do you want to disable it ?
>
>

We notice a regression, and bisect shows it was introduced by TSQ.

^ permalink raw reply

* [PATCH 1/1] net: cdc-phonet: Staticize usbpn_probe
From: Sachin Kamat @ 2013-09-10  6:30 UTC (permalink / raw)
  To: netdev; +Cc: davem, remi, sachin.kamat

'usbpn_probe' is referenced only in this file. Make it static.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/net/usb/cdc-phonet.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/usb/cdc-phonet.c b/drivers/net/usb/cdc-phonet.c
index 7d78669..8c44f86 100644
--- a/drivers/net/usb/cdc-phonet.c
+++ b/drivers/net/usb/cdc-phonet.c
@@ -328,7 +328,8 @@ MODULE_DEVICE_TABLE(usb, usbpn_ids);
 
 static struct usb_driver usbpn_driver;
 
-int usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id)
+static int
+usbpn_probe(struct usb_interface *intf, const struct usb_device_id *id)
 {
 	static const char ifname[] = "usbpn%d";
 	const struct usb_cdc_union_desc *union_header = NULL;
-- 
1.7.9.5

^ permalink raw reply related

* [PATCH 1/1] net: ath9k: Use NULL instead of false
From: Sachin Kamat @ 2013-09-10  6:20 UTC (permalink / raw)
  To: linux-wireless
  Cc: ath9k-devel, netdev, mcgrof, jouni, vthiagar, senthilb, linville,
	sachin.kamat

The function returns a pointer. Hence return NULL instead of false.

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/net/wireless/ath/ath9k/dfs_pri_detector.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c
index 5ba4b6f..c718fc3 100644
--- a/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c
+++ b/drivers/net/wireless/ath/ath9k/dfs_pri_detector.c
@@ -392,7 +392,7 @@ static struct pri_sequence *pri_detector_add_pulse(struct pri_detector *de,
 
 	if (!pseq_handler_create_sequences(de, ts, max_updated_seq)) {
 		pri_detector_reset(de, ts);
-		return false;
+		return NULL;
 	}
 
 	ps = pseq_handler_check_detection(de);
-- 
1.7.9.5

^ permalink raw reply related

* Re: [PATCH net-next] net: sk_buff: memset(skb,0) after alloc in skb_clone
From: Erik Hugne @ 2013-09-10  6:33 UTC (permalink / raw)
  To: govindarajalu90; +Cc: netdev

Dont think this is necessary. Use GFP_ZERO mask in the skb_clone() call instead.

//E

^ permalink raw reply

* Re: [PATCH] ethernet/arc/arc_emac: Fix huge delays in large file copies
From: Vineet Gupta @ 2013-09-10  6:27 UTC (permalink / raw)
  To: greg Kroah-Hartman
  Cc: David Miller, netdev, Alexey.Brodkin, linux-kernel, arc-linux-dev,
	stable@vger.kernel.org
In-Reply-To: <20130905.142530.732425484460470485.davem@davemloft.net>

On 09/05/2013 11:55 PM, David Miller wrote:
> From: Vineet Gupta <Vineet.Gupta1@synopsys.com>
> Date: Wed, 4 Sep 2013 17:17:15 +0530
> 
>> copying large files to a NFS mounted host was taking absurdly large
>> time.
>>
>> Turns out that TX BD reclaim had a sublte bug.
>>
>> Loop starts off from @txbd_dirty cursor and stops when it hits a BD
>> still in use by controller. However when it stops it needs to keep the
>> cursor at that very BD to resume scanning in next iteration. However it
>> was erroneously incrementing the cursor, causing the next scan(s) to
>> fail too, unless the BD chain was completely drained out.
>>
>> [ARCLinux]$ ls -l -sh /disk/log.txt
>>  17976 -rw-r--r--    1 root     root       17.5M Sep  /disk/log.txt
>>
>> ========== Before =====================
>> [ARCLinux]$ time cp /disk/log.txt /mnt/.
>> real    31m 7.95s
>> user    0m 0.00s
>> sys     0m 0.10s
>>
>> ========== After =====================
>> [ARCLinux]$ time cp /disk/log.txt /mnt/.
>> real    0m 24.33s
>> user    0m 0.00s
>> sys     0m 0.19s
>>
>> Signed-off-by: Vineet Gupta <vgupta@synopsys.com>
> 
> Applied.
> 

Hi Greg,

This needs a stable backport (3.11).
Mainline commit 27082ee1b92f4d41e78b85

Thx,
-Vineet

^ permalink raw reply

* RE: [PATCH] net: fec: add the initial to set the physical mac address
From: Duan Fugang-B38611 @ 2013-09-10  5:23 UTC (permalink / raw)
  To: David Miller
  Cc: l.stach@pengutronix.de, netdev@vger.kernel.org,
	bhutchings@solarflare.com, Estevam Fabio-R49496,
	stephen@networkplumber.org, s.hauer@pengutronix.de
In-Reply-To: <20130910.010748.1537386784228501617.davem@davemloft.net>

From: David Miller [mailto:davem@davemloft.net]
Data: Tuesday, September 10, 2013 1:08 PM

> To: Duan Fugang-B38611
> Cc: l.stach@pengutronix.de; netdev@vger.kernel.org;
> bhutchings@solarflare.com; Estevam Fabio-R49496;
> stephen@networkplumber.org; s.hauer@pengutronix.de
> Subject: Re: [PATCH] net: fec: add the initial to set the physical mac
> address
> 
> From: Duan Fugang-B38611 <B38611@freescale.com>
> Date: Tue, 10 Sep 2013 01:45:52 +0000
> 
> > Please don't ignore the patch.
> 
> Please don't just pray that it's in my queue and I will apply it.
> 
> If it's not in my patchwork queue, you need to simply resubmit it.
> 
> If it is in my patchwork queue, you need to be patient.
> 
> Thank you.
> 
Ok, I know, just a notify to avoid forget it because I did ping to you.

Thanks.

^ permalink raw reply

* Re: [PATCH] net: fec: add the initial to set the physical mac address
From: David Miller @ 2013-09-10  5:07 UTC (permalink / raw)
  To: B38611; +Cc: l.stach, netdev, bhutchings, r49496, stephen, s.hauer
In-Reply-To: <9848F2DB572E5649BA045B288BE08FBE016A7B22@039-SN2MPN1-023.039d.mgd.msft.net>

From: Duan Fugang-B38611 <B38611@freescale.com>
Date: Tue, 10 Sep 2013 01:45:52 +0000

> Please don't ignore the patch. 

Please don't just pray that it's in my queue and I will apply it.

If it's not in my patchwork queue, you need to simply resubmit it.

If it is in my patchwork queue, you need to be patient.

Thank you.

^ permalink raw reply

* [PATCH net-next] net: sk_buff: memset(skb,0) after alloc in skb_clone
From: Govindarajulu Varadarajan @ 2013-09-10  4:48 UTC (permalink / raw)
  To: davem, netdev; +Cc: Govindarajulu Varadarajan

The following patch memset the skb to 0 after alloc. We do this in
__alloc_skb_head, __alloc_skb, build_skb. We are missing this in
skb_clone.

The following call to __skb_clone in skb_clone does not copy all the
members of sk_buff. If we donot clear the skb to 0, we will have some
uninitialized members in new skb.

Signed-off-by: Govindarajulu Varadarajan <govindarajulu90@gmail.com>
---
 net/core/skbuff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index d81cff1..fc78f66 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -891,6 +891,7 @@ struct sk_buff *skb_clone(struct sk_buff *skb, gfp_t gfp_mask)
 		n = kmem_cache_alloc(skbuff_head_cache, gfp_mask);
 		if (!n)
 			return NULL;
+		memset(n, 0, offsetof(struct sk_buff, tail));
 
 		kmemcheck_annotate_bitfield(n, flags1);
 		kmemcheck_annotate_bitfield(n, flags2);
-- 
1.8.4

^ permalink raw reply related

* Re: [PATCH v2] pch_gbe: fix unmet direct dependency on PTP_1588_CLOCK_PCH
From: Vladimir Murzin @ 2013-09-10  3:12 UTC (permalink / raw)
  To: netdev; +Cc: davem, ben, jeffrey.t.kirsher, rdunlap, haicheng.lee
In-Reply-To: <1378780396-3694-1-git-send-email-murzin.v@gmail.com>

On Tue, Sep 10, 2013 at 04:33:16AM +0200, Vladimir Murzin wrote:
> While cross-building for PPC.
> 
> warning: (PCH_GBE) selects PTP_1588_CLOCK_PCH which has unmet direct
> dependencies (X86 || COMPILE_TEST)
> 
> Both PCH_GBE and PPT_1588_CLOCK_PCH is only compatible with Intel
> architecture. Add dependency on x86 for PCH_GBE. Keep COMPILE_TEST to allow
> building on different arches.
> 
> Signed-off-by: Vladimir Murzin <murzin.v@gmail.com>
> ---
> v1->v2:
>  - s/x86/X86 (pointed  by Randy)
> 
>  drivers/net/ethernet/oki-semi/pch_gbe/Kconfig | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
> index cb22341..4a935ec 100644
> --- a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
> +++ b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
> @@ -4,7 +4,7 @@
>  
>  config PCH_GBE
>  	tristate "OKI SEMICONDUCTOR IOH(ML7223/ML7831) GbE"
> -	depends on PCI
> +	depends on PCI && (X86 || COMPILE_TEST)
>  	select MII
>  	select PTP_1588_CLOCK_PCH
>  	---help---
> -- 
> 1.8.1.5
> 

Please, ignore it. It's already fixed by f0e6160 "net: pch_gbe depends on
x86".

Sorry for the noise.

Vladimir 

^ permalink raw reply

* [PATCH] net: fec: fix phy reset operation to let imx6sl evk work
From: Fugang Duan @ 2013-09-10  2:35 UTC (permalink / raw)
  To: shawn.guo, davem; +Cc: netdev, bhutchings, stephen, b20596, s.hauer, b38611

The patch do correct phy reset operation to let imx6sl evk
ethernet work.

Current driver only do phy reset in probe function, which is
not right. Since some phy clock is disabled after module probe,
the phy enter abnormal status, which needs do reset to recovery
the phy. And do ifconfig ethx up/down test, the phy also enter
abnormal status.

The log as:
libphy: 2188000.ethernet:04 - Link is Up - 10/Full
libphy: 2188000.ethernet:04 - Link is Up - 100/Full
libphy: 2188000.ethernet:04 - Link is Down
libphy: 2188000.ethernet:04 - Link is Up - 10/Half
libphy: 2188000.ethernet:04 - Link is Up - 10/Full
libphy: 2188000.ethernet:04 - Link is Up - 100/Full
...

So, do phy reset if ethx up/down or clock enable/disable.

Signed-off-by: Fugang Duan <B38611@freescale.com>
Reviewed-by: Shawn Guo <R65073@freescale.com>
CC: Shawn Guo <R65073@freescale.com>
CC: Li Frank <B20596@freescale.com>
CC: "David S. Miller" <davem@davemloft.net>
---
 drivers/net/ethernet/freescale/fec.h      |    3 +
 drivers/net/ethernet/freescale/fec_main.c |   61 +++++++++++++++++-----------
 2 files changed, 40 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/freescale/fec.h b/drivers/net/ethernet/freescale/fec.h
index 0120217..b33c92d 100644
--- a/drivers/net/ethernet/freescale/fec.h
+++ b/drivers/net/ethernet/freescale/fec.h
@@ -321,6 +321,9 @@ struct fec_enet_private {
 	struct	napi_struct napi;
 	int	csum_flags;
 
+	int	phy_reset_gpio;
+	int     reset_duration;
+
 	struct ptp_clock *ptp_clock;
 	struct ptp_clock_info ptp_caps;
 	unsigned long last_overflow_check;
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 7a87012..5a9ba1d 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -18,7 +18,7 @@
  * Bug fixes and cleanup by Philippe De Muyter (phdm@macqel.be)
  * Copyright (c) 2004-2006 Macq Electronique SA.
  *
- * Copyright (C) 2010-2011 Freescale Semiconductor, Inc.
+ * Copyright (C) 2010-2013 Freescale Semiconductor, Inc.
  */
 
 #include <linux/module.h>
@@ -61,6 +61,7 @@
 #include "fec.h"
 
 static void set_multicast_list(struct net_device *ndev);
+static void fec_reset_phy(struct platform_device *pdev);
 
 #if defined(CONFIG_ARM)
 #define FEC_ALIGNMENT	0xf
@@ -1781,6 +1782,10 @@ fec_enet_open(struct net_device *ndev)
 	phy_start(fep->phy_dev);
 	netif_start_queue(ndev);
 	fep->opened = 1;
+
+	/* reset phy */
+	fec_enet_reset_phy(fep->pdev);
+
 	return 0;
 }
 
@@ -2030,43 +2035,52 @@ static int fec_enet_init(struct net_device *ndev)
 	return 0;
 }
 
-#ifdef CONFIG_OF
-static void fec_reset_phy(struct platform_device *pdev)
+static void fec_enet_of_init(struct platform_device *pdev)
 {
-	int err, phy_reset;
-	int msec = 1;
 	struct device_node *np = pdev->dev.of_node;
+	struct net_device *ndev = platform_get_drvdata(pdev);
+	struct fec_enet_private *fep = netdev_priv(ndev);
+	int err;
+
+	/*
+	 * init phy-reset-gpio to one invalid GPIO for no phy
+	 * gpio reset platform
+	 */
+	fep->phy_reset_gpio = -1;
 
 	if (!np)
 		return;
 
-	of_property_read_u32(np, "phy-reset-duration", &msec);
+	of_property_read_u32(np, "phy-reset-duration"
+				&fep->reset_duration);
 	/* A sane reset duration should not be longer than 1s */
-	if (msec > 1000)
-		msec = 1;
+	if ((fep->reset_duration > 1000) || (fep->reset_duration == 0))
+		fep->reset_duration = 1;
 
-	phy_reset = of_get_named_gpio(np, "phy-reset-gpios", 0);
-	if (!gpio_is_valid(phy_reset))
+	fep->phy_reset_gpio = of_get_named_gpio(np, "phy-reset-gpios", 0);
+	if (!gpio_is_valid(fep->phy_reset_gpio))
 		return;
 
-	err = devm_gpio_request_one(&pdev->dev, phy_reset,
-				    GPIOF_OUT_INIT_LOW, "phy-reset");
+	err = devm_gpio_request_one(&pdev->dev, fep->phy_reset_gpio,
+				    GPIOF_OUT_INIT_HIGH, "phy-reset");
 	if (err) {
 		dev_err(&pdev->dev, "failed to get phy-reset-gpios: %d\n", err);
-		return;
+		fep->phy_reset_gpio = -1;
 	}
-	msleep(msec);
-	gpio_set_value(phy_reset, 1);
 }
-#else /* CONFIG_OF */
-static void fec_reset_phy(struct platform_device *pdev)
+
+static void fec_enet_reset_phy(struct platform_device *pdev)
 {
-	/*
-	 * In case of platform probe, the reset has been done
-	 * by machine code.
-	 */
+	struct net_device *ndev = platform_get_drvdata(pdev);
+	struct fec_enet_private *fep = netdev_priv(ndev);
+
+	/* check GPIO valid to avoid kernel print warning when no gpio reset */
+	if (gpio_is_valid(fep->phy_reset_gpio)) {
+		gpio_set_value(fep->phy_reset_gpio, 0);
+		msleep(fep->reset_duration);
+		gpio_set_value(fep->phy_reset_gpio, 1);
+	}
 }
-#endif /* CONFIG_OF */
 
 static int
 fec_probe(struct platform_device *pdev)
@@ -2117,6 +2131,7 @@ fec_probe(struct platform_device *pdev)
 
 	platform_set_drvdata(pdev, ndev);
 
+	fec_enet_of_init(pdev);
 	ret = of_get_phy_mode(pdev->dev.of_node);
 	if (ret < 0) {
 		pdata = pdev->dev.platform_data;
@@ -2170,8 +2185,6 @@ fec_probe(struct platform_device *pdev)
 		fep->reg_phy = NULL;
 	}
 
-	fec_reset_phy(pdev);
-
 	if (fep->bufdesc_ex)
 		fec_ptp_init(pdev);
 
-- 
1.7.1

^ permalink raw reply related

* [PATCH v2] pch_gbe: fix unmet direct dependency on PTP_1588_CLOCK_PCH
From: Vladimir Murzin @ 2013-09-10  2:33 UTC (permalink / raw)
  To: netdev
  Cc: davem, ben, jeffrey.t.kirsher, rdunlap, haicheng.lee,
	Vladimir Murzin

While cross-building for PPC.

warning: (PCH_GBE) selects PTP_1588_CLOCK_PCH which has unmet direct
dependencies (X86 || COMPILE_TEST)

Both PCH_GBE and PPT_1588_CLOCK_PCH is only compatible with Intel
architecture. Add dependency on x86 for PCH_GBE. Keep COMPILE_TEST to allow
building on different arches.

Signed-off-by: Vladimir Murzin <murzin.v@gmail.com>
---
v1->v2:
 - s/x86/X86 (pointed  by Randy)

 drivers/net/ethernet/oki-semi/pch_gbe/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
index cb22341..4a935ec 100644
--- a/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
+++ b/drivers/net/ethernet/oki-semi/pch_gbe/Kconfig
@@ -4,7 +4,7 @@
 
 config PCH_GBE
 	tristate "OKI SEMICONDUCTOR IOH(ML7223/ML7831) GbE"
-	depends on PCI
+	depends on PCI && (X86 || COMPILE_TEST)
 	select MII
 	select PTP_1588_CLOCK_PCH
 	---help---
-- 
1.8.1.5

^ permalink raw reply related


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