Netdev List
 help / color / mirror / Atom feed
* Re: Mass udp flow reboot linux with RealTek RTL-8169 Gigabit
From: Seblu @ 2011-02-13 18:02 UTC (permalink / raw)
  To: Francois Romieu; +Cc: Eric Dumazet, lkml, netdev, Ivan Vecera
In-Reply-To: <AANLkTikTw71-mv9WsPT8PxC1a1nwEJ=x0UNDhVQGP1A6@mail.gmail.com>

On Sun, Feb 13, 2011 at 6:27 PM, Seblu <seblu@seblu.net> wrote:
> On Sun, Feb 13, 2011 at 2:56 PM, Francois Romieu <romieu@fr.zoreil.com> wrote:
>> Eric Dumazet <eric.dumazet@gmail.com> :
>> If it still does not perform better, please include the XID line of
>> the r8169 driver from dmesg.
>>
> I've tryed on archlinux i686 distro with 2.6.37 and host reboot like
> under debian.
>
> After this, i tryed  wiith a 2.6.38-rc4 (amd64), which include your
> recent patchs.
>
> # dmesg|grep -i xid
> r8169 0000:04:00.0: eth0: RTL8168b/8111b at 0xffffc90005260000,
> 1c:6f:65:56:d9:17, XID 0c200000 IRQ 47
>
> NIC seems to be reset frequently but host stop rebooting. \o//
ok after about 1 hour of iperf, host reboot.

-- 
Sébastien Luttringer
www.seblu.net

^ permalink raw reply

* Re: [PATCH -next/mmotm] net/can: fix softing build errors
From: David Miller @ 2011-02-13 18:38 UTC (permalink / raw)
  To: randy.dunlap; +Cc: kurt.van.dijck, akpm, netdev, linux-kernel
In-Reply-To: <4D58004A.3060407@oracle.com>

From: Randy Dunlap <randy.dunlap@oracle.com>
Date: Sun, 13 Feb 2011 08:01:14 -0800

> On 02/13/11 05:37, Kurt Van Dijck wrote:
>> The 'select CAN_SOFTING' was introduced because it makes no sense to
>> have CAN_SOFTING_CS alone 'for a normal user', although there is no
>> real dependency.
>> Is a 'select' then still a good option, since it feels like repeating
>> all dependencies from CAN_SOFTING in CAN_SOFTING_CS?
>> What about this?
>> 
>> diff --git a/drivers/net/can/softing/Kconfig b/drivers/net/can/softing/Kconfig
>> index 92bd6bd..55dd3e4 100644
>> --- a/drivers/net/can/softing/Kconfig
>> +++ b/drivers/net/can/softing/Kconfig
>> @@ -18,7 +18,7 @@ config CAN_SOFTING
>>  config CAN_SOFTING_CS
>>  	tristate "Softing Gmbh CAN pcmcia cards"
>>  	depends on PCMCIA
>> -	select CAN_SOFTING
>> +	depends on CAN_SOFTING
>>  	---help---
>>  	  Support for PCMCIA cards from Softing Gmbh & some cards
>>  	  from Vector Gmbh.
>> ---
>> It will present the Softing stuff in Kconfig as if CAN_SOFTING_CS really
>> depends on CAN_SOFTING, which is acceptible from a users perspective.
> 
> That's fine.
> Acked-by: Randy Dunlap <randy.dunlap@oracle.com>

Kurt, please formally re-submit this with a proper commit message,
a signoff for you, and Randy's ACK.

Thanks.

^ permalink raw reply

* Re: [PATCH v5 RESEND 2/9] ethtool: enable GSO and GRO by default
From: David Miller @ 2011-02-13 18:50 UTC (permalink / raw)
  To: mirq-linux; +Cc: netdev, bhutchings
In-Reply-To: <66135e57d38599c0dfce347643858558c4f026c4.1297594674.git.mirq-linux@rere.qmqm.pl>

From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date: Sun, 13 Feb 2011 12:11:45 +0100 (CET)

> 
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>

This is not appropriate.

Now, every driver that lacks SG support will spit out that warning
message in netdev_fix_features().

That's why the check is there conditionalizing NETIF_F_GSO on
NETIF_F_SG in register_netdevice().

^ permalink raw reply

* Re: [PATCH net-next-2.6 v7 1/1] can: c_can: Added support for Bosch C_CAN controller
From: David Miller @ 2011-02-13 18:52 UTC (permalink / raw)
  To: mkl-bIcnvbaLZ9MEGnE8C9+IrQ
  Cc: Socketcan-core-0fE9KPoRgkgATYTw5x5z8w,
	netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <4D56C0ED.1040201-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

From: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
Date: Sat, 12 Feb 2011 18:18:37 +0100

> On 02/11/2011 11:17 AM, Bhupesh Sharma wrote:
>> Bosch C_CAN controller is a full-CAN implementation which is compliant
>> to CAN protocol version 2.0 part A and B. Bosch C_CAN user manual can be
>> obtained from:
>> http://www.semiconductors.bosch.de/media/en/pdf/ipmodules_1/
>> c_can/users_manual_c_can.pdf
>> 
>> This patch adds the support for this controller.
>> The following are the design choices made while writing the controller
>> driver:
>> 1. Interface Register set IF1 has be used only in the current design.
>> 2. Out of the 32 Message objects available, 16 are kept aside for RX
>>    purposes and the rest for TX purposes.
>> 3. NAPI implementation is such that both the TX and RX paths function
>>    in polling mode.
>> 
>> Signed-off-by: Bhupesh Sharma <bhupesh.sharma-qxv4g6HH51o@public.gmane.org>
> 
> Good work!
> 
> Acked-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>

Applied.

^ permalink raw reply

* Re: [PATCH 1/1] tlan: Fix bugs introduced by the last tlan cleanup patch
From: David Miller @ 2011-02-13 18:55 UTC (permalink / raw)
  To: jan.ceuleers; +Cc: sakari.ailus, netdev, error27
In-Reply-To: <4D56C08D.7060007@computer.org>

From: Jan Ceuleers <jan.ceuleers@computer.org>
Date: Sat, 12 Feb 2011 18:17:01 +0100

> On 09/02/11 21:25, Sakari Ailus wrote:
>> Fix two bugs introduced by the patch "tlan: Code cleanup:
>> checkpatch.pl is
>> relatively happy now." In that patch, TLAN_CSTAT_READY was considered
>> as a
>> bit mask containing a single bit set while it was actually had two set
>> instead.
> 
> Commit ID of the referenced patch in net-net is
> c659c38b2796578638548b77ef626d93609ec8ac

I add this information to the commit message, applied, thanks.

^ permalink raw reply

* Re: [net-2.6 PATCH 3/3] net: dcb: application priority is per net_device
From: David Miller @ 2011-02-13 19:03 UTC (permalink / raw)
  To: john.r.fastabend; +Cc: netdev
In-Reply-To: <20110131220059.29758.17857.stgit@jf-dev1-dcblab>

From: John Fastabend <john.r.fastabend@intel.com>
Date: Mon, 31 Jan 2011 14:00:59 -0800

> The app_data priority may not be the same for all net devices.
> In order for stacks with application notifiers to identify the
> specific net device dcb_app_type should be passed in the ptr.
> 
> This allows handlers to use dev_get_by_name() to pin priority
> to net devices.
> 
> Signed-off-by: John Fastabend <john.r.fastabend@intel.com>

Applied.

^ permalink raw reply

* Re: [PATCH net-next-2.6 v7 1/1] can: c_can: Added support for Bosch C_CAN controller
From: David Miller @ 2011-02-13 19:05 UTC (permalink / raw)
  To: mkl; +Cc: bhupesh.sharma, netdev, Socketcan-core
In-Reply-To: <20110213.105216.27797609.davem@davemloft.net>

From: David Miller <davem@davemloft.net>
Date: Sun, 13 Feb 2011 10:52:16 -0800 (PST)

> From: Marc Kleine-Budde <mkl@pengutronix.de>
> Date: Sat, 12 Feb 2011 18:18:37 +0100
> 
>> On 02/11/2011 11:17 AM, Bhupesh Sharma wrote:
>>> Bosch C_CAN controller is a full-CAN implementation which is compliant
>>> to CAN protocol version 2.0 part A and B. Bosch C_CAN user manual can be
>>> obtained from:
>>> http://www.semiconductors.bosch.de/media/en/pdf/ipmodules_1/
>>> c_can/users_manual_c_can.pdf
>>> 
>>> This patch adds the support for this controller.
>>> The following are the design choices made while writing the controller
>>> driver:
>>> 1. Interface Register set IF1 has be used only in the current design.
>>> 2. Out of the 32 Message objects available, 16 are kept aside for RX
>>>    purposes and the rest for TX purposes.
>>> 3. NAPI implementation is such that both the TX and RX paths function
>>>    in polling mode.
>>> 
>>> Signed-off-by: Bhupesh Sharma <bhupesh.sharma@st.com>
>> 
>> Good work!
>> 
>> Acked-by: Marc Kleine-Budde <mkl@pengutronix.de>
> 
> Applied.

Actually, I'm reverting because this causes build regressions:

ERROR: "clk_get_rate" [drivers/net/can/c_can/c_can_platform.ko] undefined!
ERROR: "clk_get" [drivers/net/can/c_can/c_can_platform.ko] undefined!
ERROR: "clk_put" [drivers/net/can/c_can/c_can_platform.ko] undefined!

^ permalink raw reply

* Re: [PATCH] tcp: undo_retrans counter fixes
From: David Miller @ 2011-02-13 19:07 UTC (permalink / raw)
  To: ycheng; +Cc: netdev, ilpo.jarvinen
In-Reply-To: <AANLkTiktBOC_26Aox8LVjPCTh33Gztd7RvA-kQVdih=h@mail.gmail.com>

From: Yuchung Cheng <ycheng@google.com>
Date: Fri, 11 Feb 2011 16:10:50 -0800

> Dave/Ilpo: can this patch get applied or it needs more
> clarification/justification? Thanks.

Ilpo and you are still discussing the merits of doing the
checks in one place or another, and whether this is the best
place to handle this issue.

I also see no rush in applying a patch for an obscure hard to
trigger issue that has been present for such a long time.

It's in the patchwork queue, so don't worry it won't get lost ;)

^ permalink raw reply

* Re: [patch net-next-2.6] net: remove the unnecessary dance around skb_bond_should_drop
From: David Miller @ 2011-02-13 19:07 UTC (permalink / raw)
  To: nicolas.2p.debian; +Cc: jpirko, netdev
In-Reply-To: <4D568251.7000305@gmail.com>

From: Nicolas de Pesloüan <nicolas.2p.debian@gmail.com>
Date: Sat, 12 Feb 2011 13:51:29 +0100

> Le 12/02/2011 11:46, Jiri Pirko a écrit :
>> No need to check (master) twice and to drive in and out the header
>> file.
>>
>> Signed-off-by: Jiri Pirko<jpirko@redhat.com>
> 
> Reviewed-by: Nicolas de Pesloüan <nicolas.2p.debian@free.fr>

Applied.

^ permalink raw reply

* Re: [patch net-next-2.6] net: make dev->master general
From: David Miller @ 2011-02-13 19:08 UTC (permalink / raw)
  To: jpirko; +Cc: netdev, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian
In-Reply-To: <20110212164836.GB12156@psychotron.redhat.com>

From: Jiri Pirko <jpirko@redhat.com>
Date: Sat, 12 Feb 2011 17:48:36 +0100

> dev->master is now tightly connected to bonding driver. This patch makes
> this pointer more general and ready to be used by others.
> 
>  - netdev_set_master() - bond specifics moved to new function
>    netdev_set_bond_master()
>  - introduced netif_is_bond_slave() to check if device is a bonding slave
> 
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>

Applied.

^ permalink raw reply

* Re: [PATCH] Don't potentially dereference NULL in net/dcb/dcbnl.c:dcbnl_getapp()
From: David Miller @ 2011-02-13 19:21 UTC (permalink / raw)
  To: jj
  Cc: linux-kernel, netdev, adobriyan, error27, shmulikr,
	john.r.fastabend, lucy.liu
In-Reply-To: <alpine.LNX.2.00.1102102253230.8012@swampdragon.chaosbits.net>

From: Jesper Juhl <jj@chaosbits.net>
Date: Thu, 10 Feb 2011 22:57:16 +0100 (CET)

> nla_nest_start() may return NULL. If it does then we'll blow up in 
> nla_nest_end() when we dereference the pointer.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Applied.

^ permalink raw reply

* Re: [PATCH] USB Network driver infrastructure: Fix leak when usb_autopm_get_interface() returns less than zero in kevent().
From: David Miller @ 2011-02-13 19:21 UTC (permalink / raw)
  To: jj; +Cc: linux-kernel, linux-usb, netdev, gregkh, dbrownell, dhollis
In-Reply-To: <alpine.LNX.2.00.1102102152450.26035@swampdragon.chaosbits.net>

From: Jesper Juhl <jj@chaosbits.net>
Date: Thu, 10 Feb 2011 21:58:45 +0100 (CET)

> We'll leak the memory allocated to 'urb' in 
> drivers/net/usb/usbnet.c:kevent() when we 'goto fail_lowmem' and the 'urb' 
> variable goes out of scope while still completely unused.
> 
> Signed-off-by: Jesper Juhl <jj@chaosbits.net>

Applied.

^ permalink raw reply

* [patch net-next-2.6 1/4] rtnetlink: implement setting of master device
From: Jiri Pirko @ 2011-02-13 19:31 UTC (permalink / raw)
  To: netdev; +Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian

This patch allows userspace to enslave/release slave devices via netlink
interface using IFLA_MASTER. This introduces generic way to add/remove
underling devices.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 include/linux/netdevice.h |   12 ++++++++++++
 net/core/rtnetlink.c      |   42 ++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5a42b10..d08ef65 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -783,6 +783,14 @@ struct netdev_tc_txq {
  *	Set hardware filter for RFS.  rxq_index is the target queue index;
  *	flow_id is a flow ID to be passed to rps_may_expire_flow() later.
  *	Return the filter ID on success, or a negative error code.
+ *
+ *	Slave management functions (for bridge, bonding, etc). User should
+ *	call netdev_set_master() to set dev->master properly.
+ * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev);
+ *	Called to make another netdev an underling.
+ *
+ * int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev);
+ *	Called to release previously enslaved netdev.
  */
 #define HAVE_NET_DEVICE_OPS
 struct net_device_ops {
@@ -862,6 +870,10 @@ struct net_device_ops {
 						     u16 rxq_index,
 						     u32 flow_id);
 #endif
+	int			(*ndo_add_slave)(struct net_device *dev,
+						 struct net_device *slave_dev);
+	int			(*ndo_del_slave)(struct net_device *dev,
+						 struct net_device *slave_dev);
 };
 
 /*
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index da0fe45..20d067a 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1036,6 +1036,7 @@ const struct nla_policy ifla_policy[IFLA_MAX+1] = {
 	[IFLA_MAP]		= { .len = sizeof(struct rtnl_link_ifmap) },
 	[IFLA_MTU]		= { .type = NLA_U32 },
 	[IFLA_LINK]		= { .type = NLA_U32 },
+	[IFLA_MASTER]		= { .type = NLA_U32 },
 	[IFLA_TXQLEN]		= { .type = NLA_U32 },
 	[IFLA_WEIGHT]		= { .type = NLA_U32 },
 	[IFLA_OPERSTATE]	= { .type = NLA_U8 },
@@ -1178,6 +1179,41 @@ static int do_setvfinfo(struct net_device *dev, struct nlattr *attr)
 	return err;
 }
 
+static int do_set_master(struct net_device *dev, int ifindex)
+{
+	struct net_device *master_dev;
+	const struct net_device_ops *ops;
+	int err;
+
+	if (dev->master) {
+		if (dev->master->ifindex == ifindex)
+			return 0;
+		ops = dev->master->netdev_ops;
+		if (ops->ndo_del_slave) {
+			err = ops->ndo_del_slave(dev->master, dev);
+			if (err)
+				return err;
+		} else {
+			return -EOPNOTSUPP;
+		}
+	}
+
+	if (ifindex) {
+		master_dev = __dev_get_by_index(dev_net(dev), ifindex);
+		if (!master_dev)
+			return -EINVAL;
+		ops = master_dev->netdev_ops;
+		if (ops->ndo_add_slave) {
+			err = ops->ndo_add_slave(master_dev, dev);
+			if (err)
+				return err;
+		} else {
+			return -EOPNOTSUPP;
+		}
+	}
+	return 0;
+}
+
 static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
 		      struct nlattr **tb, char *ifname, int modified)
 {
@@ -1301,6 +1337,12 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
 			goto errout;
 	}
 
+	if (tb[IFLA_MASTER]) {
+		err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]));
+		if (err)
+			goto errout;
+	}
+
 	if (tb[IFLA_TXQLEN])
 		dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]);
 
-- 
1.7.3.4


^ permalink raw reply related

* [patch iproute2 2/4] iplink: implement setting of master device
From: Jiri Pirko @ 2011-02-13 19:32 UTC (permalink / raw)
  To: netdev; +Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian
In-Reply-To: <20110213193105.GD2740@psychotron.redhat.com>


Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 ip/iplink.c   |   16 ++++++++++++++++
 man/man8/ip.8 |   15 ++++++++++++++-
 2 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/ip/iplink.c b/ip/iplink.c
index cb2c4f5..7a1722c 100644
--- a/ip/iplink.c
+++ b/ip/iplink.c
@@ -71,6 +71,8 @@ void iplink_usage(void)
 	fprintf(stderr, "	                  [ vf NUM [ mac LLADDR ]\n");
 	fprintf(stderr, "				   [ vlan VLANID [ qos VLAN-QOS ] ]\n");
 	fprintf(stderr, "				   [ rate TXRATE ] ] \n");
+	fprintf(stderr, "			  [ master DEVICE ]\n");
+	fprintf(stderr, "			  [ nomaster ]\n");
 	fprintf(stderr, "       ip link show [ DEVICE ]\n");
 
 	if (iplink_have_newlink()) {
@@ -361,6 +363,20 @@ int iplink_parse(int argc, char **argv, struct iplink_req *req,
 			if (len < 0)
 				return -1;
 			addattr_nest_end(&req->n, vflist);
+#ifdef IFLA_MASTER
+		} else if (matches(*argv, "master") == 0) {
+			int ifindex;
+			NEXT_ARG();
+			ifindex = ll_name_to_index(*argv);
+			if (!ifindex)
+				invarg("Device does not exist\n", *argv);
+			addattr_l(&req->n, sizeof(*req), IFLA_MASTER,
+				  &ifindex, 4);
+		} else if (matches(*argv, "nomaster") == 0) {
+			int ifindex = 0;
+			addattr_l(&req->n, sizeof(*req), IFLA_MASTER,
+				  &ifindex, 4);
+#endif
 #ifdef IFF_DYNAMIC
 		} else if (matches(*argv, "dynamic") == 0) {
 			NEXT_ARG();
diff --git a/man/man8/ip.8 b/man/man8/ip.8
index 8d55fa9..a473868 100644
--- a/man/man8/ip.8
+++ b/man/man8/ip.8
@@ -95,7 +95,12 @@ ip \- show / manipulate routing, devices, policy routing and tunnels
 .B qos
 .IR VLAN-QOS " ] ] ["
 .B rate
-.IR TXRATE " ]"
+.IR TXRATE " ] |"
+.br
+.B master
+.IR DEVICE
+.br
+.B nomaster
 
 .ti -8
 .B ip link show
@@ -1038,6 +1043,14 @@ Setting this parameter to 0 disables rate limiting. The
 parameter must be specified.
 .in -8
 
+.TP
+.BI master " DEVICE"
+set master device of the device (enslave device).
+
+.TP
+.BI nomaster
+unset master device of the device (release device).
+
 .PP
 .B Warning:
 If multiple parameter changes are requested,
-- 
1.7.3.4


^ permalink raw reply related

* [patch net-next-2.6 3/4] bond: implement [add/del]_slave ops
From: Jiri Pirko @ 2011-02-13 19:33 UTC (permalink / raw)
  To: netdev; +Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian
In-Reply-To: <20110213193105.GD2740@psychotron.redhat.com>

allow enslaving/releasing using netlink interface

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 drivers/net/bonding/bond_main.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 9f87787..77e3c6a 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -4657,6 +4657,8 @@ static const struct net_device_ops bond_netdev_ops = {
 	.ndo_netpoll_cleanup	= bond_netpoll_cleanup,
 	.ndo_poll_controller	= bond_poll_controller,
 #endif
+	.ndo_add_slave		= bond_enslave,
+	.ndo_del_slave		= bond_release,
 };
 
 static void bond_destructor(struct net_device *bond_dev)
-- 
1.7.3.4


^ permalink raw reply related

* [patch net-next-2.6 4/4] bridge: implement [add/del]_slave ops
From: Jiri Pirko @ 2011-02-13 19:33 UTC (permalink / raw)
  To: netdev; +Cc: davem, shemminger, kaber, fubar, eric.dumazet, nicolas.2p.debian
In-Reply-To: <20110213193105.GD2740@psychotron.redhat.com>

add possibility to addif/delif via rtnetlink

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 net/bridge/br_device.c |   17 +++++++++++++++++
 net/bridge/br_if.c     |   11 ++++++++++-
 2 files changed, 27 insertions(+), 1 deletions(-)

diff --git a/net/bridge/br_device.c b/net/bridge/br_device.c
index 5564435..1461b19 100644
--- a/net/bridge/br_device.c
+++ b/net/bridge/br_device.c
@@ -297,6 +297,21 @@ void br_netpoll_disable(struct net_bridge_port *p)
 
 #endif
 
+static int br_add_slave(struct net_device *dev, struct net_device *slave_dev)
+
+{
+	struct net_bridge *br = netdev_priv(dev);
+
+	return br_add_if(br, slave_dev);
+}
+
+static int br_del_slave(struct net_device *dev, struct net_device *slave_dev)
+{
+	struct net_bridge *br = netdev_priv(dev);
+
+	return br_del_if(br, slave_dev);
+}
+
 static const struct ethtool_ops br_ethtool_ops = {
 	.get_drvinfo    = br_getinfo,
 	.get_link	= ethtool_op_get_link,
@@ -326,6 +341,8 @@ static const struct net_device_ops br_netdev_ops = {
 	.ndo_netpoll_cleanup	 = br_netpoll_cleanup,
 	.ndo_poll_controller	 = br_poll_controller,
 #endif
+	.ndo_add_slave		 = br_add_slave,
+	.ndo_del_slave		 = br_del_slave,
 };
 
 static void br_dev_free(struct net_device *dev)
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 2a6801d..dce8f00 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -148,6 +148,8 @@ static void del_nbp(struct net_bridge_port *p)
 
 	netdev_rx_handler_unregister(dev);
 
+	netdev_set_master(dev, NULL);
+
 	br_multicast_del_port(p);
 
 	kobject_uevent(&p->kobj, KOBJ_REMOVE);
@@ -429,10 +431,14 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 	if (br_netpoll_info(br) && ((err = br_netpoll_enable(p))))
 		goto err3;
 
-	err = netdev_rx_handler_register(dev, br_handle_frame, p);
+	err = netdev_set_master(dev, br->dev);
 	if (err)
 		goto err3;
 
+	err = netdev_rx_handler_register(dev, br_handle_frame, p);
+	if (err)
+		goto err4;
+
 	dev->priv_flags |= IFF_BRIDGE_PORT;
 
 	dev_disable_lro(dev);
@@ -455,6 +461,9 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 	kobject_uevent(&p->kobj, KOBJ_ADD);
 
 	return 0;
+
+err4:
+	netdev_set_master(dev, NULL);
 err3:
 	sysfs_remove_link(br->ifobj, p->dev->name);
 err2:
-- 
1.7.3.4


^ permalink raw reply related

* Re: [patch net-next-2.6 1/4] rtnetlink: implement setting of master device
From: Patrick McHardy @ 2011-02-13 19:43 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, shemminger, fubar, eric.dumazet, nicolas.2p.debian
In-Reply-To: <20110213193105.GD2740@psychotron.redhat.com>

Am 13.02.2011 20:31, schrieb Jiri Pirko:
> This patch allows userspace to enslave/release slave devices via netlink
> interface using IFLA_MASTER. This introduces generic way to add/remove
> underling devices.

Looks good to me, just one question:

> @@ -1301,6 +1337,12 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
>  			goto errout;
>  	}
>  
> +	if (tb[IFLA_MASTER]) {
> +		err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]));
> +		if (err)
> +			goto errout;
> +	}

Any reason why you're not setting "modified" here?

> +
>  	if (tb[IFLA_TXQLEN])
>  		dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]);
>  


^ permalink raw reply

* Re: [patch net-next-2.6 1/4] rtnetlink: implement setting of master device
From: Jiri Pirko @ 2011-02-13 20:15 UTC (permalink / raw)
  To: Patrick McHardy
  Cc: netdev, davem, shemminger, fubar, eric.dumazet, nicolas.2p.debian
In-Reply-To: <4D583467.6020803@trash.net>

Sun, Feb 13, 2011 at 08:43:35PM CET, kaber@trash.net wrote:
>Am 13.02.2011 20:31, schrieb Jiri Pirko:
>> This patch allows userspace to enslave/release slave devices via netlink
>> interface using IFLA_MASTER. This introduces generic way to add/remove
>> underling devices.
>
>Looks good to me, just one question:
>
>> @@ -1301,6 +1337,12 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
>>  			goto errout;
>>  	}
>>  
>> +	if (tb[IFLA_MASTER]) {
>> +		err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]));
>> +		if (err)
>> +			goto errout;
>> +	}
>
>Any reason why you're not setting "modified" here?

Ugh, forgot that, thanks. Here's repost:

Subject: [patch net-next-2.6 1/4] rtnetlink: implement setting of master device

This patch allows userspace to enslave/release slave devices via netlink
interface using IFLA_MASTER. This introduces generic way to add/remove
underling devices.

Signed-off-by: Jiri Pirko <jpirko@redhat.com>
---
 include/linux/netdevice.h |   12 ++++++++++++
 net/core/rtnetlink.c      |   43 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 55 insertions(+), 0 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 5a42b10..d08ef65 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -783,6 +783,14 @@ struct netdev_tc_txq {
  *	Set hardware filter for RFS.  rxq_index is the target queue index;
  *	flow_id is a flow ID to be passed to rps_may_expire_flow() later.
  *	Return the filter ID on success, or a negative error code.
+ *
+ *	Slave management functions (for bridge, bonding, etc). User should
+ *	call netdev_set_master() to set dev->master properly.
+ * int (*ndo_add_slave)(struct net_device *dev, struct net_device *slave_dev);
+ *	Called to make another netdev an underling.
+ *
+ * int (*ndo_del_slave)(struct net_device *dev, struct net_device *slave_dev);
+ *	Called to release previously enslaved netdev.
  */
 #define HAVE_NET_DEVICE_OPS
 struct net_device_ops {
@@ -862,6 +870,10 @@ struct net_device_ops {
 						     u16 rxq_index,
 						     u32 flow_id);
 #endif
+	int			(*ndo_add_slave)(struct net_device *dev,
+						 struct net_device *slave_dev);
+	int			(*ndo_del_slave)(struct net_device *dev,
+						 struct net_device *slave_dev);
 };
 
 /*
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index da0fe45..49f7ea5 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1036,6 +1036,7 @@ const struct nla_policy ifla_policy[IFLA_MAX+1] = {
 	[IFLA_MAP]		= { .len = sizeof(struct rtnl_link_ifmap) },
 	[IFLA_MTU]		= { .type = NLA_U32 },
 	[IFLA_LINK]		= { .type = NLA_U32 },
+	[IFLA_MASTER]		= { .type = NLA_U32 },
 	[IFLA_TXQLEN]		= { .type = NLA_U32 },
 	[IFLA_WEIGHT]		= { .type = NLA_U32 },
 	[IFLA_OPERSTATE]	= { .type = NLA_U8 },
@@ -1178,6 +1179,41 @@ static int do_setvfinfo(struct net_device *dev, struct nlattr *attr)
 	return err;
 }
 
+static int do_set_master(struct net_device *dev, int ifindex)
+{
+	struct net_device *master_dev;
+	const struct net_device_ops *ops;
+	int err;
+
+	if (dev->master) {
+		if (dev->master->ifindex == ifindex)
+			return 0;
+		ops = dev->master->netdev_ops;
+		if (ops->ndo_del_slave) {
+			err = ops->ndo_del_slave(dev->master, dev);
+			if (err)
+				return err;
+		} else {
+			return -EOPNOTSUPP;
+		}
+	}
+
+	if (ifindex) {
+		master_dev = __dev_get_by_index(dev_net(dev), ifindex);
+		if (!master_dev)
+			return -EINVAL;
+		ops = master_dev->netdev_ops;
+		if (ops->ndo_add_slave) {
+			err = ops->ndo_add_slave(master_dev, dev);
+			if (err)
+				return err;
+		} else {
+			return -EOPNOTSUPP;
+		}
+	}
+	return 0;
+}
+
 static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
 		      struct nlattr **tb, char *ifname, int modified)
 {
@@ -1301,6 +1337,13 @@ static int do_setlink(struct net_device *dev, struct ifinfomsg *ifm,
 			goto errout;
 	}
 
+	if (tb[IFLA_MASTER]) {
+		err = do_set_master(dev, nla_get_u32(tb[IFLA_MASTER]));
+		if (err)
+			goto errout;
+		modified = 1;
+	}
+
 	if (tb[IFLA_TXQLEN])
 		dev->tx_queue_len = nla_get_u32(tb[IFLA_TXQLEN]);
 
-- 
1.7.3.4


^ permalink raw reply related

* Re: [patch net-next-2.6 1/4] rtnetlink: implement setting of master device
From: Patrick McHardy @ 2011-02-13 20:16 UTC (permalink / raw)
  To: Jiri Pirko
  Cc: netdev, davem, shemminger, fubar, eric.dumazet, nicolas.2p.debian
In-Reply-To: <20110213201536.GH2740@psychotron.redhat.com>

Am 13.02.2011 21:15, schrieb Jiri Pirko:
> Subject: [patch net-next-2.6 1/4] rtnetlink: implement setting of master device
> 
> This patch allows userspace to enslave/release slave devices via netlink
> interface using IFLA_MASTER. This introduces generic way to add/remove
> underling devices.
> 
> Signed-off-by: Jiri Pirko <jpirko@redhat.com>

Acked-by: Patrick McHardy <kaber@trash.net>

^ permalink raw reply

* Re: Mass udp flow reboot linux with RealTek RTL-8169 Gigabit
From: Francois Romieu @ 2011-02-13 20:34 UTC (permalink / raw)
  To: Seblu; +Cc: Eric Dumazet, lkml, netdev, Ivan Vecera
In-Reply-To: <AANLkTikLOJ-XcwfdbWS19DKzh2s91tn5pQjJe0+CeAN-@mail.gmail.com>

Seblu <seblu@seblu.net> :
[...]
> > NIC seems to be reset frequently but host stop rebooting. \o//
> ok after about 1 hour of iperf, host reboot.

Can you apply the patch below on top of 2.6.38-rc4 ?

diff --git a/drivers/net/r8169.c b/drivers/net/r8169.c
index 59ccf0c..5d64b80 100644
--- a/drivers/net/r8169.c
+++ b/drivers/net/r8169.c
@@ -4645,6 +4645,7 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
 			switch (tp->mac_version) {
 			/* Work around for rx fifo overflow */
 			case RTL_GIGA_MAC_VER_11:
+			case RTL_GIGA_MAC_VER_20:
 			case RTL_GIGA_MAC_VER_22:
 			case RTL_GIGA_MAC_VER_26:
 				netif_stop_queue(dev);
@@ -4653,7 +4654,6 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
 			/* Testers needed. */
 			case RTL_GIGA_MAC_VER_17:
 			case RTL_GIGA_MAC_VER_19:
-			case RTL_GIGA_MAC_VER_20:
 			case RTL_GIGA_MAC_VER_21:
 			case RTL_GIGA_MAC_VER_23:
 			case RTL_GIGA_MAC_VER_24:

^ permalink raw reply related

* [PATCH] ATM, Solos PCI ADSL2+: Don't deref NULL pointer if net_ratelimit() and alloc_skb() interact badly.
From: Jesper Juhl @ 2011-02-13 20:49 UTC (permalink / raw)
  To: linux-kernel
  Cc: Chas Williams, linux-atm-general, netdev, Nathan Williams,
	David Woodhouse, Treker Chen

If alloc_skb() fails to allocate memory and returns NULL then we want to 
return -ENOMEM from drivers/atm/solos-pci.c::popen() regardless of the 
value of net_ratelimit(). The way the code is today, we may not return if 
net_ratelimit() returns 0, then we'll proceed to pass a NULL pointer to 
skb_put() which will blow up in our face.
This patch ensures that we always return -ENOMEM on alloc_skb() failure 
and only let the dev_warn() be controlled by the value of net_ratelimit().

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 solos-pci.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/atm/solos-pci.c b/drivers/atm/solos-pci.c
index 73fb1c4..25ef1a4 100644
--- a/drivers/atm/solos-pci.c
+++ b/drivers/atm/solos-pci.c
@@ -866,8 +866,9 @@ static int popen(struct atm_vcc *vcc)
 	}
 
 	skb = alloc_skb(sizeof(*header), GFP_ATOMIC);
-	if (!skb && net_ratelimit()) {
-		dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n");
+	if (!skb) {
+		if (net_ratelimit())
+			dev_warn(&card->dev->dev, "Failed to allocate sk_buff in popen()\n");
 		return -ENOMEM;
 	}
 	header = (void *)skb_put(skb, sizeof(*header));


-- 
Jesper Juhl <jj@chaosbits.net>            http://www.chaosbits.net/
Plain text mails only, please.
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html

^ permalink raw reply related

* Re: [PATCH 02/14] net/fec: release mem_region requested in probe in error path and remove
From: Uwe Kleine-König @ 2011-02-13 21:07 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, shawn.guo, kernel
In-Reply-To: <20110211.212532.229740768.davem@davemloft.net>

Hi David,

On Fri, Feb 11, 2011 at 09:25:32PM -0800, David Miller wrote:
> I can't pull from that tree because it is _NOT_ based upon net-next-2.6
> and therefore brings in all kinds of commits not related to your work.
Sorry, I'm not used to the customs on netdev.  I can rebase, but still I
wonder about the reason you cannot pull for.  The only reason I can
imagine is that you fear unrelated breakage when taking these patches
that are already in Linus' tree.  But if it's that, wouldn't it be great
the realize this breakage already now and not only during the next merge
window?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

^ permalink raw reply

* Re: [PATCH 02/14] net/fec: release mem_region requested in probe in error path and remove
From: David Miller @ 2011-02-13 21:15 UTC (permalink / raw)
  To: u.kleine-koenig; +Cc: netdev, shawn.guo, kernel
In-Reply-To: <20110213210709.GA13279@pengutronix.de>

From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date: Sun, 13 Feb 2011 22:07:09 +0100

> Hi David,
> 
> On Fri, Feb 11, 2011 at 09:25:32PM -0800, David Miller wrote:
>> I can't pull from that tree because it is _NOT_ based upon net-next-2.6
>> and therefore brings in all kinds of commits not related to your work.
> Sorry, I'm not used to the customs on netdev.  I can rebase, but still I
> wonder about the reason you cannot pull for.  The only reason I can
> imagine is that you fear unrelated breakage when taking these patches
> that are already in Linus' tree.  But if it's that, wouldn't it be great
> the realize this breakage already now and not only during the next merge
> window?

My trees only merge in Linus's tree when absolutely necessary,
to resolve conflicts or similar.

We don't bring in unrelated changes into my tree, just for the
sake of doing so.

Otherwise Linus gets all of these ugly merge commits when he
pulls from me, which are entirely unnecessary.



^ permalink raw reply

* [PATCH] Net, USB, Option, hso: Do not dereference NULL pointer
From: Jesper Juhl @ 2011-02-13 21:15 UTC (permalink / raw)
  To: linux-kernel
  Cc: linux-usb, netdev, Greg Kroah-Hartman, Jan Dumon, Filip Aben,
	Denis Joseph Barrow, Andrew Bird

In drivers/net/usb/hso.c::hso_create_bulk_serial_device() we have this 
code:
...
	serial = kzalloc(sizeof(*serial), GFP_KERNEL);
	if (!serial)
		goto exit;
...
exit:
	hso_free_tiomget(serial);
...
hso_free_tiomget() directly dereferences its argument, which in the 
example above is a NULL pointer, ouch.
I could just add a 'if (serial)' test at the 'exit' label, but since most 
freeing functions in the kernel accept NULL pointers (and it seems like 
this was also assumed here) I opted to instead change 'hso_free_tiomget()' 
so that it is safe to call it with a NULL argument. I also modified the 
function to get rid of a pointles conditional before the call to 
'usb_free_urb()' since that function already tests for NULL itself - 
besides fixing the NULL deref this change also buys us a few bytes in 
size.
Before:
$ size drivers/net/usb/hso.o
   text    data     bss     dec     hex filename
  32200     592    9960   42752    a700 drivers/net/usb/hso.o
After:
$ size drivers/net/usb/hso.o
   text    data     bss     dec     hex filename
  32196     592    9960   42748    a6fc drivers/net/usb/hso.o

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 hso.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index bed8fce..6d83812 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2628,15 +2628,15 @@ exit:
 
 static void hso_free_tiomget(struct hso_serial *serial)
 {
-	struct hso_tiocmget *tiocmget = serial->tiocmget;
+	struct hso_tiocmget *tiocmget;
+	if (!serial)
+		return;
+	tiocmget = serial->tiocmget;
 	if (tiocmget) {
-		if (tiocmget->urb) {
-			usb_free_urb(tiocmget->urb);
-			tiocmget->urb = NULL;
-		}
+		usb_free_urb(tiocmget->urb);
+		tiocmget->urb = NULL;
 		serial->tiocmget = NULL;
 		kfree(tiocmget);
-
 	}
 }
 


-- 
Jesper Juhl <jj@chaosbits.net>            http://www.chaosbits.net/
Plain text mails only, please.
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html


^ permalink raw reply related

* Re: potential null pointer dereference in drivers/isdn/hisax/isdnl2.c
From: David Miller @ 2011-02-14  0:53 UTC (permalink / raw)
  To: jj; +Cc: linux-kernel, netdev, tj, isdn
In-Reply-To: <alpine.LNX.2.00.1102032121180.15101@swampdragon.chaosbits.net>

From: Jesper Juhl <jj@chaosbits.net>
Date: Thu, 3 Feb 2011 21:27:56 +0100 (CET)

> In drivers/isdn/hisax/isdnl2.c:l2_pull_iqueue() we have this:
> 
> 	...
> 		skb = alloc_skb(oskb->len + i, GFP_ATOMIC);
> 		memcpy(skb_put(skb, i), header, i);
> 	...
> 
> If alloc_skb() fails and returns NULL then the second line will cause a 
> NULL pointer dereference - skb_put() gives the pointer to 
> skb_tail_pointer() which dereferences it.
> 
> I'm not quite sure how this should be dealt with, so I'll just report it 
> rather than submit a patch. Happy bug fixing :-)

Thanks Jesper, I'll fix this like so:

--------------------
hisax: Fix unchecked alloc_skb() return.

Jesper Juhl noticed that l2_pull_iqueue() does not
check to see if alloc_skb() fails.

Fix this by first trying to reallocate the headroom
if necessary, rather than later after we've made hard
to undo state changes.

Reported-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/isdn/hisax/isdnl2.c |   35 ++++++++++++++++++++---------------
 1 files changed, 20 insertions(+), 15 deletions(-)

diff --git a/drivers/isdn/hisax/isdnl2.c b/drivers/isdn/hisax/isdnl2.c
index 0858791..98ac835 100644
--- a/drivers/isdn/hisax/isdnl2.c
+++ b/drivers/isdn/hisax/isdnl2.c
@@ -1243,14 +1243,21 @@ l2_st7_tout_203(struct FsmInst *fi, int event, void *arg)
 	st->l2.rc = 0;
 }
 
+static int l2_hdr_space_needed(struct Layer2 *l2)
+{
+	int len = test_bit(FLG_LAPD, &l2->flag) ? 2 : 1;
+
+	return len + (test_bit(FLG_LAPD, &l2->flag) ? 2 : 1);
+}
+
 static void
 l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
 {
 	struct PStack *st = fi->userdata;
-	struct sk_buff *skb, *oskb;
+	struct sk_buff *skb;
 	struct Layer2 *l2 = &st->l2;
 	u_char header[MAX_HEADER_LEN];
-	int i;
+	int i, hdr_space_needed;
 	int unsigned p1;
 	u_long flags;
 
@@ -1261,6 +1268,16 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
 	if (!skb)
 		return;
 
+	hdr_space_needed = l2_hdr_space_needed(l2);
+	if (hdr_space_needed > skb_headroom(skb)) {
+		struct sk_buff *orig_skb = skb;
+
+		skb = skb_realloc_headroom(skb, hdr_space_needed);
+		if (!skb) {
+			dev_kfree_skb(orig_skb);
+			return;
+		}
+	}
 	spin_lock_irqsave(&l2->lock, flags);
 	if(test_bit(FLG_MOD128, &l2->flag))
 		p1 = (l2->vs - l2->va) % 128;
@@ -1285,19 +1302,7 @@ l2_pull_iqueue(struct FsmInst *fi, int event, void *arg)
 		l2->vs = (l2->vs + 1) % 8;
 	}
 	spin_unlock_irqrestore(&l2->lock, flags);
-	p1 = skb->data - skb->head;
-	if (p1 >= i)
-		memcpy(skb_push(skb, i), header, i);
-	else {
-		printk(KERN_WARNING
-		"isdl2 pull_iqueue skb header(%d/%d) too short\n", i, p1);
-		oskb = skb;
-		skb = alloc_skb(oskb->len + i, GFP_ATOMIC);
-		memcpy(skb_put(skb, i), header, i);
-		skb_copy_from_linear_data(oskb,
-					  skb_put(skb, oskb->len), oskb->len);
-		dev_kfree_skb(oskb);
-	}
+	memcpy(skb_push(skb, i), header, i);
 	st->l2.l2l1(st, PH_PULL | INDICATION, skb);
 	test_and_clear_bit(FLG_ACK_PEND, &st->l2.flag);
 	if (!test_and_set_bit(FLG_T200_RUN, &st->l2.flag)) {
-- 
1.7.4.1


^ 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