Netdev List
 help / color / mirror / Atom feed
* Re: IEEE 802.1ag / 802.1x / Y1731
From: Satendra... @ 2011-07-13  9:39 UTC (permalink / raw)
  To: Balaji G; +Cc: equinox, netdev
In-Reply-To: <BANLkTi=qe9f_zJRqC9nuzMGViy0YLAzJJg@mail.gmail.com>

Hi Balaji,
Thanks for sharing this information.
We have decided to use dot1ag utils for 802.1ag. Its a user space
implementation of 802.1ag.

I have a question: is there any development going on for Y.1731 for
linux or freebsd
either as user space application like dot1ag OR network stack
enhancements OR anything else)?

Thanks,
Satendra

On 2 July 2011 13:22, Balaji G <balajig.foss@gmail.com> wrote:
> Hi
> Currently ECFM is supported @ the user space level or rather lot of
> companies buy L2 stacks and integrate it with the OS so these stacks have
> ECFM support. When we talk about ECFM we need to really find out whether we
> are going to talk about suppporting ECFM over Provider Bridging Ports or are
> we gonna support ECFM over PBB which is 802.1AH because the place where we
> configure ECFM entities play an important role and this could be defined
> only if we get to know on what we support ECFM. But as on date Linux kernel
> does not have support for ECFM or for Y.1731
> Cheers,
>   - Balaji
>
> On Fri, Jul 1, 2011 at 5:42 PM, Satendra... <satendra.pratap@gmail.com>
> wrote:
>>
>> Hi Balaji,
>> You mean CFM OAM 802.1ag can not be supported under linux yet.
>> I mean there are many routers which are running linux and if they want
>> to support CFM OAM on
>> their routers they will have to make changes in Linux networking stack?
>> Could you please tell about the support of Y.1731 / 802.1ah / 802.1x
>> in the linux networking
>> stack ?
>>
>> Thanks,
>> Satendra
>>
>> On 1 July 2011 15:51, Balaji G <balajig.foss@gmail.com> wrote:
>> >>Could anyone please tell me whether there is any support in Linux
>> >>networking stack for 802.1ag ? If yes please mention the linux version.
>> > Linux Kernel does not support 802.1ag
>> > Thanks,
>> > Cheers,
>> >   - Balaji
>> >
>> >
>> >
>> > On Fri, Jul 1, 2011 at 1:46 PM, Satendra... <satendra.pratap@gmail.com>
>> > wrote:
>> >>
>> >> Hello All,
>> >> Could anyone please tell me whether there is any support in Linux
>> >> networking stack
>> >> for 802.1ag ? If yes please mention the linux version.
>> >> What I need to do is to use CFM OAM (802.1ag) open source client on
>> >> our routers running linux
>> >> on them. Open source client to be used is dot1ag utils.
>> >>
>> >> Thanks,
>> >> Satendra
>> >>
>> >> On 24 June 2011 17:36, Satendra... <satendra.pratap@gmail.com> wrote:
>> >> > Hi,
>> >> > Could someone please tell me which version of linux has got support
>> >> > for below (all three) protocols:
>> >> > - IEEE 802.1ag
>> >> > - 802.1x
>> >> > - Y1731
>> >> >
>> >> > Thanks,
>> >> > Satendra
>> >> >
>> >> --
>> >> 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
>> >
>> >
>
>

^ permalink raw reply

* Re: [PATCH 4/4] slip: remove dead code within the slip initialization
From: David Miller @ 2011-07-13  9:32 UTC (permalink / raw)
  To: matvejchikov; +Cc: netdev
In-Reply-To: <CAKh5naaqpjwaUUwJEkpN4g9iyQeUtZFn+XnCED4R=Ovo_hJ59A@mail.gmail.com>

From: Matvejchikov Ilya <matvejchikov@gmail.com>
Date: Wed, 13 Jul 2011 11:47:38 +0400

> This following code contains a dead "if (dev).." block:
...
> The reason is that the code starting with "if (dev).." is never called as
> when we found an empty slot (dev == NULL) we break the loop and "if (dev).."
> not works eiter the loop ends and we get out with "i >= slip_maxdev".
> 
> Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH 3/4] slip: remove redundant check slip_devs for NULL
From: David Miller @ 2011-07-13  9:32 UTC (permalink / raw)
  To: matvejchikov; +Cc: netdev
In-Reply-To: <CAKh5naa_ARaJvZFOMva9V22YCTkVyPMw1+-x=GTtx-niwpOFSg@mail.gmail.com>

From: Matvejchikov Ilya <matvejchikov@gmail.com>
Date: Wed, 13 Jul 2011 11:46:57 +0400

> As slip_devs is initialized on module load stage there is no reason to
> check it for NULL anywhere instead of the deinitialization routine because
> if we can't get enough memory on startup we don't run at all.
> 
> Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>

Applied.

^ permalink raw reply

* Re: [PATCH 2/4] slip: fix MTU comparation operation when reallocating buffers
From: David Miller @ 2011-07-13  9:32 UTC (permalink / raw)
  To: matvejchikov; +Cc: netdev
In-Reply-To: <CAKh5nabAU=nYJdcbM55J=FDhcrZgW4G+vOBuOjT8TwniT457Jg@mail.gmail.com>

From: Matvejchikov Ilya <matvejchikov@gmail.com>
Date: Wed, 13 Jul 2011 11:46:17 +0400

> In sl_realloc_bufs() there is no reason to check if the requested MTU greater
> than or equal to the current MTU value as this function called only
> when requested
> MTU not equals to the current value. So, the ">=" operation can be
> safely replaced
> with the ">".
> 
> Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>

Patch corrupted by email client:

>  			printk(KERN_WARNING "%s: unable to grow slip buffers, MTU change
> cancelled.\n",

That should be one line.

I applied this by hand.

^ permalink raw reply

* Re: [PATCH 1/4] slip: remove redundant NULL-pointer check before calling slhc_free
From: David Miller @ 2011-07-13  9:32 UTC (permalink / raw)
  To: matvejchikov; +Cc: netdev
In-Reply-To: <CAKh5naafU9=0dZr+QiXjbn57hzCM9BN3YA8h0FpJD6dMH+g4hA@mail.gmail.com>

From: Matvejchikov Ilya <matvejchikov@gmail.com>
Date: Wed, 13 Jul 2011 11:45:37 +0400

> Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>

Applied.

^ permalink raw reply

* [PATCH] net: change return values in mac_pton() function
From: Arend van Spriel @ 2011-07-13  9:30 UTC (permalink / raw)
  To: davem; +Cc: Arend van Spriel, netdev, linux-kernel, Alexey Dobriyan

The original commit adding this function noted a diverge from usual
0=success/-E=fail, but no motivation for it. To stay consistent this
commit adheres to the usual approach. The callers check for result
is changed from 'if(!mac_pton(x, y))' to 'if(mac_pton(x,y) < 0)'.

Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
---
 drivers/net/netconsole.c |    2 +-
 net/core/netpoll.c       |    2 +-
 net/core/pktgen.c        |    4 ++--
 net/core/utils.c         |   10 +++++-----
 4 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/net/netconsole.c b/drivers/net/netconsole.c
index dfc8272..2e8adba 100644
--- a/drivers/net/netconsole.c
+++ b/drivers/net/netconsole.c
@@ -437,7 +437,7 @@ static ssize_t store_remote_mac(struct netconsole_target *nt,
 		return -EINVAL;
 	}
 
-	if (!mac_pton(buf, remote_mac))
+	if (mac_pton(buf, remote_mac) < 0)
 		return -EINVAL;
 	if (buf[3 * ETH_ALEN - 1] && buf[3 * ETH_ALEN - 1] != '\n')
 		return -EINVAL;
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index adf84dd..6b70699 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -691,7 +691,7 @@ int netpoll_parse_options(struct netpoll *np, char *opt)
 
 	if (*cur != 0) {
 		/* MAC address */
-		if (!mac_pton(cur, np->remote_mac))
+		if (mac_pton(cur, np->remote_mac) < 0)
 			goto parse_failed;
 	}
 
diff --git a/net/core/pktgen.c b/net/core/pktgen.c
index f76079c..f17ab6a 100644
--- a/net/core/pktgen.c
+++ b/net/core/pktgen.c
@@ -1429,7 +1429,7 @@ static ssize_t pktgen_if_write(struct file *file,
 		if (copy_from_user(valstr, &user_buffer[i], len))
 			return -EFAULT;
 
-		if (!mac_pton(valstr, pkt_dev->dst_mac))
+		if (mac_pton(valstr, pkt_dev->dst_mac) < 0)
 			return -EINVAL;
 		/* Set up Dest MAC */
 		memcpy(&pkt_dev->hh[0], pkt_dev->dst_mac, ETH_ALEN);
@@ -1446,7 +1446,7 @@ static ssize_t pktgen_if_write(struct file *file,
 		if (copy_from_user(valstr, &user_buffer[i], len))
 			return -EFAULT;
 
-		if (!mac_pton(valstr, pkt_dev->src_mac))
+		if (mac_pton(valstr, pkt_dev->src_mac) < 0)
 			return -EINVAL;
 		/* Set up Src MAC */
 		memcpy(&pkt_dev->hh[6], pkt_dev->src_mac, ETH_ALEN);
diff --git a/net/core/utils.c b/net/core/utils.c
index 386e263f..73299f1 100644
--- a/net/core/utils.c
+++ b/net/core/utils.c
@@ -304,20 +304,20 @@ int mac_pton(const char *s, u8 *mac)
 
 	/* XX:XX:XX:XX:XX:XX */
 	if (strlen(s) < 3 * ETH_ALEN - 1)
-		return 0;
+		return -EINVAL;
 
 	/* Don't dirty result unless string is valid MAC. */
 	for (i = 0; i < ETH_ALEN; i++) {
 		if (!strchr("0123456789abcdefABCDEF", s[i * 3]))
-			return 0;
+			return -EINVAL;
 		if (!strchr("0123456789abcdefABCDEF", s[i * 3 + 1]))
-			return 0;
+			return -EINVAL;
 		if (i != ETH_ALEN - 1 && s[i * 3 + 2] != ':')
-			return 0;
+			return -EINVAL;
 	}
 	for (i = 0; i < ETH_ALEN; i++) {
 		mac[i] = (hex_to_bin(s[i * 3]) << 4) | hex_to_bin(s[i * 3 + 1]);
 	}
-	return 1;
+	return 0;
 }
 EXPORT_SYMBOL(mac_pton);
-- 
1.7.4.1

^ permalink raw reply related

* Re: [PATCH 2/3] iwlegacy: Add missing comma between constant string array
From: Stanislaw Gruszka @ 2011-07-13  9:25 UTC (permalink / raw)
  To: John W. Linville; +Cc: Joe Perches, linux-wireless, netdev, linux-kernel
In-Reply-To: <20110711183542.GB2650@tuxdriver.com>

On Mon, Jul 11, 2011 at 02:35:42PM -0400, John W. Linville wrote:
> How is this array indexed?  Aren't you changing the index of the
> later strings?

We read index directly from device memory (and check agains
ARRAY_SIZE). Patch make indexing correct with code author
intention, ACK. iwlagn should be simmilarly fine.

Stanislaw

> On Fri, Jul 08, 2011 at 11:20:24PM -0700, Joe Perches wrote:
> > Multiple quoted strings are concatenated without comma separators.
> > 
> > Signed-off-by: Joe Perches <joe@perches.com>
> > ---
> >  drivers/net/wireless/iwlegacy/iwl4965-base.c |    2 +-
> >  1 files changed, 1 insertions(+), 1 deletions(-)
> > 
> > diff --git a/drivers/net/wireless/iwlegacy/iwl4965-base.c b/drivers/net/wireless/iwlegacy/iwl4965-base.c
> > index 46242d2..1433466 100644
> > --- a/drivers/net/wireless/iwlegacy/iwl4965-base.c
> > +++ b/drivers/net/wireless/iwlegacy/iwl4965-base.c
> > @@ -1484,7 +1484,7 @@ static const char * const desc_lookup_text[] = {
> >  	"NMI_INTERRUPT_DATA_ACTION_PT",
> >  	"NMI_TRM_HW_ER",
> >  	"NMI_INTERRUPT_TRM",
> > -	"NMI_INTERRUPT_BREAK_POINT"
> > +	"NMI_INTERRUPT_BREAK_POINT",
> >  	"DEBUG_0",
> >  	"DEBUG_1",
> >  	"DEBUG_2",
> > -- 
> > 1.7.6.131.g99019
> > 
> > 
> 
> -- 
> John W. Linville		Someday the world will need a hero, and you
> linville@tuxdriver.com			might be all we have.  Be ready.
> --
> To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH 2/2] net: Kill support for multiple hh_cache entries per neighbour
From: David Miller @ 2011-07-13  8:52 UTC (permalink / raw)
  To: netdev


This never, ever, happens.

Neighbour entries are always tied to one address family, and therefore
one set of dst_ops, and therefore one dst_ops->protocol "hh_type"
value.

This capability was blindly imported by Alexey Kuznetsov when he wrote
the neighbour layer.

Signed-off-by: David S. Miller <davem@davemloft.net>
---
 include/linux/netdevice.h |    9 ++-------
 net/core/neighbour.c      |   37 ++++++++++++++++++-------------------
 2 files changed, 20 insertions(+), 26 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 564d89f..7538237 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -252,7 +252,6 @@ struct netdev_hw_addr_list {
 	netdev_hw_addr_list_for_each(ha, &(dev)->mc)
 
 struct hh_cache {
-	struct hh_cache *hh_next;	/* Next entry			     */
 	atomic_t	hh_refcnt;	/* number of users                   */
 /*
  * We want hh_output, hh_len, hh_lock and hh_data be a in a separate
@@ -260,12 +259,8 @@ struct hh_cache {
  * They are mostly read, but hh_refcnt may be changed quite frequently,
  * incurring cache line ping pongs.
  */
-	__be16		hh_type ____cacheline_aligned_in_smp;
-					/* protocol identifier, f.e ETH_P_IP
-                                         *  NOTE:  For VLANs, this will be the
-                                         *  encapuslated type. --BLG
-                                         */
-	u16		hh_len;		/* length of header */
+	u16		hh_len ____cacheline_aligned_in_smp;
+	u16		__pad;
 	int		(*hh_output)(struct sk_buff *skb);
 	seqlock_t	hh_lock;
 
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 8f7e1d8..f879bb5 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -702,9 +702,9 @@ void neigh_destroy(struct neighbour *neigh)
 	if (neigh_del_timer(neigh))
 		printk(KERN_WARNING "Impossible event.\n");
 
-	while ((hh = neigh->hh) != NULL) {
-		neigh->hh = hh->hh_next;
-		hh->hh_next = NULL;
+	hh = neigh->hh;
+	if (hh) {
+		neigh->hh = NULL;
 
 		write_seqlock_bh(&hh->hh_lock);
 		hh->hh_output = neigh_blackhole;
@@ -737,7 +737,8 @@ static void neigh_suspect(struct neighbour *neigh)
 
 	neigh->output = neigh->ops->output;
 
-	for (hh = neigh->hh; hh; hh = hh->hh_next)
+	hh = neigh->hh;
+	if (hh)
 		hh->hh_output = neigh->ops->output;
 }
 
@@ -754,7 +755,8 @@ static void neigh_connect(struct neighbour *neigh)
 
 	neigh->output = neigh->ops->connected_output;
 
-	for (hh = neigh->hh; hh; hh = hh->hh_next)
+	hh = neigh->hh;
+	if (hh)
 		hh->hh_output = neigh->ops->hh_output;
 }
 
@@ -1025,7 +1027,8 @@ static void neigh_update_hhs(const struct neighbour *neigh)
 		update = neigh->dev->header_ops->cache_update;
 
 	if (update) {
-		for (hh = neigh->hh; hh; hh = hh->hh_next) {
+		hh = neigh->hh;
+		if (hh) {
 			write_seqlock_bh(&hh->hh_lock);
 			update(hh, neigh->dev, neigh->ha);
 			write_sequnlock_bh(&hh->hh_lock);
@@ -1211,19 +1214,17 @@ struct neighbour *neigh_event_ns(struct neigh_table *tbl,
 }
 EXPORT_SYMBOL(neigh_event_ns);
 
-static inline bool neigh_hh_lookup(struct neighbour *n, struct dst_entry *dst,
-				   __be16 protocol)
+static inline bool neigh_hh_lookup(struct neighbour *n, struct dst_entry *dst)
 {
 	struct hh_cache *hh;
 
 	smp_rmb(); /* paired with smp_wmb() in neigh_hh_init() */
-	for (hh = n->hh; hh; hh = hh->hh_next) {
-		if (hh->hh_type == protocol) {
-			atomic_inc(&hh->hh_refcnt);
-			if (unlikely(cmpxchg(&dst->hh, NULL, hh) != NULL))
-				hh_cache_put(hh);
-			return true;
-		}
+	hh = n->hh;
+	if (hh) {
+		atomic_inc(&hh->hh_refcnt);
+		if (unlikely(cmpxchg(&dst->hh, NULL, hh) != NULL))
+			hh_cache_put(hh);
+		return true;
 	}
 	return false;
 }
@@ -1235,7 +1236,7 @@ static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst,
 	struct hh_cache	*hh;
 	struct net_device *dev = dst->dev;
 
-	if (likely(neigh_hh_lookup(n, dst, protocol)))
+	if (likely(neigh_hh_lookup(n, dst)))
 		return;
 
 	/* slow path */
@@ -1244,7 +1245,6 @@ static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst,
 		return;
 
 	seqlock_init(&hh->hh_lock);
-	hh->hh_type = protocol;
 	atomic_set(&hh->hh_refcnt, 2);
 
 	if (dev->header_ops->cache(n, hh, protocol)) {
@@ -1255,7 +1255,7 @@ static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst,
 	write_lock_bh(&n->lock);
 
 	/* must check if another thread already did the insert */
-	if (neigh_hh_lookup(n, dst, protocol)) {
+	if (neigh_hh_lookup(n, dst)) {
 		kfree(hh);
 		goto end;
 	}
@@ -1265,7 +1265,6 @@ static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst,
 	else
 		hh->hh_output = n->ops->output;
 
-	hh->hh_next = n->hh;
 	smp_wmb(); /* paired with smp_rmb() in neigh_hh_lookup() */
 	n->hh	    = hh;
 
-- 
1.7.6


^ permalink raw reply related

* [PATCH 1/2] net: Push protocol type directly down to header_ops->cache()
From: David Miller @ 2011-07-13  8:52 UTC (permalink / raw)
  To: netdev


Signed-off-by: David S. Miller <davem@davemloft.net>
---
 drivers/firewire/net.c      |    6 +++---
 drivers/isdn/i4l/isdn_net.c |    5 +++--
 drivers/net/plip.c          |    6 +++---
 include/linux/etherdevice.h |    2 +-
 include/linux/netdevice.h   |    2 +-
 net/core/neighbour.c        |    2 +-
 net/ethernet/eth.c          |    3 +--
 7 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/firewire/net.c b/drivers/firewire/net.c
index b9762d0..eced1c2 100644
--- a/drivers/firewire/net.c
+++ b/drivers/firewire/net.c
@@ -261,16 +261,16 @@ static int fwnet_header_rebuild(struct sk_buff *skb)
 }
 
 static int fwnet_header_cache(const struct neighbour *neigh,
-			      struct hh_cache *hh)
+			      struct hh_cache *hh, __be16 type)
 {
 	struct net_device *net;
 	struct fwnet_header *h;
 
-	if (hh->hh_type == cpu_to_be16(ETH_P_802_3))
+	if (type == cpu_to_be16(ETH_P_802_3))
 		return -1;
 	net = neigh->dev;
 	h = (struct fwnet_header *)((u8 *)hh->hh_data + 16 - sizeof(*h));
-	h->h_proto = hh->hh_type;
+	h->h_proto = type;
 	memcpy(h->h_dest, neigh->ha, net->addr_len);
 	hh->hh_len = FWNET_HLEN;
 
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c
index 9798811..48e9cc0 100644
--- a/drivers/isdn/i4l/isdn_net.c
+++ b/drivers/isdn/i4l/isdn_net.c
@@ -1983,13 +1983,14 @@ isdn_net_rebuild_header(struct sk_buff *skb)
 	return ret;
 }
 
-static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh)
+static int isdn_header_cache(const struct neighbour *neigh, struct hh_cache *hh,
+			     __be16 type)
 {
 	const struct net_device *dev = neigh->dev;
 	isdn_net_local *lp = netdev_priv(dev);
 
 	if (lp->p_encap == ISDN_NET_ENCAP_ETHER)
-		return eth_header_cache(neigh, hh);
+		return eth_header_cache(neigh, hh, type);
 	return -1;
 }
 
diff --git a/drivers/net/plip.c b/drivers/net/plip.c
index ca4df7f..a9e9ca8 100644
--- a/drivers/net/plip.c
+++ b/drivers/net/plip.c
@@ -152,7 +152,7 @@ static int plip_hard_header(struct sk_buff *skb, struct net_device *dev,
                             unsigned short type, const void *daddr,
 			    const void *saddr, unsigned len);
 static int plip_hard_header_cache(const struct neighbour *neigh,
-                                  struct hh_cache *hh);
+                                  struct hh_cache *hh, __be16 type);
 static int plip_open(struct net_device *dev);
 static int plip_close(struct net_device *dev);
 static int plip_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd);
@@ -1026,11 +1026,11 @@ plip_hard_header(struct sk_buff *skb, struct net_device *dev,
 }
 
 static int plip_hard_header_cache(const struct neighbour *neigh,
-				  struct hh_cache *hh)
+				  struct hh_cache *hh, __be16 type)
 {
 	int ret;
 
-	ret = eth_header_cache(neigh, hh);
+	ret = eth_header_cache(neigh, hh, type);
 	if (ret == 0) {
 		struct ethhdr *eth;
 
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index ab68f78..05955cf 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -38,7 +38,7 @@ extern int eth_header(struct sk_buff *skb, struct net_device *dev,
 		      const void *daddr, const void *saddr, unsigned len);
 extern int eth_rebuild_header(struct sk_buff *skb);
 extern int eth_header_parse(const struct sk_buff *skb, unsigned char *haddr);
-extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh);
+extern int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
 extern void eth_header_cache_update(struct hh_cache *hh,
 				    const struct net_device *dev,
 				    const unsigned char *haddr);
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 30f17e4..564d89f 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -308,7 +308,7 @@ struct header_ops {
 			   const void *saddr, unsigned len);
 	int	(*parse)(const struct sk_buff *skb, unsigned char *haddr);
 	int	(*rebuild)(struct sk_buff *skb);
-	int	(*cache)(const struct neighbour *neigh, struct hh_cache *hh);
+	int	(*cache)(const struct neighbour *neigh, struct hh_cache *hh, __be16 type);
 	void	(*cache_update)(struct hh_cache *hh,
 				const struct net_device *dev,
 				const unsigned char *haddr);
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index 50bd960..8f7e1d8 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -1247,7 +1247,7 @@ static void neigh_hh_init(struct neighbour *n, struct dst_entry *dst,
 	hh->hh_type = protocol;
 	atomic_set(&hh->hh_refcnt, 2);
 
-	if (dev->header_ops->cache(n, hh)) {
+	if (dev->header_ops->cache(n, hh, protocol)) {
 		kfree(hh);
 		return;
 	}
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index 44d2b42..5cffb63 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -233,9 +233,8 @@ EXPORT_SYMBOL(eth_header_parse);
  * @hh: destination cache entry
  * Create an Ethernet header template from the neighbour.
  */
-int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh)
+int eth_header_cache(const struct neighbour *neigh, struct hh_cache *hh, __be16 type)
 {
-	__be16 type = hh->hh_type;
 	struct ethhdr *eth;
 	const struct net_device *dev = neigh->dev;
 
-- 
1.7.6


^ permalink raw reply related

* [PATCH 0/2] Get rid of "multi-hh_cache" capability.
From: David Miller @ 2011-07-13  8:52 UTC (permalink / raw)
  To: netdev


We support having multiple hh_cache entries in a list hung off
of a neighbour entry, one per unique ->hh_type protocol value.

Problem is, nobody uses this.

Neighbour entries are for one protocol type only (which determines the
type of the key), whose protocol is "dst_ops->protocol".

Kill all of this noise, which dates back to before Alexey Kuznetsov
added the neighbour layer.  He just blinded copied over this
capability into the generic layer.

The next step will be to embed "struct hh_cache" directly into "struct
neighbour".  Validity will be indicated by a non-zero hh_len.

Then we can get rid of all of this extra memory allocations, funky
refcounting, and SMP memory barriers.

And finally, move to refcount-less neigh entry usage in ip_finish_output2()

^ permalink raw reply

* [PATCH 4/4] slip: remove dead code within the slip initialization
From: Matvejchikov Ilya @ 2011-07-13  7:47 UTC (permalink / raw)
  To: netdev; +Cc: matvejchikov

This following code contains a dead "if (dev).." block:
        ...
        for (i = 0; i < slip_maxdev; i++) {
                dev = slip_devs[i];
                if (dev == NULL)
                        break;
        }
        /* Sorry, too many, all slots in use */
        if (i >= slip_maxdev)
                return NULL;

        if (dev) {
                sl = netdev_priv(dev);
                if (test_bit(SLF_INUSE, &sl->flags)) {
                        unregister_netdevice(dev);
                        dev = NULL;
                        slip_devs[i] = NULL;
                }
         }
        ...
The reason is that the code starting with "if (dev).." is never called as
when we found an empty slot (dev == NULL) we break the loop and "if (dev).."
not works eiter the loop ends and we get out with "i >= slip_maxdev".

Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>
---
 drivers/net/slip.c |   24 ++++++------------------
 1 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 6f97c59..11c9ab3 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -723,6 +723,7 @@ static void sl_sync(void)
 static struct slip *sl_alloc(dev_t line)
 {
 	int i;
+	char name[IFNAMSIZ];
 	struct net_device *dev = NULL;
 	struct slip       *sl;

@@ -735,25 +736,12 @@ static struct slip *sl_alloc(dev_t line)
 	if (i >= slip_maxdev)
 		return NULL;

-	if (dev) {
-		sl = netdev_priv(dev);
-		if (test_bit(SLF_INUSE, &sl->flags)) {
-			unregister_netdevice(dev);
-			dev = NULL;
-			slip_devs[i] = NULL;
-		}
-	}
-
-	if (!dev) {
-		char name[IFNAMSIZ];
-		sprintf(name, "sl%d", i);
-
-		dev = alloc_netdev(sizeof(*sl), name, sl_setup);
-		if (!dev)
-			return NULL;
-		dev->base_addr  = i;
-	}
+	sprintf(name, "sl%d", i);
+	dev = alloc_netdev(sizeof(*sl), name, sl_setup);
+	if (!dev)
+		return NULL;

+	dev->base_addr  = i;
 	sl = netdev_priv(dev);

 	/* Initialize channel control data */
-- 
1.7.6

^ permalink raw reply related

* [PATCH 3/4] slip: remove redundant check slip_devs for NULL
From: Matvejchikov Ilya @ 2011-07-13  7:46 UTC (permalink / raw)
  To: netdev; +Cc: matvejchikov

As slip_devs is initialized on module load stage there is no reason to
check it for NULL anywhere instead of the deinitialization routine because
if we can't get enough memory on startup we don't run at all.

Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>
---
 drivers/net/slip.c |    3 ---
 1 files changed, 0 insertions(+), 3 deletions(-)

diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index d724d47..6f97c59 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -726,9 +726,6 @@ static struct slip *sl_alloc(dev_t line)
 	struct net_device *dev = NULL;
 	struct slip       *sl;

-	if (slip_devs == NULL)
-		return NULL;	/* Master array missing ! */
-
 	for (i = 0; i < slip_maxdev; i++) {
 		dev = slip_devs[i];
 		if (dev == NULL)
-- 
1.7.6

^ permalink raw reply related

* [PATCH 2/4] slip: fix MTU comparation operation when reallocating buffers
From: Matvejchikov Ilya @ 2011-07-13  7:46 UTC (permalink / raw)
  To: netdev; +Cc: matvejchikov

In sl_realloc_bufs() there is no reason to check if the requested MTU greater
than or equal to the current MTU value as this function called only
when requested
MTU not equals to the current value. So, the ">=" operation can be
safely replaced
with the ">".

Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>
---
 drivers/net/slip.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index e8c4582..d724d47 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -247,7 +247,7 @@ static int sl_realloc_bufs(struct slip *sl, int mtu)
 #else
 	if (xbuff == NULL || rbuff == NULL)  {
 #endif
-		if (mtu >= sl->mtu) {
+		if (mtu > sl->mtu) {
 			printk(KERN_WARNING "%s: unable to grow slip buffers, MTU change
cancelled.\n",
 			       dev->name);
 			err = -ENOBUFS;
-- 
1.7.6

^ permalink raw reply related

* [PATCH 1/4] slip: remove redundant NULL-pointer check before calling slhc_free
From: Matvejchikov Ilya @ 2011-07-13  7:45 UTC (permalink / raw)
  To: netdev; +Cc: matvejchikov

Signed-off-by: Matvejchikov Ilya <matvejchikov@gmail.com>
---
 drivers/net/slip.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 8ec1a9a..e8c4582 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -194,8 +194,7 @@ static int sl_alloc_bufs(struct slip *sl, int mtu)
 err_exit:
 #ifdef SL_INCLUDE_CSLIP
 	kfree(cbuff);
-	if (slcomp)
-		slhc_free(slcomp);
+	slhc_free(slcomp);
 #endif
 	kfree(xbuff);
 	kfree(rbuff);
-- 
1.7.6

^ permalink raw reply related

* slip-driver cleanups
From: Matvejchikov Ilya @ 2011-07-13  7:43 UTC (permalink / raw)
  To: netdev; +Cc: matvejchikov

There are some fixes in slip driver, please review.

^ permalink raw reply

* Re: softirqs are invoked while bottom halves are masked
From: Eric Dumazet @ 2011-07-13  7:38 UTC (permalink / raw)
  To: Thomas De Schampheleire
  Cc: David Miller, ronny.meeus, linuxppc-dev, netdev, afleming
In-Reply-To: <CAAXf6LXddZUHEz738DDTi-XqENRYT7dTODw+1C4RTYsCdyro7g@mail.gmail.com>

Le mercredi 13 juillet 2011 à 09:20 +0200, Thomas De Schampheleire a
écrit :

> I just want to mention that, although you seem to think that we
> shouldn't have created this thread in the first place, your and Eric's
> remarks have actually helped us in identifying the problem and
> increasing our understanding.
> 

Thread was fine IMHO, but should have mentioned the context of "non
standard linux-2.6 or net-next-2.6 trees"

I would like to mention NETIF_F_LLTX existence.

While being marked deprecated, it allows a lockless tx path :

The device transmit handler can then perform custom actions, including
its own locking if needed.

If the user wants a specific Qdisc setup (instead of a no qdisc one), it
still can.

veth, loopback, dummy, macvlan & bond devices use NETIF_F_LLTX for
example.

But ndo_start_xmit() must always be called with BH disabled.




^ permalink raw reply

* Re: softirqs are invoked while bottom halves are masked
From: Thomas De Schampheleire @ 2011-07-13  7:20 UTC (permalink / raw)
  To: David Miller; +Cc: ronny.meeus, eric.dumazet, linuxppc-dev, netdev, afleming
In-Reply-To: <20110712.051316.1963034055315982365.davem@davemloft.net>

On Tue, Jul 12, 2011 at 2:13 PM, David Miller <davem@davemloft.net> wrote:
> From: David Miller <davem@davemloft.net>
> Date: Tue, 12 Jul 2011 05:08:17 -0700 (PDT)
>
>> From: Ronny Meeus <ronny.meeus@gmail.com>
>> Date: Tue, 12 Jul 2011 14:03:04 +0200
>>
>>> but we still see the issue "BUG: sleeping function called from invalid context":
>>>
>>> [   91.015989] BUG: sleeping function called from invalid context at
>>> include/linux/skbuff.h:786
>>> [   91.117096] in_atomic(): 1, irqs_disabled(): 0, pid: 1865, name: NMTX_T1842
>>> [   91.200461] Call Trace:
>>> [   91.229672] [ec58bbd0] [c000789c] show_stack+0x78/0x18c (unreliable)
>>> [   91.305791] [ec58bc10] [c0022900] __might_sleep+0x100/0x118
>>> [   91.372524] [ec58bc20] [c029f8d8] dpa_tx+0x128/0x758
>>
>> Because this dpa driver's transmit method is doing something else that
>> is not allowed in software interrupt context.
>>
>> You must remove all things that might sleep in this driver's
>> ->ndo_start_xmit method, and I do mean everything.
>
> Also this whole HW QOS feature bit facility is beyond bogus.
>
> What if the user enables a qdisc that the hardware can't handle, or a
> configuration of a hw supported qdisc that the hardware can't support?
>
> What if I have packet classification and packet actions enabled in the
> packet scheduler?
>
> These changes are terrible, and we really need you guys to sort out
> your problems with these changes yoursleves because your wounds are
> entirely self-inflicted and totally not our problem.
>

Of course, you make very valid points.

I just want to mention that, although you seem to think that we
shouldn't have created this thread in the first place, your and Eric's
remarks have actually helped us in identifying the problem and
increasing our understanding.

So, thanks for that.

Thomas

^ permalink raw reply

* Re: [patch net-next-2.6] net: allow multiple rx_handler registration
From: Jiri Pirko @ 2011-07-13  5:28 UTC (permalink / raw)
  To: David Lamparter
  Cc: netdev, davem, shemminger, kaber, fubar, eric.dumazet,
	nicolas.2p.debian, andy, greearb, mirqus
In-Reply-To: <20110712160330.GC909183@jupiter.n2.diac24.net>

Tue, Jul 12, 2011 at 06:03:30PM CEST, equinox@diac24.net wrote:
>On Tue, Jul 12, 2011 at 05:01:22PM +0200, Jiri Pirko wrote:
>> Tue, Jul 12, 2011 at 04:29:38PM CEST, equinox@diac24.net wrote:
>> >On Tue, Jul 12, 2011 at 03:20:08PM +0200, Jiri Pirko wrote:
>> >> Not possible. See netdev_set_master(). Anyway, before rx_handler was
>> >> introduced, this was possible and no one cared.
>> >
>> >I don't see how this is related. I'm talking about the other end of your
>> >bond. Like for example the 802.3ad capable switch you're bonding to.
>> 
>> Well it is related in way that you cannot have one device in br an bond
>> in same time....
>
>Grah, I was looking at our production kernel tree, which doesn't have
>the netdev_set_master calls from the bridging code. Sorry, my fault.
>
>> >> >b) a device having macvlans and being a bond slave
>> >> > -> Fully incompatible. Same as above, packets to the macvlan will end
>> >> >    up on other bond member devices.
>
>But case b) is still up & alive, macvlan doesn't use netdev_set_master.
>
>> >> This patch doen't introduce anything new which wasn't possible before
>> >> rx_handler times. Anyway removing bond from using rx_handler as you
>> >> suggested pushes us back.
>> >
>> >I would actually consider this a regression, if the clashing rx_handler
>> >is the only thing that gets bonding an 'exclusive' hold of the device.
>> 
>> No regression. Regression it would be if something wouldn't work on same
>> setup. But this is not the case!
>
>Your patch allows a setup (bond+macvlan) that is not only a violation of
>the specification's letters, but will also wreak rather big havoc and
>may cause parts of itself to become non-functioning.
>
>What happens when the user does this?:
> eth0 -> bond0
>    -> macvlan0 -> bond1
>
>My complaint is primary centering on the inclusion of bonding code into
>this. There might be bonding modes where this is acceptable, but in
>802.3ad mode this royally breaks things.

Well as I pointed out, this is not a regression. User should not
configure this. And as I said, I plan to cook some follow up patches to
make this configs not possible in future. But anyway, user should be
responsible for his config and if it's wrong he should not expect it to
work. I can imagine a large set of screwed up configs which are not
forbidden. Forbidding all wrong configs is not the right way I think.

>
>> >> And to your idea about multi-bridge support, br co needs to be
>> >> adjusted as well. And in relation with PRIO, my idea (inspired from RFC
>> >> of this patch comments) is to allow users to change priorities
>> >> dynamically from userspace. Also then it could be a range of prios for
>> >> bridge for example.
>> >
>> >Hoping I can convey my point,
>> >
>> >
>> >-David
>> >
>> >
>> >P.S.: Could you please provide some sample usage cases for this feature?
>> 
>> Converting vlan to rx_handler needs this at least.
>
>Hm, yes. I guess this patch is needed to pave the way. I uphold my fears
>about including bonding (read: 802.3ad) in this though. Maybe I should
>cook up some code to give 802.3ad an exclusive grip on the slaves?

Sure you can. But I was thinking about some more generic way.

>
>
>-David

^ permalink raw reply

* Re: [PATCH v2] net: Add documentation for netdev features handling
From: David Miller @ 2011-07-13  5:27 UTC (permalink / raw)
  To: mirq-linux
  Cc: netdev, greearb, shemminger, bhutchings, donald.c.skidmore,
	jeffrey.t.kirsher, rdunlap
In-Reply-To: <6c65d5e3927e36cbb356d406494f8b9843523769.1310499566.git.mirq-linux@rere.qmqm.pl>

From: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Date: Tue, 12 Jul 2011 21:41:29 +0200 (CEST)

> v2: incorporated suggestions from Randy Dunlap
> 
> Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>

Applied.

^ permalink raw reply

* Re: [PATCH net-next] be2net: move to new vlan model
From: David Miller @ 2011-07-13  5:10 UTC (permalink / raw)
  To: ajit.khaparde; +Cc: netdev
In-Reply-To: <20110712230855.GA13833@akhaparde-VBox>

From: Ajit Khaparde <ajit.khaparde@Emulex.Com>
Date: Tue, 12 Jul 2011 18:08:56 -0500

> Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>

Applied.

^ permalink raw reply

* Re: [PATCH] be2net: account for skb allocation failures
From: David Miller @ 2011-07-13  5:09 UTC (permalink / raw)
  To: eric.dumazet; +Cc: netdev, ajit.khaparde
In-Reply-To: <1310520703.2634.5.camel@edumazet-laptop>

From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 13 Jul 2011 03:31:43 +0200

> If we cannot allocate new skbs in RX completion handler, we should
> increase netdevice rx_dropped counter, not spam console messages.
> 
> Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> CC: Ajit Khaparde <ajit.khaparde@emulex.com>
> ---
> Note: This driver uses u64 fields without proper synch on 32bit arches.

Applied to net-next-2.6, thanks.

^ permalink raw reply

* Re: [net-next 2/2] e1000e: use GFP_KERNEL allocations at init time
From: David Miller @ 2011-07-13  5:08 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: netdev, gospo, eric.dumazet, greearb, bruce.w.allan
In-Reply-To: <1310523012-25391-2-git-send-email-jeffrey.t.kirsher@intel.com>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue, 12 Jul 2011 19:10:12 -0700

> In process and sleep allowed context, favor GFP_KERNEL allocations over
> GFP_ATOMIC ones.
> 
> -v2: fixed checkpatch.pl warnings
> 
> CC: Eric Dumazet <eric.dumazet@gmail.com>
> CC: Ben Greear <greearb@candelatech.com>
> CC: Bruce Allan <bruce.w.allan@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
> Tested-by: Aaron Brown <aaron.f.brown@intel.com>

Applied.

^ permalink raw reply

* Re: [net-next 1/2] e1000e: Add Jumbo Frame support to 82583 devices
From: David Miller @ 2011-07-13  5:08 UTC (permalink / raw)
  To: jeffrey.t.kirsher; +Cc: carolyn.wyborny, netdev, gospo
In-Reply-To: <1310523012-25391-1-git-send-email-jeffrey.t.kirsher@intel.com>

From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Tue, 12 Jul 2011 19:10:11 -0700

> From: Carolyn Wyborny <carolyn.wyborny@intel.com>
> 
> This patch adds support for the Jumbo Frames feature on 82583 devices.
> 
> Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com>
> Tested-by:  Aaron Brown <aaron.f.brown@intel.com>
> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>

Applied.

^ permalink raw reply

* [PATCH net-next v2 1/1] af-packet: fix - avoid reading stale data
From: Chetan Loke @ 2011-07-13  2:47 UTC (permalink / raw)
  To: davem, netdev; +Cc: lokechetan, eric.dumazet, Chetan Loke

Currently we flush tp_status and then flush the remainder of the header+payload.
tp_status should be flushed in the end to avoid stale data being read by user-space.

Incorrectly re-ordered barriers in v1.

Signed-off-by: Chetan Loke <loke.chetan@gmail.com>
---
 net/packet/af_packet.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index d2294ad..c698cec 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -1129,7 +1129,6 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
 	else
 		sll->sll_ifindex = dev->ifindex;
 
-	__packet_set_status(po, h.raw, status);
 	smp_mb();
 #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 1
 	{
@@ -1138,8 +1137,10 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
 		end = (u8 *)PAGE_ALIGN((unsigned long)h.raw + macoff + snaplen);
 		for (start = h.raw; start < end; start += PAGE_SIZE)
 			flush_dcache_page(pgv_to_page(start));
+		smp_wmb();
 	}
 #endif
+	__packet_set_status(po, h.raw, status);
 
 	sk->sk_data_ready(sk, 0);
 
-- 
1.7.5.2


^ permalink raw reply related

* Re: [PATCH net-next 1/1] af-packet: fix - avoid reading stale data
From: chetan loke @ 2011-07-13  2:19 UTC (permalink / raw)
  To: Eric Dumazet; +Cc: davem, netdev, lokechetan
In-Reply-To: <1310522190.2634.8.camel@edumazet-laptop>

On Tue, Jul 12, 2011 at 9:56 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> Le mardi 12 juillet 2011 à 21:42 -0400, Chetan Loke a écrit :
>> Currently we flush tp_status and then flush the remainder of the header+payload.
>> tp_status should be flushed in the end to avoid stale data being read by user-space.
>>
>>
>> Signed-off-by: Chetan Loke <loke.chetan@gmail.com>
>> ---
>>  net/packet/af_packet.c |    4 ++--
>>  1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
>> index d2294ad..f7be71f 100644
>> --- a/net/packet/af_packet.c
>> +++ b/net/packet/af_packet.c
>> @@ -1129,8 +1129,6 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
>>       else
>>               sll->sll_ifindex = dev->ifindex;
>>
>> -     __packet_set_status(po, h.raw, status);
>> -     smp_mb();
>>  #if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 1
>>       {
>>               u8 *start, *end;
>> @@ -1140,6 +1138,8 @@ static int tpacket_rcv(struct sk_buff *skb, struct net_device *dev,
>>                       flush_dcache_page(pgv_to_page(start));
>>       }
>>  #endif
>> +     smp_mb();
>> +     __packet_set_status(po, h.raw, status);
>>
>>       sk->sk_data_ready(sk, 0);
>>
>
> Are you sure we can perform the flush_dcache_page() before smp_mb() ?
>
> I believe we should do one smp_wmb() before __packet_set_status() as
> well.

Eric - something like this?

#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE == 1
          smp_wmb();
#endif
__packet_set_status(po, h.raw, status);


Chetan Loke

^ permalink raw reply


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