Netdev List
 help / color / mirror / Atom feed
* Re: [PATCH 4/5] pm: move pm notifiers into suspend.h
From: Pavel Machek @ 2011-06-23 20:24 UTC (permalink / raw)
  To: Cong Wang
  Cc: Rafael J. Wysocki, linux-kernel, akpm, netdev, Chris Ball,
	Len Brown, Ohad Ben-Cohen, Linus Walleij, Philip Rakity,
	David S. Miller, Lucas De Marchi, Paul E. McKenney, Josh Triplett,
	linux-mmc, linux-pm
In-Reply-To: <4E02C93A.7010601@redhat.com>

On Thu 2011-06-23 13:03:54, Cong Wang wrote:
> ??? 2011???06???23??? 03:49, Rafael J. Wysocki ??????:
> >>+#ifdef CONFIG_PM
> >>>  +#include<linux/suspend.h>
> >>>  +#endif
> >I don't think the #ifdef in necessary.  Any dependencies on CONFIG_PM
> >(or CONFIG_SUSPEND etc.) should be taken care of inside of suspend.h.
> >This file should be fixed if they aren't.
> >
> 
> Ok, please check the updated version below.
> 
> Thanks.
> 

> Author: Amerigo Wang <amwang@redhat.com>
> 
>     pm: move pm notifiers into suspend.h
> 
> Signed-off-by: WANG Cong <amwang@redhat.com>

ACK.

-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply

* [PATCH 1/2] can: bfin_can: simplify xmit id1 setup
From: Mike Frysinger @ 2011-06-23 20:36 UTC (permalink / raw)
  To: socketcan-core, Urs Thuermann, Oliver Hartkopp, netdev,
	David S. Miller
  Cc: uclinux-dist-devel

If we look closely, the 4 writes to TRANSMIT_CHL.id1 can be collapsed
down into much simpler code.  So do just that.

This also fixes a build failure due to the I/O macros no longer
getting pulled in.  Their minor (and accidental) usage here gets
dropped as part of the unification.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 drivers/net/can/bfin_can.c |   21 ++++++---------------
 1 files changed, 6 insertions(+), 15 deletions(-)

diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c
index b6e890d..dc6ef4a 100644
--- a/drivers/net/can/bfin_can.c
+++ b/drivers/net/can/bfin_can.c
@@ -243,21 +243,12 @@ static int bfin_can_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	/* fill id */
 	if (id & CAN_EFF_FLAG) {
 		bfin_write16(&reg->chl[TRANSMIT_CHL].id0, id);
-		if (id & CAN_RTR_FLAG)
-			writew(((id & 0x1FFF0000) >> 16) | IDE | AME | RTR,
-					&reg->chl[TRANSMIT_CHL].id1);
-		else
-			writew(((id & 0x1FFF0000) >> 16) | IDE | AME,
-					&reg->chl[TRANSMIT_CHL].id1);
-
-	} else {
-		if (id & CAN_RTR_FLAG)
-			writew((id << 2) | AME | RTR,
-				&reg->chl[TRANSMIT_CHL].id1);
-		else
-			bfin_write16(&reg->chl[TRANSMIT_CHL].id1,
-					(id << 2) | AME);
-	}
+		val = ((id & 0x1FFF0000) >> 16) | IDE;
+	} else
+		val = (id << 2);
+	if (id & CAN_RTR_FLAG)
+		val |= RTR;
+	bfin_write16(&reg->chl[TRANSMIT_CHL].id1, val | AME);
 
 	/* fill payload */
 	for (i = 0; i < 8; i += 2) {
-- 
1.7.5.3


^ permalink raw reply related

* [PATCH 2/2] can: bfin_can: auto-calculate accessor sizes
From: Mike Frysinger @ 2011-06-23 20:36 UTC (permalink / raw)
  To: socketcan-core, Urs Thuermann, Oliver Hartkopp, netdev,
	David S. Miller
  Cc: uclinux-dist-devel
In-Reply-To: <1308861380-27485-1-git-send-email-vapier@gentoo.org>

Since we have a struct that defines the sizes of the registers, we don't
need to explicitly use the 16bit read/write helpers.  Let the code figure
out which size access to make based on the size of the C type.

There should be no functional changes here.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
---
 drivers/net/can/bfin_can.c |  118 ++++++++++++++++++++++----------------------
 1 files changed, 59 insertions(+), 59 deletions(-)

diff --git a/drivers/net/can/bfin_can.c b/drivers/net/can/bfin_can.c
index dc6ef4a..a1c5abc 100644
--- a/drivers/net/can/bfin_can.c
+++ b/drivers/net/can/bfin_can.c
@@ -79,8 +79,8 @@ static int bfin_can_set_bittiming(struct net_device *dev)
 	if (priv->can.ctrlmode & CAN_CTRLMODE_3_SAMPLES)
 		timing |= SAM;
 
-	bfin_write16(&reg->clock, clk);
-	bfin_write16(&reg->timing, timing);
+	bfin_write(&reg->clock, clk);
+	bfin_write(&reg->timing, timing);
 
 	dev_info(dev->dev.parent, "setting CLOCK=0x%04x TIMING=0x%04x\n",
 			clk, timing);
@@ -96,16 +96,16 @@ static void bfin_can_set_reset_mode(struct net_device *dev)
 	int i;
 
 	/* disable interrupts */
-	bfin_write16(&reg->mbim1, 0);
-	bfin_write16(&reg->mbim2, 0);
-	bfin_write16(&reg->gim, 0);
+	bfin_write(&reg->mbim1, 0);
+	bfin_write(&reg->mbim2, 0);
+	bfin_write(&reg->gim, 0);
 
 	/* reset can and enter configuration mode */
-	bfin_write16(&reg->control, SRS | CCR);
+	bfin_write(&reg->control, SRS | CCR);
 	SSYNC();
-	bfin_write16(&reg->control, CCR);
+	bfin_write(&reg->control, CCR);
 	SSYNC();
-	while (!(bfin_read16(&reg->control) & CCA)) {
+	while (!(bfin_read(&reg->control) & CCA)) {
 		udelay(10);
 		if (--timeout == 0) {
 			dev_err(dev->dev.parent,
@@ -119,33 +119,33 @@ static void bfin_can_set_reset_mode(struct net_device *dev)
 	 * by writing to CAN Mailbox Configuration Registers 1 and 2
 	 * For all bits: 0 - Mailbox disabled, 1 - Mailbox enabled
 	 */
-	bfin_write16(&reg->mc1, 0);
-	bfin_write16(&reg->mc2, 0);
+	bfin_write(&reg->mc1, 0);
+	bfin_write(&reg->mc2, 0);
 
 	/* Set Mailbox Direction */
-	bfin_write16(&reg->md1, 0xFFFF);   /* mailbox 1-16 are RX */
-	bfin_write16(&reg->md2, 0);   /* mailbox 17-32 are TX */
+	bfin_write(&reg->md1, 0xFFFF);   /* mailbox 1-16 are RX */
+	bfin_write(&reg->md2, 0);   /* mailbox 17-32 are TX */
 
 	/* RECEIVE_STD_CHL */
 	for (i = 0; i < 2; i++) {
-		bfin_write16(&reg->chl[RECEIVE_STD_CHL + i].id0, 0);
-		bfin_write16(&reg->chl[RECEIVE_STD_CHL + i].id1, AME);
-		bfin_write16(&reg->chl[RECEIVE_STD_CHL + i].dlc, 0);
-		bfin_write16(&reg->msk[RECEIVE_STD_CHL + i].amh, 0x1FFF);
-		bfin_write16(&reg->msk[RECEIVE_STD_CHL + i].aml, 0xFFFF);
+		bfin_write(&reg->chl[RECEIVE_STD_CHL + i].id0, 0);
+		bfin_write(&reg->chl[RECEIVE_STD_CHL + i].id1, AME);
+		bfin_write(&reg->chl[RECEIVE_STD_CHL + i].dlc, 0);
+		bfin_write(&reg->msk[RECEIVE_STD_CHL + i].amh, 0x1FFF);
+		bfin_write(&reg->msk[RECEIVE_STD_CHL + i].aml, 0xFFFF);
 	}
 
 	/* RECEIVE_EXT_CHL */
 	for (i = 0; i < 2; i++) {
-		bfin_write16(&reg->chl[RECEIVE_EXT_CHL + i].id0, 0);
-		bfin_write16(&reg->chl[RECEIVE_EXT_CHL + i].id1, AME | IDE);
-		bfin_write16(&reg->chl[RECEIVE_EXT_CHL + i].dlc, 0);
-		bfin_write16(&reg->msk[RECEIVE_EXT_CHL + i].amh, 0x1FFF);
-		bfin_write16(&reg->msk[RECEIVE_EXT_CHL + i].aml, 0xFFFF);
+		bfin_write(&reg->chl[RECEIVE_EXT_CHL + i].id0, 0);
+		bfin_write(&reg->chl[RECEIVE_EXT_CHL + i].id1, AME | IDE);
+		bfin_write(&reg->chl[RECEIVE_EXT_CHL + i].dlc, 0);
+		bfin_write(&reg->msk[RECEIVE_EXT_CHL + i].amh, 0x1FFF);
+		bfin_write(&reg->msk[RECEIVE_EXT_CHL + i].aml, 0xFFFF);
 	}
 
-	bfin_write16(&reg->mc2, BIT(TRANSMIT_CHL - 16));
-	bfin_write16(&reg->mc1, BIT(RECEIVE_STD_CHL) + BIT(RECEIVE_EXT_CHL));
+	bfin_write(&reg->mc2, BIT(TRANSMIT_CHL - 16));
+	bfin_write(&reg->mc1, BIT(RECEIVE_STD_CHL) + BIT(RECEIVE_EXT_CHL));
 	SSYNC();
 
 	priv->can.state = CAN_STATE_STOPPED;
@@ -160,9 +160,9 @@ static void bfin_can_set_normal_mode(struct net_device *dev)
 	/*
 	 * leave configuration mode
 	 */
-	bfin_write16(&reg->control, bfin_read16(&reg->control) & ~CCR);
+	bfin_write(&reg->control, bfin_read(&reg->control) & ~CCR);
 
-	while (bfin_read16(&reg->status) & CCA) {
+	while (bfin_read(&reg->status) & CCA) {
 		udelay(10);
 		if (--timeout == 0) {
 			dev_err(dev->dev.parent,
@@ -174,25 +174,25 @@ static void bfin_can_set_normal_mode(struct net_device *dev)
 	/*
 	 * clear _All_  tx and rx interrupts
 	 */
-	bfin_write16(&reg->mbtif1, 0xFFFF);
-	bfin_write16(&reg->mbtif2, 0xFFFF);
-	bfin_write16(&reg->mbrif1, 0xFFFF);
-	bfin_write16(&reg->mbrif2, 0xFFFF);
+	bfin_write(&reg->mbtif1, 0xFFFF);
+	bfin_write(&reg->mbtif2, 0xFFFF);
+	bfin_write(&reg->mbrif1, 0xFFFF);
+	bfin_write(&reg->mbrif2, 0xFFFF);
 
 	/*
 	 * clear global interrupt status register
 	 */
-	bfin_write16(&reg->gis, 0x7FF); /* overwrites with '1' */
+	bfin_write(&reg->gis, 0x7FF); /* overwrites with '1' */
 
 	/*
 	 * Initialize Interrupts
 	 * - set bits in the mailbox interrupt mask register
 	 * - global interrupt mask
 	 */
-	bfin_write16(&reg->mbim1, BIT(RECEIVE_STD_CHL) + BIT(RECEIVE_EXT_CHL));
-	bfin_write16(&reg->mbim2, BIT(TRANSMIT_CHL - 16));
+	bfin_write(&reg->mbim1, BIT(RECEIVE_STD_CHL) + BIT(RECEIVE_EXT_CHL));
+	bfin_write(&reg->mbim2, BIT(TRANSMIT_CHL - 16));
 
-	bfin_write16(&reg->gim, EPIM | BOIM | RMLIM);
+	bfin_write(&reg->gim, EPIM | BOIM | RMLIM);
 	SSYNC();
 }
 
@@ -242,28 +242,28 @@ static int bfin_can_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
 	/* fill id */
 	if (id & CAN_EFF_FLAG) {
-		bfin_write16(&reg->chl[TRANSMIT_CHL].id0, id);
+		bfin_write(&reg->chl[TRANSMIT_CHL].id0, id);
 		val = ((id & 0x1FFF0000) >> 16) | IDE;
 	} else
 		val = (id << 2);
 	if (id & CAN_RTR_FLAG)
 		val |= RTR;
-	bfin_write16(&reg->chl[TRANSMIT_CHL].id1, val | AME);
+	bfin_write(&reg->chl[TRANSMIT_CHL].id1, val | AME);
 
 	/* fill payload */
 	for (i = 0; i < 8; i += 2) {
 		val = ((7 - i) < dlc ? (data[7 - i]) : 0) +
 			((6 - i) < dlc ? (data[6 - i] << 8) : 0);
-		bfin_write16(&reg->chl[TRANSMIT_CHL].data[i], val);
+		bfin_write(&reg->chl[TRANSMIT_CHL].data[i], val);
 	}
 
 	/* fill data length code */
-	bfin_write16(&reg->chl[TRANSMIT_CHL].dlc, dlc);
+	bfin_write(&reg->chl[TRANSMIT_CHL].dlc, dlc);
 
 	can_put_echo_skb(skb, dev, 0);
 
 	/* set transmit request */
-	bfin_write16(&reg->trs2, BIT(TRANSMIT_CHL - 16));
+	bfin_write(&reg->trs2, BIT(TRANSMIT_CHL - 16));
 
 	return 0;
 }
@@ -286,26 +286,26 @@ static void bfin_can_rx(struct net_device *dev, u16 isrc)
 	/* get id */
 	if (isrc & BIT(RECEIVE_EXT_CHL)) {
 		/* extended frame format (EFF) */
-		cf->can_id = ((bfin_read16(&reg->chl[RECEIVE_EXT_CHL].id1)
+		cf->can_id = ((bfin_read(&reg->chl[RECEIVE_EXT_CHL].id1)
 			     & 0x1FFF) << 16)
-			     + bfin_read16(&reg->chl[RECEIVE_EXT_CHL].id0);
+			     + bfin_read(&reg->chl[RECEIVE_EXT_CHL].id0);
 		cf->can_id |= CAN_EFF_FLAG;
 		obj = RECEIVE_EXT_CHL;
 	} else {
 		/* standard frame format (SFF) */
-		cf->can_id = (bfin_read16(&reg->chl[RECEIVE_STD_CHL].id1)
+		cf->can_id = (bfin_read(&reg->chl[RECEIVE_STD_CHL].id1)
 			     & 0x1ffc) >> 2;
 		obj = RECEIVE_STD_CHL;
 	}
-	if (bfin_read16(&reg->chl[obj].id1) & RTR)
+	if (bfin_read(&reg->chl[obj].id1) & RTR)
 		cf->can_id |= CAN_RTR_FLAG;
 
 	/* get data length code */
-	cf->can_dlc = get_can_dlc(bfin_read16(&reg->chl[obj].dlc) & 0xF);
+	cf->can_dlc = get_can_dlc(bfin_read(&reg->chl[obj].dlc) & 0xF);
 
 	/* get payload */
 	for (i = 0; i < 8; i += 2) {
-		val = bfin_read16(&reg->chl[obj].data[i]);
+		val = bfin_read(&reg->chl[obj].data[i]);
 		cf->data[7 - i] = (7 - i) < cf->can_dlc ? val : 0;
 		cf->data[6 - i] = (6 - i) < cf->can_dlc ? (val >> 8) : 0;
 	}
@@ -359,7 +359,7 @@ static int bfin_can_err(struct net_device *dev, u16 isrc, u16 status)
 
 	if (state != priv->can.state && (state == CAN_STATE_ERROR_WARNING ||
 				state == CAN_STATE_ERROR_PASSIVE)) {
-		u16 cec = bfin_read16(&reg->cec);
+		u16 cec = bfin_read(&reg->cec);
 		u8 rxerr = cec;
 		u8 txerr = cec >> 8;
 
@@ -410,23 +410,23 @@ irqreturn_t bfin_can_interrupt(int irq, void *dev_id)
 	struct net_device_stats *stats = &dev->stats;
 	u16 status, isrc;
 
-	if ((irq == priv->tx_irq) && bfin_read16(&reg->mbtif2)) {
+	if ((irq == priv->tx_irq) && bfin_read(&reg->mbtif2)) {
 		/* transmission complete interrupt */
-		bfin_write16(&reg->mbtif2, 0xFFFF);
+		bfin_write(&reg->mbtif2, 0xFFFF);
 		stats->tx_packets++;
-		stats->tx_bytes += bfin_read16(&reg->chl[TRANSMIT_CHL].dlc);
+		stats->tx_bytes += bfin_read(&reg->chl[TRANSMIT_CHL].dlc);
 		can_get_echo_skb(dev, 0);
 		netif_wake_queue(dev);
-	} else if ((irq == priv->rx_irq) && bfin_read16(&reg->mbrif1)) {
+	} else if ((irq == priv->rx_irq) && bfin_read(&reg->mbrif1)) {
 		/* receive interrupt */
-		isrc = bfin_read16(&reg->mbrif1);
-		bfin_write16(&reg->mbrif1, 0xFFFF);
+		isrc = bfin_read(&reg->mbrif1);
+		bfin_write(&reg->mbrif1, 0xFFFF);
 		bfin_can_rx(dev, isrc);
-	} else if ((irq == priv->err_irq) && bfin_read16(&reg->gis)) {
+	} else if ((irq == priv->err_irq) && bfin_read(&reg->gis)) {
 		/* error interrupt */
-		isrc = bfin_read16(&reg->gis);
-		status = bfin_read16(&reg->esr);
-		bfin_write16(&reg->gis, 0x7FF);
+		isrc = bfin_read(&reg->gis);
+		status = bfin_read(&reg->esr);
+		bfin_write(&reg->gis, 0x7FF);
 		bfin_can_err(dev, isrc, status);
 	} else {
 		return IRQ_NONE;
@@ -631,9 +631,9 @@ static int bfin_can_suspend(struct platform_device *pdev, pm_message_t mesg)
 
 	if (netif_running(dev)) {
 		/* enter sleep mode */
-		bfin_write16(&reg->control, bfin_read16(&reg->control) | SMR);
+		bfin_write(&reg->control, bfin_read(&reg->control) | SMR);
 		SSYNC();
-		while (!(bfin_read16(&reg->intr) & SMACK)) {
+		while (!(bfin_read(&reg->intr) & SMACK)) {
 			udelay(10);
 			if (--timeout == 0) {
 				dev_err(dev->dev.parent,
@@ -654,7 +654,7 @@ static int bfin_can_resume(struct platform_device *pdev)
 
 	if (netif_running(dev)) {
 		/* leave sleep mode */
-		bfin_write16(&reg->intr, 0);
+		bfin_write(&reg->intr, 0);
 		SSYNC();
 	}
 
-- 
1.7.5.3


^ permalink raw reply related

* Re: linux-next: Tree for June 23 (net/can & i/o)
From: Mike Frysinger @ 2011-06-23 20:38 UTC (permalink / raw)
  To: netdev, socketcan-core; +Cc: linux-next, LKML

On Thu, Jun 23, 2011 at 01:54, Stephen Rothwell <sfr@canb.auug.org.au> wrote:
> My fixes tree includes (as an experiment) the early part of
> mmotm-2011-06-22-13-05.
>
> The powerpc allyesconfig (and probably others) is still broken because we
> now build the staging drivers and because of a commit in the net tree.
> The breakage in Linus' tree is fixed by one of Andrew's patches above.
>
> The m68knommu tree lost its conflicts.
>
> The galak tree lost its conflicts.
>
> The net tree gained 2 build failures that I have left (see above).

not sure where this is coming from, but some Blackfin boards now fail with:

drivers/net/can/bfin_can.c: In function 'bfin_can_start_xmit':
drivers/net/can/bfin_can.c:247: error: implicit declaration of function 'writew'
make[3]: *** [drivers/net/can/bfin_can.o] Error 1

at any rate, the usage of writew() in this driver is wrong, so i sent
a patch to fix it.  but since nothing in this file nor in my Blackfin
tree changed, i wonder if whatever common code changed is going to
break other stuff ...
-mike

^ permalink raw reply

* Re: [RFT PATCH 7/9] ethtool: prepare for larger netdev_features_t type
From: Mahesh Bandewar @ 2011-06-23 20:38 UTC (permalink / raw)
  To: Ben Hutchings; +Cc: Michał Mirosław, netdev, David S. Miller
In-Reply-To: <1308855335.2712.15.camel@bwh-desktop>

On Thu, Jun 23, 2011 at 11:55 AM, Ben Hutchings
<bhutchings@solarflare.com> wrote:
> On Thu, 2011-06-23 at 11:21 -0700, Mahesh Bandewar wrote:
>> On Thu, Jun 23, 2011 at 11:03 AM, Ben Hutchings
>> <bhutchings@solarflare.com> wrote:
>> > On Thu, 2011-06-23 at 10:50 -0700, Mahesh Bandewar wrote:
>> >> On Mon, Jun 20, 2011 at 2:16 PM, Ben Hutchings
>> >> <bhutchings@solarflare.com> wrote:
>> >> >
>> >> > On Mon, 2011-06-20 at 21:14 +0200, Michał Mirosław wrote:
>> >> > [...]
>> >> > > @@ -125,19 +131,26 @@ static int ethtool_set_features(struct net_device *dev, void __user *useraddr)
>> >> > >       if (copy_from_user(features, useraddr, sizeof(features)))
>> >> > >               return -EFAULT;
>> >> > >
>> >> > > -     if (features[0].valid & ~NETIF_F_ETHTOOL_BITS)
>> >> > > +     /* I wonder if the compiler will be smart enough to loop-unroll
>> >> > > +      * and optimize this... (no worries if not) --mq */
>> >> > > +     for (i = ETHTOOL_DEV_FEATURE_WORDS; i-- > 0; ) {
>> >> > > +             valid = (valid << 32)|features[i].valid;
>> >> > > +             wanted = (wanted << 32)|features[i].requested;
>> >> > > +     }
>> >> > [...]
>> >> >
>> >> > I don't know (or care) about optimisation of this, but I would expect
>> >> > gcc to complain about shifting a 32-bit value by 32 bits.  I suggest you
>> >> > write this as:
>> >> >
>> >> >        for (i = 0; i < ETHTOOL_DEV_FEATURE_WORDS; ++i) {
>> >> >                valid |= (netdev_features_t)features[i].valid << 32 *i;
>> >> >                wanted |= (netdev_features_t)features[i].requested << 32 *i;
>> >>
>> >> It's a valid point but this type of typecast or similar usage would
>> >> imply that netdev_feature_t is an int of XXX bits. That's not opaque
>> >> and would hinder the way you can abstract the feature type.
>> >
>> > Yes, ethtool_{get,set}_features() will have to be changed if and when
>> > the representation of netdev_features_t is changed significantly.  I
>> > don't think there's any way of avoiding that and I don't think it really
>> > matters.
>> >
>> Well, if you have a conversion routine that converts (whatever the)
>> netdev_type_t type is to the ethtool representation (array of u32 for
>> example). So the changes would have to be done in that conversion
>> routine only and not get/set_features() ethtool methods as such.
>
> These are precisely those conversion routines, because there is no other
> place that needs to deal with the ethtool representation...
>
Oh, I was considering get/set_features ethtool methods as APIs  to
manipulate certain bits from user-space into kernel space. I was
disassociating features bit representation as a separate aspect and
(of course) the conversion. So depending on the type selection you may
or may not need these conversion routines.

--mahesh..

> Ben.
>
> --
> Ben Hutchings, Senior Software Engineer, Solarflare
> Not speaking for my employer; that's the marketing department's job.
> They asked us to note that Solarflare product names are trademarked.
>
>

^ permalink raw reply

* Re: unintended ipv4 broadcast policy change
From: David Miller @ 2011-06-23 20:45 UTC (permalink / raw)
  To: shemminger; +Cc: herbert, netdev
In-Reply-To: <20110623081614.213a432f@nehalam.ftrdhcpuser.net>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Thu, 23 Jun 2011 08:16:14 -0700

> On Wed, 22 Jun 2011 16:39:35 -0700 (PDT)
> David Miller <davem@davemloft.net> wrote:
> 
>> But debian definitely still has this bug.  On debian, as a result,
>> every packet received gets parsed.
> 
> Are you saying the DHCP client ends up parsing every packet?
> This doesn't appear to be true.
> 
> I checked and the dhclient spends its life waiting on select for DHCP port.

Which dhcp client do you have installed?  There are about 6 or 7 of
them available in debian.

Unless it closes the AF_PACKET socket after it gets a lease, it's
going to get every packet.  Because it uses a type argument of
"SOCK_PACKET" to the socket() call, the AF_PACKET layer will not use
the packet filter it installs during receive processing.

Check the source if you don't believe me, maybe whatever repo you're
using has different code in this area.

^ permalink raw reply

* Re: [PATCH] net/usb: kalmia: Various fixes for better support of non-x86 architectures.
From: Marius Kotsbak @ 2011-06-23 20:56 UTC (permalink / raw)
  To: Sergei Shtylyov; +Cc: davem, netdev, linux-usb, Marius B. Kotsbak
In-Reply-To: <4E03198A.2060600@ru.mvista.com>

Den 23. juni 2011 12:46, skrev Sergei Shtylyov:
> Hello.
>
> On 22-06-2011 19:26, Marius B. Kotsbak wrote:
>
>> -Support for big endian.
>> -Do not use USB buffers at the stack.
>> -Safer/more efficient code for local constants.
>
>> Signed-off-by: Marius B. Kotsbak<marius@kotsbak.com>
>> ---
>>   drivers/net/usb/kalmia.c |   40 
>> ++++++++++++++++++++++++----------------
>>   1 files changed, 24 insertions(+), 16 deletions(-)
>
>
>> -    char receive_buf[28];
>> +    const static int buflen = 28;
>
>    Why declare it at all, when it's used only once?
>
>> +    char *usb_buf;
>>       int status;
>>
>> -    status = kalmia_send_init_packet(dev, init_msg_1, 
>> sizeof(init_msg_1)
>> -        / sizeof(init_msg_1[0]), receive_buf, 24);
>> +    usb_buf = kmalloc(buflen, GFP_DMA | GFP_KERNEL);
>> +    if (!usb_buf)
>> +        return -ENOMEM;
>> +
>> +    memcpy(usb_buf, init_msg_1, 12);
>
>    s/12/sizeof(init_msg_1)/
>
>> +    status = kalmia_send_init_packet(dev, usb_buf, sizeof(init_msg_1)
>> +        / sizeof(init_msg_1[0]), usb_buf, 24);
>
>    There's ARRAY_SIZE() macro to replace:
>
> sizeof(init_msg_1) / sizeof(init_msg_1[0])
>
>    and why not use just sizeof(init_msg_1)?
>
>>       if (status != 0)
>>           return status;
>>
>> -    status = kalmia_send_init_packet(dev, init_msg_2, 
>> sizeof(init_msg_2)
>> -        / sizeof(init_msg_2[0]), receive_buf, 28);
>> +    memcpy(usb_buf, init_msg_2, 12);
>
>    s/12/sizeof(init_msg_2)/
>
>> +    status = kalmia_send_init_packet(dev, usb_buf, sizeof(init_msg_2)
>> +        / sizeof(init_msg_2[0]), usb_buf, 28);
>
>    The same comment here about:
>
> sizeof(init_msg_2) / sizeof(init_msg_2[0])
>

Thanks for the tips. I know some parts of the code are a bit ugly, but 
the primary goal was to get it working despite the quirky state of the 
current modem firmware. I have noted it for later fixing.

--
Marius


^ permalink raw reply

* Re: unintended ipv4 broadcast policy change
From: Stephen Hemminger @ 2011-06-23 21:01 UTC (permalink / raw)
  To: David Miller; +Cc: herbert, netdev
In-Reply-To: <20110623.134504.1261579649197526589.davem@davemloft.net>

On Thu, 23 Jun 2011 13:45:04 -0700 (PDT)
David Miller <davem@davemloft.net> wrote:

> From: Stephen Hemminger <shemminger@vyatta.com>
> Date: Thu, 23 Jun 2011 08:16:14 -0700
> 
> > On Wed, 22 Jun 2011 16:39:35 -0700 (PDT)
> > David Miller <davem@davemloft.net> wrote:
> > 
> >> But debian definitely still has this bug.  On debian, as a result,
> >> every packet received gets parsed.
> > 
> > Are you saying the DHCP client ends up parsing every packet?
> > This doesn't appear to be true.
> > 
> > I checked and the dhclient spends its life waiting on select for DHCP port.
> 
> Which dhcp client do you have installed?  There are about 6 or 7 of
> them available in debian.
> 
> Unless it closes the AF_PACKET socket after it gets a lease, it's
> going to get every packet.  Because it uses a type argument of
> "SOCK_PACKET" to the socket() call, the AF_PACKET layer will not use
> the packet filter it installs during receive processing.
> 
> Check the source if you don't believe me, maybe whatever repo you're
> using has different code in this area.

Standard Debian stable (Squeeze) installation.
$ dpkg -S /sbin/dhclient
isc-dhcp-client: /sbin/dhclient

$ dpkg -l isc-dhcp-client
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name           Version        Description
+++-==============-==============-============================================
ii  isc-dhcp-clien 4.1.1-P1-15+sq ISC DHCP client

If it did get every packet, I would see client wake up with strace and
doing work, that is not what it shows...

Maybe there is something else blocking it.

# lsof -p $(pgrep dhclient)
COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF    NODE NAME
dhclient 1785 root  cwd    DIR                8,1     4096       2 /
dhclient 1785 root  rtd    DIR                8,1     4096       2 /
dhclient 1785 root  txt    REG                8,1   487696 3407973 /sbin/dhclient
dhclient 1785 root  mem    REG                8,1    47616  917512 /lib/libnss_files-2.11.2.so
dhclient 1785 root  mem    REG                8,1  1432968  917515 /lib/libc-2.11.2.so
dhclient 1785 root  mem    REG                8,1   128744  917527 /lib/ld-2.11.2.so
dhclient 1785 root    0u   CHR                1,3      0t0    2150 /dev/null
dhclient 1785 root    1u   CHR                1,3      0t0    2150 /dev/null
dhclient 1785 root    2u   CHR                1,3      0t0    2150 /dev/null
dhclient 1785 root    3u  unix 0xffff880129b4cf00      0t0    5308 socket
dhclient 1785 root    4r   REG                8,1     1569  536722 /var/lib/dhcp/dhclient-de7b6036-9282-4cec-83ea-ef32117a0c0d-eth0.lease
dhclient 1785 root    5w  pack               6212      0t0     ALL type=SOCK_PACKET
dhclient 1785 root    6u  IPv4               6214      0t0     UDP *:bootpc

^ permalink raw reply

* Re: unintended ipv4 broadcast policy change
From: David Miller @ 2011-06-23 21:08 UTC (permalink / raw)
  To: shemminger; +Cc: herbert, netdev
In-Reply-To: <20110623170137.69054c83@s6510.ftrdhcpuser.net>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Thu, 23 Jun 2011 17:01:37 -0400

> Standard Debian stable (Squeeze) installation.
> $ dpkg -S /sbin/dhclient
> isc-dhcp-client: /sbin/dhclient

I bet what happens is that since it isn't reading from
the AF_PACKET socket the receive queue just fills up
and it's just in the kernel dropping packets in
packet_spkt_rcv().

^ permalink raw reply

* Re: [PATCH] bridge: Forward EAPOL when STP off
From: Nick Carter @ 2011-06-23 21:30 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: netdev, benjamin.poirier, davem, shemminger
In-Reply-To: <20110604224209.5c784729@s6510.ftrdhcpuser.net>

Stephen,

It doesn't look like ebtables can do this
http://www.spinics.net/lists/netfilter/msg51200.html

I've written some new diffs that I will send out to netdev.

Thanks,
Nick

On 4 June 2011 14:42, Stephen Hemminger <shemminger@vyatta.com> wrote:
> On Thu, 2 Jun 2011 16:59:13 +0100
> Nick Carter <ncarter100@gmail.com> wrote:
>
>> Signed-off-by: Nick Carter <ncarter100@gmail.com>
>>
>> If STP is disabled then forward frames destined to the 802.1X PAE group
>> address (01-80-C2-00-00-03)
>>
>> This change is required to support virtual machines running an 802.1X
>> supplicant and bridged to an ethernet interface.
>>
>> This change has been tested and works fine with a range of supplicants.
>
> No. This is getting messy and starts down the path of the recent
> 802.3ad change which just got reverted. A better solution is needed
> than individual hacky standards breaking. If you really need to do
> this, use the "duct tape" of networking ebtables.
>
> See also:
> https://lists.linux-foundation.org/pipermail/bridge/2007-November/005638.html
>

^ permalink raw reply

* [PATCH] bridge: Forward EAPOL Kconfig option BRIDGE_PAE_FORWARD
From: Nick Carter @ 2011-06-23 21:39 UTC (permalink / raw)
  To: netdev; +Cc: shemminger, davem

Signed-off-by: Nick Carter <ncarter100@gmail.com>

This Kconfig option is used to enable a bridge to forward 802.1x
(EAPOL) Port Access Entity (PAE) frames.  One use of this would be to
enable 802.1x authentication between a PAE supplicant running inside a
virtual machine, with the EAPOL frames bridged out to an external PAE
authenticator.

If BRIDGE_PAE_FORWARD is not set the behaviour of bridge.ko is unchanged.

If BRIDGE_PAE_FORWARD is set then by default the only new behaviour is
that unicast EAPOL frames attempting to traverse the bridge will be
dropped.  This makes the bridge standards compliant by preventing
crosstalk (IEEE Std 802.1X-2001 C.3.3).

Writing a 1 to the new sysfs attribute ../bridge/pae_forward will
enable the forwarding of EAPOL frames, both unicast and link local
multicast (01-80-C2-00-00-03).

diff --git a/net/bridge/Kconfig b/net/bridge/Kconfig
index 6dee7bf..c47a49e 100644
--- a/net/bridge/Kconfig
+++ b/net/bridge/Kconfig
@@ -46,3 +46,22 @@ config BRIDGE_IGMP_SNOOPING
 	  Say N to exclude this support and reduce the binary size.

 	  If unsure, say Y.
+
+config BRIDGE_PAE_FORWARD
+	bool "PAE Forwarding"
+	depends on BRIDGE
+	default n
+	---help---
+	  If you say Y here, then the Ethernet bridge will be able to forward
+	  802.1x (EAPOL) Port Access Entity (PAE) frames.  One use of this would
+	  be to enable 802.1x authentication between a PAE supplicant running
+	  inside a virtual machine, with the EAPOL frames bridged out to an
+	  external PAE authenticator.
+
+	  On a running kernel with this support, enable PAE forwarding by
+	  writing a '1' to the bridge devices pae_forward attribute.
+	  e.g. echo 1 > /sys/devices/virtual/net/br73/bridge/pae_forward
+
+	  Say N to exclude this support.
+
+	  If unsure, say N.
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index d9d1e2b..b493474 100644
--- a/net/bridge/br_if.c
+++ b/net/bridge/br_if.c
@@ -214,6 +214,9 @@ static struct net_device *new_bridge_dev(struct
net *net, const char *name)
 	br->topology_change = 0;
 	br->topology_change_detected = 0;
 	br->ageing_time = 300 * HZ;
+#ifdef CONFIG_BRIDGE_PAE_FORWARD
+	br->pae_forward = BR_PAE_DEFAULT;
+#endif

 	br_netfilter_rtable_init(br);

diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 90e985b..183c40f 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -43,6 +43,24 @@ static int br_pass_frame_up(struct sk_buff *skb)
 		       netif_receive_skb);
 }

+static inline bool br_pae_forward(struct net_bridge *br, __be16 proto)
+{
+#ifdef CONFIG_BRIDGE_PAE_FORWARD
+	return br->pae_forward == BR_PAE_FORWARD && proto == htons(ETH_P_PAE);
+#else
+	return false;
+#endif
+}
+
+static inline bool br_pae_drop(struct net_bridge *br, __be16 proto)
+{
+#ifdef CONFIG_BRIDGE_PAE_FORWARD
+	return br->pae_forward == BR_PAE_DEFAULT && proto == htons(ETH_P_PAE);
+#else
+	return false;
+#endif
+}
+
 /* note: already called with rcu_read_lock */
 int br_handle_frame_finish(struct sk_buff *skb)
 {
@@ -98,6 +116,10 @@ int br_handle_frame_finish(struct sk_buff *skb)
 	}

 	if (skb) {
+		/* Prevent Crosstalk (IEEE Std 802.1X-2001 C.3.3) */
+		if (unlikely(br_pae_drop(br, skb->protocol)))
+			goto drop;
+
 		if (dst)
 			br_forward(dst->dst, skb, skb2);
 		else
@@ -166,6 +188,10 @@ struct sk_buff *br_handle_frame(struct sk_buff *skb)
 		if (p->br->stp_enabled == BR_NO_STP && dest[5] == 0)
 			goto forward;

+		/* Check if PAE frame should be forwarded */
+		if (br_pae_forward(p->br, skb->protocol))
+			goto forward;
+
 		if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,
 			    NULL, br_handle_local_finish))
 			return NULL;	/* frame consumed by filter */
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 4e1b620..a523032 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -244,6 +244,13 @@ struct net_bridge
 	struct timer_list		multicast_query_timer;
 #endif

+#ifdef CONFIG_BRIDGE_PAE_FORWARD	
+	enum {
+		BR_PAE_DEFAULT,		/* 802.1x frames consumed by bridge */
+		BR_PAE_FORWARD,		/* 802.1x frames forwarded by bridge */
+	} pae_forward;
+#endif
+
 	struct timer_list		hello_timer;
 	struct timer_list		tcn_timer;
 	struct timer_list		topology_change_timer;
diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
index 5c1e555..c5ffd97 100644
--- a/net/bridge/br_sysfs_br.c
+++ b/net/bridge/br_sysfs_br.c
@@ -679,6 +679,33 @@ static DEVICE_ATTR(nf_call_arptables, S_IRUGO | S_IWUSR,
 		   show_nf_call_arptables, store_nf_call_arptables);
 #endif

+#ifdef CONFIG_BRIDGE_PAE_FORWARD
+static ssize_t show_pae_forward(struct device *d, struct
device_attribute *attr,
+				char *buf)
+{
+	struct net_bridge *br = to_bridge(d);
+	return sprintf(buf, "%d\n", br->pae_forward);
+}
+
+static int set_pae_forward(struct net_bridge *br, unsigned long val)
+{
+	if (val > BR_PAE_FORWARD)
+		return -EINVAL;
+
+	br->pae_forward = val;
+	return 0;
+}
+
+static ssize_t store_pae_forward(struct device *d,
+				 struct device_attribute *attr, const char *buf,
+				 size_t len)
+{
+	return store_bridge_parm(d, buf, len, set_pae_forward);
+}
+static DEVICE_ATTR(pae_forward, S_IRUGO | S_IWUSR, show_pae_forward,
+		   store_pae_forward);
+#endif
+
 static struct attribute *bridge_attrs[] = {
 	&dev_attr_forward_delay.attr,
 	&dev_attr_hello_time.attr,
@@ -717,6 +744,9 @@ static struct attribute *bridge_attrs[] = {
 	&dev_attr_nf_call_ip6tables.attr,
 	&dev_attr_nf_call_arptables.attr,
 #endif
+#ifdef CONFIG_BRIDGE_PAE_FORWARD
+	&dev_attr_pae_forward.attr,
+#endif
 	NULL
 };

^ permalink raw reply related

* [PATCH 13/37] Remove unneeded version.h includes from drivers/net/
From: Jesper Juhl @ 2011-06-23 22:21 UTC (permalink / raw)
  To: LKML
  Cc: trivial, linux-wireless, linux-usb, socketcan-core, netdev,
	Sathya Perla, Subbu Seetharaman, Ajit Khaparde, Rasesh Mody,
	Debashis Dutt, Sjur Braendeland, Wolfgang Grandegger,
	Casey Leedom, Dmitry Kozlov, Solarflare linux maintainers,
	Steve Hodgson, Ben Hutchings, Oliver Neukum, Greg Kroah-Hartman,
	Larry Finger, Chaoming Li, David S. Miller
In-Reply-To: <alpine.LNX.2.00.1106232344480.17688@swampdragon.chaosbits.net>

It was pointed out by 'make versioncheck' that some includes of
linux/version.h are not needed in drivers/net/.
This patch removes them.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
 drivers/net/atl1c/atl1c.h              |    1 -
 drivers/net/atl1e/atl1e.h              |    1 -
 drivers/net/benet/be.h                 |    1 -
 drivers/net/bna/cna.h                  |    1 -
 drivers/net/caif/caif_serial.c         |    1 -
 drivers/net/caif/caif_shm_u5500.c      |    1 -
 drivers/net/caif/caif_spi.c            |    1 -
 drivers/net/caif/caif_spi_slave.c      |    1 -
 drivers/net/can/c_can/c_can.c          |    1 -
 drivers/net/can/c_can/c_can_platform.c |    1 -
 drivers/net/can/softing/softing_main.c |    1 -
 drivers/net/cxgb4vf/cxgb4vf_main.c     |    1 -
 drivers/net/cxgb4vf/t4vf_hw.c          |    1 -
 drivers/net/davinci_emac.c             |    1 -
 drivers/net/pptp.c                     |    1 -
 drivers/net/sfc/net_driver.h           |    1 -
 drivers/net/usb/cdc_ncm.c              |    1 -
 drivers/net/wireless/rtlwifi/wifi.h    |    1 -
 18 files changed, 0 insertions(+), 18 deletions(-)

diff --git a/drivers/net/atl1c/atl1c.h b/drivers/net/atl1c/atl1c.h
index 925929d..695398c 100644
--- a/drivers/net/atl1c/atl1c.h
+++ b/drivers/net/atl1c/atl1c.h
@@ -22,7 +22,6 @@
 #ifndef _ATL1C_H_
 #define _ATL1C_H_
 
-#include <linux/version.h>
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/errno.h>
diff --git a/drivers/net/atl1e/atl1e.h b/drivers/net/atl1e/atl1e.h
index 490d3b3..3861949 100644
--- a/drivers/net/atl1e/atl1e.h
+++ b/drivers/net/atl1e/atl1e.h
@@ -23,7 +23,6 @@
 #ifndef _ATL1E_H_
 #define _ATL1E_H_
 
-#include <linux/version.h>
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/errno.h>
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index a7db870..66ae5b5 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -20,7 +20,6 @@
 
 #include <linux/pci.h>
 #include <linux/etherdevice.h>
-#include <linux/version.h>
 #include <linux/delay.h>
 #include <net/tcp.h>
 #include <net/ip.h>
diff --git a/drivers/net/bna/cna.h b/drivers/net/bna/cna.h
index bbd39dc..8ee9e38 100644
--- a/drivers/net/bna/cna.h
+++ b/drivers/net/bna/cna.h
@@ -19,7 +19,6 @@
 #ifndef __CNA_H__
 #define __CNA_H__
 
-#include <linux/version.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/pci.h>
diff --git a/drivers/net/caif/caif_serial.c b/drivers/net/caif/caif_serial.c
index 3df0c0f..175e134 100644
--- a/drivers/net/caif/caif_serial.c
+++ b/drivers/net/caif/caif_serial.c
@@ -5,7 +5,6 @@
  */
 
 #include <linux/init.h>
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/device.h>
 #include <linux/types.h>
diff --git a/drivers/net/caif/caif_shm_u5500.c b/drivers/net/caif/caif_shm_u5500.c
index 5f771ab..89d76b7 100644
--- a/drivers/net/caif/caif_shm_u5500.c
+++ b/drivers/net/caif/caif_shm_u5500.c
@@ -7,7 +7,6 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ":" fmt
 
-#include <linux/version.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
diff --git a/drivers/net/caif/caif_spi.c b/drivers/net/caif/caif_spi.c
index 57e6393..0f8defc 100644
--- a/drivers/net/caif/caif_spi.c
+++ b/drivers/net/caif/caif_spi.c
@@ -5,7 +5,6 @@
  * License terms: GNU General Public License (GPL) version 2.
  */
 
-#include <linux/version.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/device.h>
diff --git a/drivers/net/caif/caif_spi_slave.c b/drivers/net/caif/caif_spi_slave.c
index b009e03..e139e13 100644
--- a/drivers/net/caif/caif_spi_slave.c
+++ b/drivers/net/caif/caif_spi_slave.c
@@ -4,7 +4,6 @@
  * Author:  Daniel Martensson / Daniel.Martensson@stericsson.com
  * License terms: GNU General Public License (GPL) version 2.
  */
-#include <linux/version.h>
 #include <linux/init.h>
 #include <linux/module.h>
 #include <linux/device.h>
diff --git a/drivers/net/can/c_can/c_can.c b/drivers/net/can/c_can/c_can.c
index 7e5cc0b..80adc83 100644
--- a/drivers/net/can/c_can/c_can.c
+++ b/drivers/net/can/c_can/c_can.c
@@ -26,7 +26,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
diff --git a/drivers/net/can/c_can/c_can_platform.c b/drivers/net/can/c_can/c_can_platform.c
index cc90824..0e300cf 100644
--- a/drivers/net/can/c_can/c_can_platform.c
+++ b/drivers/net/can/c_can/c_can_platform.c
@@ -20,7 +20,6 @@
  */
 
 #include <linux/kernel.h>
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
 #include <linux/delay.h>
diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c
index 60a49e5..849e4a0 100644
--- a/drivers/net/can/softing/softing_main.c
+++ b/drivers/net/can/softing/softing_main.c
@@ -17,7 +17,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  */
 
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
diff --git a/drivers/net/cxgb4vf/cxgb4vf_main.c b/drivers/net/cxgb4vf/cxgb4vf_main.c
index e71c08e..8a6f891 100644
--- a/drivers/net/cxgb4vf/cxgb4vf_main.c
+++ b/drivers/net/cxgb4vf/cxgb4vf_main.c
@@ -33,7 +33,6 @@
  * SOFTWARE.
  */
 
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/init.h>
diff --git a/drivers/net/cxgb4vf/t4vf_hw.c b/drivers/net/cxgb4vf/t4vf_hw.c
index 192db22..fe3fd3d 100644
--- a/drivers/net/cxgb4vf/t4vf_hw.c
+++ b/drivers/net/cxgb4vf/t4vf_hw.c
@@ -33,7 +33,6 @@
  * SOFTWARE.
  */
 
-#include <linux/version.h>
 #include <linux/pci.h>
 
 #include "t4vf_common.h"
diff --git a/drivers/net/davinci_emac.c b/drivers/net/davinci_emac.c
index dcc4a17..a8adf0c 100644
--- a/drivers/net/davinci_emac.c
+++ b/drivers/net/davinci_emac.c
@@ -48,7 +48,6 @@
 #include <linux/highmem.h>
 #include <linux/proc_fs.h>
 #include <linux/ctype.h>
-#include <linux/version.h>
 #include <linux/spinlock.h>
 #include <linux/dma-mapping.h>
 #include <linux/clk.h>
diff --git a/drivers/net/pptp.c b/drivers/net/pptp.c
index 1286fe2..eae542a 100644
--- a/drivers/net/pptp.c
+++ b/drivers/net/pptp.c
@@ -30,7 +30,6 @@
 #include <linux/ip.h>
 #include <linux/netfilter.h>
 #include <linux/netfilter_ipv4.h>
-#include <linux/version.h>
 #include <linux/rcupdate.h>
 #include <linux/spinlock.h>
 
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h
index e8d5f03..1affbf4 100644
--- a/drivers/net/sfc/net_driver.h
+++ b/drivers/net/sfc/net_driver.h
@@ -17,7 +17,6 @@
 #define DEBUG
 #endif
 
-#include <linux/version.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/ethtool.h>
diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c
index f33ca6a..fd622a6 100644
--- a/drivers/net/usb/cdc_ncm.c
+++ b/drivers/net/usb/cdc_ncm.c
@@ -47,7 +47,6 @@
 #include <linux/mii.h>
 #include <linux/crc32.h>
 #include <linux/usb.h>
-#include <linux/version.h>
 #include <linux/timer.h>
 #include <linux/spinlock.h>
 #include <linux/atomic.h>
diff --git a/drivers/net/wireless/rtlwifi/wifi.h b/drivers/net/wireless/rtlwifi/wifi.h
index 693395e..dd85110 100644
--- a/drivers/net/wireless/rtlwifi/wifi.h
+++ b/drivers/net/wireless/rtlwifi/wifi.h
@@ -32,7 +32,6 @@
 
 #include <linux/sched.h>
 #include <linux/firmware.h>
-#include <linux/version.h>
 #include <linux/etherdevice.h>
 #include <linux/vmalloc.h>
 #include <linux/usb.h>
-- 
1.7.5.2


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

^ permalink raw reply related

* Re: [PATCH] bridge: Forward EAPOL Kconfig option BRIDGE_PAE_FORWARD
From: Stephen Hemminger @ 2011-06-23 22:29 UTC (permalink / raw)
  To: Nick Carter; +Cc: netdev, davem
In-Reply-To: <BANLkTim2G7_pnv5W10Q7kHHCnc2v126fZw@mail.gmail.com>

On Thu, 23 Jun 2011 22:39:52 +0100
Nick Carter <ncarter100@gmail.com> wrote:

> Signed-off-by: Nick Carter <ncarter100@gmail.com>
> 
> This Kconfig option is used to enable a bridge to forward 802.1x
> (EAPOL) Port Access Entity (PAE) frames.  One use of this would be to
> enable 802.1x authentication between a PAE supplicant running inside a
> virtual machine, with the EAPOL frames bridged out to an external PAE
> authenticator.
> 
> If BRIDGE_PAE_FORWARD is not set the behaviour of bridge.ko is unchanged.
> 
> If BRIDGE_PAE_FORWARD is set then by default the only new behaviour is
> that unicast EAPOL frames attempting to traverse the bridge will be
> dropped.  This makes the bridge standards compliant by preventing
> crosstalk (IEEE Std 802.1X-2001 C.3.3).
> 
> Writing a 1 to the new sysfs attribute ../bridge/pae_forward will
> enable the forwarding of EAPOL frames, both unicast and link local
> multicast (01-80-C2-00-00-03).
> 
> diff --git a/net/bridge/Kconfig b/net/bridge/Kconfig
> index 6dee7bf..c47a49e 100644
> --- a/net/bridge/Kconfig
> +++ b/net/bridge/Kconfig
> @@ -46,3 +46,22 @@ config BRIDGE_IGMP_SNOOPING
>  	  Say N to exclude this support and reduce the binary size.
> 
>  	  If unsure, say Y.
> +
> +config BRIDGE_PAE_FORWARD
> +	bool "PAE Forwarding"
> +	depends on BRIDGE
> +	default n
> +	---help---
> +	  If you say Y here, then the Ethernet bridge will be able to forward
> +	  802.1x (EAPOL) Port Access Entity (PAE) frames.  One use of this would
> +	  be to enable 802.1x authentication between a PAE supplicant running
> +	  inside a virtual machine, with the EAPOL frames bridged out to an
> +	  external PAE authenticator.
> +
> +	  On a running kernel with this support, enable PAE forwarding by
> +	  writing a '1' to the bridge devices pae_forward attribute.
> +	  e.g. echo 1 > /sys/devices/virtual/net/br73/bridge/pae_forward
> +
> +	  Say N to exclude this support.
> +
> +	  If unsure, say N.
> diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
> index d9d1e2b..b493474 100644
> --- a/net/bridge/br_if.c
> +++ b/net/bridge/br_if.c
> @@ -214,6 +214,9 @@ static struct net_device *new_bridge_dev(struct
> net *net, const char *name)
>  	br->topology_change = 0;
>  	br->topology_change_detected = 0;
>  	br->ageing_time = 300 * HZ;
> +#ifdef CONFIG_BRIDGE_PAE_FORWARD
> +	br->pae_forward = BR_PAE_DEFAULT;
> +#endif
> 
>  	br_netfilter_rtable_init(br);
> 
> diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
> index 90e985b..183c40f 100644
> --- a/net/bridge/br_input.c
> +++ b/net/bridge/br_input.c
> @@ -43,6 +43,24 @@ static int br_pass_frame_up(struct sk_buff *skb)
>  		       netif_receive_skb);
>  }
> 
> +static inline bool br_pae_forward(struct net_bridge *br, __be16 proto)
> +{
> +#ifdef CONFIG_BRIDGE_PAE_FORWARD
> +	return br->pae_forward == BR_PAE_FORWARD && proto == htons(ETH_P_PAE);
> +#else
> +	return false;
> +#endif
> +}
> +
> +static inline bool br_pae_drop(struct net_bridge *br, __be16 proto)
> +{
> +#ifdef CONFIG_BRIDGE_PAE_FORWARD
> +	return br->pae_forward == BR_PAE_DEFAULT && proto == htons(ETH_P_PAE);
> +#else
> +	return false;
> +#endif
> +}
> +
>  /* note: already called with rcu_read_lock */
>  int br_handle_frame_finish(struct sk_buff *skb)
>  {
> @@ -98,6 +116,10 @@ int br_handle_frame_finish(struct sk_buff *skb)
>  	}
> 
>  	if (skb) {
> +		/* Prevent Crosstalk (IEEE Std 802.1X-2001 C.3.3) */
> +		if (unlikely(br_pae_drop(br, skb->protocol)))
> +			goto drop;
> +
>  		if (dst)
>  			br_forward(dst->dst, skb, skb2);
>  		else
> @@ -166,6 +188,10 @@ struct sk_buff *br_handle_frame(struct sk_buff *skb)
>  		if (p->br->stp_enabled == BR_NO_STP && dest[5] == 0)
>  			goto forward;
> 
> +		/* Check if PAE frame should be forwarded */
> +		if (br_pae_forward(p->br, skb->protocol))
> +			goto forward;
> +
>  		if (NF_HOOK(NFPROTO_BRIDGE, NF_BR_LOCAL_IN, skb, skb->dev,
>  			    NULL, br_handle_local_finish))
>  			return NULL;	/* frame consumed by filter */
> diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
> index 4e1b620..a523032 100644
> --- a/net/bridge/br_private.h
> +++ b/net/bridge/br_private.h
> @@ -244,6 +244,13 @@ struct net_bridge
>  	struct timer_list		multicast_query_timer;
>  #endif
> 
> +#ifdef CONFIG_BRIDGE_PAE_FORWARD	
> +	enum {
> +		BR_PAE_DEFAULT,		/* 802.1x frames consumed by bridge */
> +		BR_PAE_FORWARD,		/* 802.1x frames forwarded by bridge */
> +	} pae_forward;
> +#endif
> +
>  	struct timer_list		hello_timer;
>  	struct timer_list		tcn_timer;
>  	struct timer_list		topology_change_timer;
> diff --git a/net/bridge/br_sysfs_br.c b/net/bridge/br_sysfs_br.c
> index 5c1e555..c5ffd97 100644
> --- a/net/bridge/br_sysfs_br.c
> +++ b/net/bridge/br_sysfs_br.c
> @@ -679,6 +679,33 @@ static DEVICE_ATTR(nf_call_arptables, S_IRUGO | S_IWUSR,
>  		   show_nf_call_arptables, store_nf_call_arptables);
>  #endif
> 
> +#ifdef CONFIG_BRIDGE_PAE_FORWARD
> +static ssize_t show_pae_forward(struct device *d, struct
> device_attribute *attr,
> +				char *buf)
> +{
> +	struct net_bridge *br = to_bridge(d);
> +	return sprintf(buf, "%d\n", br->pae_forward);
> +}
> +
> +static int set_pae_forward(struct net_bridge *br, unsigned long val)
> +{
> +	if (val > BR_PAE_FORWARD)
> +		return -EINVAL;
> +
> +	br->pae_forward = val;
> +	return 0;
> +}
> +
> +static ssize_t store_pae_forward(struct device *d,
> +				 struct device_attribute *attr, const char *buf,
> +				 size_t len)
> +{
> +	return store_bridge_parm(d, buf, len, set_pae_forward);
> +}
> +static DEVICE_ATTR(pae_forward, S_IRUGO | S_IWUSR, show_pae_forward,
> +		   store_pae_forward);
> +#endif
> +
>  static struct attribute *bridge_attrs[] = {
>  	&dev_attr_forward_delay.attr,
>  	&dev_attr_hello_time.attr,
> @@ -717,6 +744,9 @@ static struct attribute *bridge_attrs[] = {
>  	&dev_attr_nf_call_ip6tables.attr,
>  	&dev_attr_nf_call_arptables.attr,
>  #endif
> +#ifdef CONFIG_BRIDGE_PAE_FORWARD
> +	&dev_attr_pae_forward.attr,
> +#endif
>  	NULL
>  };

Don't make it a config option, users and distros won't get it right.
The bridge already makes special case for multicast, why not add
some smarts and always do it.

^ permalink raw reply

* [PATCH 1/2] rt2x00: Fix unspeficied typo
From: Joe Perches @ 2011-06-23 22:35 UTC (permalink / raw)
  To: Ivo van Doorn, Gertjan van Wingerde, Helmut Schaa
  Cc: John W. Linville, linux-wireless, users, netdev, linux-kernel

Signed-off-by: Joe Perches <joe@perches.com>
---
 drivers/net/wireless/rt2x00/rt2x00queue.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/net/wireless/rt2x00/rt2x00queue.h b/drivers/net/wireless/rt2x00/rt2x00queue.h
index 167d458..5900474 100644
--- a/drivers/net/wireless/rt2x00/rt2x00queue.h
+++ b/drivers/net/wireless/rt2x00/rt2x00queue.h
@@ -54,7 +54,7 @@
  * @QID_RX: RX queue
  * @QID_OTHER: None of the above (don't use, only present for completeness)
  * @QID_BEACON: Beacon queue (value unspecified, don't send it to device)
- * @QID_ATIM: Atim queue (value unspeficied, don't send it to device)
+ * @QID_ATIM: Atim queue (value unspecified, don't send it to device)
  */
 enum data_queue_qid {
 	QID_AC_VO = 0,
-- 
1.7.6.rc1

^ permalink raw reply related

* [PATCH] vmxnet3: Convert to new vlan model.
From: Jesse Gross @ 2011-06-23 23:04 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Shreyas Bhatewara, VMware PV-Drivers

This converts the vmxnet3 driver to use the new vlan model.  In doing so
it fixes missing tags in tcpdump and failure to do checksum offload when
tx vlan offload is disabled.

CC: Shreyas Bhatewara <sbhatewara@vmware.com>
CC: VMware PV-Drivers <pv-drivers@vmware.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
---
 drivers/net/vmxnet3/vmxnet3_drv.c     |  111 +++++++++------------------------
 drivers/net/vmxnet3/vmxnet3_ethtool.c |    9 +++-
 drivers/net/vmxnet3/vmxnet3_int.h     |    3 +-
 3 files changed, 40 insertions(+), 83 deletions(-)

diff --git a/drivers/net/vmxnet3/vmxnet3_drv.c b/drivers/net/vmxnet3/vmxnet3_drv.c
index 33097ec..c84b1dd 100644
--- a/drivers/net/vmxnet3/vmxnet3_drv.c
+++ b/drivers/net/vmxnet3/vmxnet3_drv.c
@@ -918,7 +918,7 @@ vmxnet3_tq_xmit(struct sk_buff *skb, struct vmxnet3_tx_queue *tq,
 	count = VMXNET3_TXD_NEEDED(skb_headlen(skb)) +
 		skb_shinfo(skb)->nr_frags + 1;
 
-	ctx.ipv4 = (skb->protocol == cpu_to_be16(ETH_P_IP));
+	ctx.ipv4 = (vlan_get_protocol(skb) == cpu_to_be16(ETH_P_IP));
 
 	ctx.mss = skb_shinfo(skb)->gso_size;
 	if (ctx.mss) {
@@ -1231,12 +1231,10 @@ vmxnet3_rq_rx_complete(struct vmxnet3_rx_queue *rq,
 					(union Vmxnet3_GenericDesc *)rcd);
 			skb->protocol = eth_type_trans(skb, adapter->netdev);
 
-			if (unlikely(adapter->vlan_grp && rcd->ts)) {
-				vlan_hwaccel_receive_skb(skb,
-						adapter->vlan_grp, rcd->tci);
-			} else {
-				netif_receive_skb(skb);
-			}
+			if (unlikely(rcd->ts))
+				__vlan_hwaccel_put_tag(skb, rcd->tci);
+
+			netif_receive_skb(skb);
 
 			ctx->skb = NULL;
 		}
@@ -1856,79 +1854,18 @@ vmxnet3_free_irqs(struct vmxnet3_adapter *adapter)
 	}
 }
 
-static void
-vmxnet3_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
-{
-	struct vmxnet3_adapter *adapter = netdev_priv(netdev);
-	struct Vmxnet3_DriverShared *shared = adapter->shared;
-	u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable;
-	unsigned long flags;
-
-	if (grp) {
-		/* add vlan rx stripping. */
-		if (adapter->netdev->features & NETIF_F_HW_VLAN_RX) {
-			int i;
-			adapter->vlan_grp = grp;
-
-			/*
-			 *  Clear entire vfTable; then enable untagged pkts.
-			 *  Note: setting one entry in vfTable to non-zero turns
-			 *  on VLAN rx filtering.
-			 */
-			for (i = 0; i < VMXNET3_VFT_SIZE; i++)
-				vfTable[i] = 0;
-
-			VMXNET3_SET_VFTABLE_ENTRY(vfTable, 0);
-			spin_lock_irqsave(&adapter->cmd_lock, flags);
-			VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
-					       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
-			spin_unlock_irqrestore(&adapter->cmd_lock, flags);
-		} else {
-			printk(KERN_ERR "%s: vlan_rx_register when device has "
-			       "no NETIF_F_HW_VLAN_RX\n", netdev->name);
-		}
-	} else {
-		/* remove vlan rx stripping. */
-		struct Vmxnet3_DSDevRead *devRead = &shared->devRead;
-		adapter->vlan_grp = NULL;
-
-		if (devRead->misc.uptFeatures & UPT1_F_RXVLAN) {
-			int i;
-
-			for (i = 0; i < VMXNET3_VFT_SIZE; i++) {
-				/* clear entire vfTable; this also disables
-				 * VLAN rx filtering
-				 */
-				vfTable[i] = 0;
-			}
-			spin_lock_irqsave(&adapter->cmd_lock, flags);
-			VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
-					       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
-			spin_unlock_irqrestore(&adapter->cmd_lock, flags);
-		}
-	}
-}
-
 
 static void
 vmxnet3_restore_vlan(struct vmxnet3_adapter *adapter)
 {
-	if (adapter->vlan_grp) {
-		u16 vid;
-		u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable;
-		bool activeVlan = false;
+	u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable;
+	u16 vid;
 
-		for (vid = 0; vid < VLAN_N_VID; vid++) {
-			if (vlan_group_get_device(adapter->vlan_grp, vid)) {
-				VMXNET3_SET_VFTABLE_ENTRY(vfTable, vid);
-				activeVlan = true;
-			}
-		}
-		if (activeVlan) {
-			/* continue to allow untagged pkts */
-			VMXNET3_SET_VFTABLE_ENTRY(vfTable, 0);
-		}
-	}
+	/* allow untagged pkts */
+	VMXNET3_SET_VFTABLE_ENTRY(vfTable, 0);
+
+	for_each_set_bit(vid, adapter->active_vlans, VLAN_N_VID)
+		VMXNET3_SET_VFTABLE_ENTRY(vfTable, vid);
 }
 
 
@@ -1944,6 +1881,8 @@ vmxnet3_vlan_rx_add_vid(struct net_device *netdev, u16 vid)
 	VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
 			       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
 	spin_unlock_irqrestore(&adapter->cmd_lock, flags);
+
+	set_bit(vid, adapter->active_vlans);
 }
 
 
@@ -1959,6 +1898,8 @@ vmxnet3_vlan_rx_kill_vid(struct net_device *netdev, u16 vid)
 	VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
 			       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
 	spin_unlock_irqrestore(&adapter->cmd_lock, flags);
+
+	clear_bit(vid, adapter->active_vlans);
 }
 
 
@@ -1995,8 +1936,14 @@ vmxnet3_set_mc(struct net_device *netdev)
 	u8 *new_table = NULL;
 	u32 new_mode = VMXNET3_RXM_UCAST;
 
-	if (netdev->flags & IFF_PROMISC)
+	if (netdev->flags & IFF_PROMISC) {
+		u32 *vfTable = adapter->shared->devRead.rxFilterConf.vfTable;
+		memset(vfTable, 0, VMXNET3_VFT_SIZE * sizeof(*vfTable));
+
 		new_mode |= VMXNET3_RXM_PROMISC;
+	} else {
+		vmxnet3_restore_vlan(adapter);
+	}
 
 	if (netdev->flags & IFF_BROADCAST)
 		new_mode |= VMXNET3_RXM_BCAST;
@@ -2030,6 +1977,8 @@ vmxnet3_set_mc(struct net_device *netdev)
 		rxConf->rxMode = cpu_to_le32(new_mode);
 		VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
 				       VMXNET3_CMD_UPDATE_RX_MODE);
+		VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
+				       VMXNET3_CMD_UPDATE_VLAN_FILTERS);
 	}
 
 	VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
@@ -2639,12 +2588,13 @@ vmxnet3_declare_features(struct vmxnet3_adapter *adapter, bool dma64)
 
 	netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
 		NETIF_F_HW_CSUM | NETIF_F_HW_VLAN_TX |
-		NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_LRO;
+		NETIF_F_HW_VLAN_RX | NETIF_F_TSO | NETIF_F_TSO6 |
+		NETIF_F_LRO;
 	if (dma64)
 		netdev->features |= NETIF_F_HIGHDMA;
-	netdev->vlan_features = netdev->hw_features & ~NETIF_F_HW_VLAN_TX;
-	netdev->features = netdev->hw_features |
-		NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_FILTER;
+	netdev->vlan_features = netdev->hw_features &
+				~(NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
+	netdev->features = netdev->hw_features | NETIF_F_HW_VLAN_FILTER;
 
 	netdev_info(adapter->netdev,
 		"features: sg csum vlan jf tso tsoIPv6 lro%s\n",
@@ -2865,7 +2815,6 @@ vmxnet3_probe_device(struct pci_dev *pdev,
 		.ndo_get_stats64 = vmxnet3_get_stats64,
 		.ndo_tx_timeout = vmxnet3_tx_timeout,
 		.ndo_set_multicast_list = vmxnet3_set_mc,
-		.ndo_vlan_rx_register = vmxnet3_vlan_rx_register,
 		.ndo_vlan_rx_add_vid = vmxnet3_vlan_rx_add_vid,
 		.ndo_vlan_rx_kill_vid = vmxnet3_vlan_rx_kill_vid,
 #ifdef CONFIG_NET_POLL_CONTROLLER
diff --git a/drivers/net/vmxnet3/vmxnet3_ethtool.c b/drivers/net/vmxnet3/vmxnet3_ethtool.c
index bba7c15..27400ed 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethtool.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethtool.c
@@ -268,7 +268,7 @@ int vmxnet3_set_features(struct net_device *netdev, u32 features)
 	unsigned long flags;
 	u32 changed = features ^ netdev->features;
 
-	if (changed & (NETIF_F_RXCSUM|NETIF_F_LRO)) {
+	if (changed & (NETIF_F_RXCSUM | NETIF_F_LRO | NETIF_F_HW_VLAN_RX)) {
 		if (features & NETIF_F_RXCSUM)
 			adapter->shared->devRead.misc.uptFeatures |=
 			UPT1_F_RXCSUM;
@@ -284,6 +284,13 @@ int vmxnet3_set_features(struct net_device *netdev, u32 features)
 			adapter->shared->devRead.misc.uptFeatures &=
 							~UPT1_F_LRO;
 
+		if (features & NETIF_F_HW_VLAN_RX)
+			adapter->shared->devRead.misc.uptFeatures |=
+			UPT1_F_RXVLAN;
+		else
+			adapter->shared->devRead.misc.uptFeatures &=
+			~UPT1_F_RXVLAN;
+
 		spin_lock_irqsave(&adapter->cmd_lock, flags);
 		VMXNET3_WRITE_BAR1_REG(adapter, VMXNET3_REG_CMD,
 				       VMXNET3_CMD_UPDATE_FEATURE);
diff --git a/drivers/net/vmxnet3/vmxnet3_int.h b/drivers/net/vmxnet3/vmxnet3_int.h
index 0e567c24..2e37985 100644
--- a/drivers/net/vmxnet3/vmxnet3_int.h
+++ b/drivers/net/vmxnet3/vmxnet3_int.h
@@ -27,6 +27,7 @@
 #ifndef _VMXNET3_INT_H
 #define _VMXNET3_INT_H
 
+#include <linux/bitops.h>
 #include <linux/ethtool.h>
 #include <linux/delay.h>
 #include <linux/netdevice.h>
@@ -315,7 +316,7 @@ struct vmxnet3_intr {
 struct vmxnet3_adapter {
 	struct vmxnet3_tx_queue		tx_queue[VMXNET3_DEVICE_MAX_TX_QUEUES];
 	struct vmxnet3_rx_queue		rx_queue[VMXNET3_DEVICE_MAX_RX_QUEUES];
-	struct vlan_group		*vlan_grp;
+	unsigned long			active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
 	struct vmxnet3_intr		intr;
 	spinlock_t			cmd_lock;
 	struct Vmxnet3_DriverShared	*shared;
-- 
1.7.4.1


^ permalink raw reply related

* Re: [PATCH 1/3] serial/imx: add device tree support
From: Grant Likely @ 2011-06-23 23:11 UTC (permalink / raw)
  To: Shawn Guo
  Cc: patches, netdev, devicetree-discuss, Jason Liu, linux-kernel,
	Jeremy Kerr, Sascha Hauer, linux-arm-kernel, David Gibson
In-Reply-To: <20110623183821.GA19188@S2100-06.ap.freescale.net>

On Thu, Jun 23, 2011 at 12:38 PM, Shawn Guo <shawn.guo@freescale.com> wrote:
> On Tue, Jun 21, 2011 at 01:13:50PM -0600, Grant Likely wrote:
> [...]
>> >
>> >  /**
>> > + *     of_get_device_index - Get device index by looking up "aliases" node
>> > + *     @np:    Pointer to device node that asks for device index
>> > + *     @name:  The device alias without index number
>> > + *
>> > + *     Returns the device index if find it, else returns -ENODEV.
>> > + */
>> > +int of_get_device_index(struct device_node *np, const char *alias)
>> > +{
>> > +       struct device_node *aliases = of_find_node_by_name(NULL, "aliases");
>> > +       struct property *prop;
>> > +       char name[32];
>> > +       int index = 0;
>> > +
>> > +       if (!aliases)
>> > +               return -ENODEV;
>> > +
>> > +       while (1) {
>> > +               snprintf(name, sizeof(name), "%s%d", alias, index);
>> > +               prop = of_find_property(aliases, name, NULL);
>> > +               if (!prop)
>> > +                       return -ENODEV;
>> > +               if (np == of_find_node_by_path(prop->value))
>> > +                       break;
>> > +               index++;
>> > +       }
>>
>> Rather than parsing the alias strings everytime, it would probably be
>> better to preprocess all the properties in the aliases node and create
>> a lookup table of alias->node references that can be walked quickly
>> and trivially.
>>
>> Also, when obtaining an enumeration for a device, you'll need to be
>> careful about what number gets returned.  If the node doesn't match a
>> given alias, but aliases do exist for other devices of like type, then
>> you need to be careful not to assign a number already assigned to
>> another device via an alias (this of course assumes the driver
>> supports dynamics enumeration, which many drivers will).  It would be
>>
>
> Grant, please take a look at the second shot below.  Please let me
> know what you think.

Hey Shawn, good progress.  Comments below.

Also, once you've got this sorted out, you'll need to break the
drivers/of/ bits out into a separate patch so I can apply it
separately.

g.

>
> diff --git a/arch/arm/boot/dts/imx51-babbage.dts b/arch/arm/boot/dts/imx51-babbage.dts
> index 7976932..f4a5c3c 100644
> --- a/arch/arm/boot/dts/imx51-babbage.dts
> +++ b/arch/arm/boot/dts/imx51-babbage.dts
> @@ -18,6 +18,12 @@
>        compatible = "fsl,imx51-babbage", "fsl,imx51";
>        interrupt-parent = <&tzic>;
>
> +       aliases {
> +               serial0 = &uart0;
> +               serial1 = &uart1;
> +               serial2 = &uart2;
> +       };
> +
>        chosen {
>                bootargs = "console=ttymxc0,115200 root=/dev/mmcblk0p3 rootwait";
>        };
> @@ -47,29 +53,29 @@
>                        reg = <0x70000000 0x40000>;
>                        ranges;
>
> -                       uart@7000c000 {
> -                               compatible = "fsl,imx51-uart", "fsl,imx-uart";
> +                       uart2: uart@7000c000 {
> +                               compatible = "fsl,imx51-uart", "fsl,imx21-uart";
>                                reg = <0x7000c000 0x4000>;
>                                interrupts = <33>;
>                                id = <3>;
>                                fsl,has-rts-cts;
>                        };
>                };
>
> -               uart@73fbc000 {
> -                       compatible = "fsl,imx51-uart", "fsl,imx-uart";
> +               uart0: uart@73fbc000 {
> +                       compatible = "fsl,imx51-uart", "fsl,imx21-uart";
>                        reg = <0x73fbc000 0x4000>;
>                        interrupts = <31>;
>                        id = <1>;
>                        fsl,has-rts-cts;
>                };
>
> -               uart@73fc0000 {
> -                       compatible = "fsl,imx51-uart", "fsl,imx-uart";
> +               uart1: uart@73fc0000 {
> +                       compatible = "fsl,imx51-uart", "fsl,imx21-uart";
>                        reg = <0x73fc0000 0x4000>;
>                        interrupts = <32>;
>                        id = <2>;
>                        fsl,has-rts-cts;
>                };
>        };
>
> diff --git a/arch/arm/mach-mx5/imx51-dt.c b/arch/arm/mach-mx5/imx51-dt.c
> index 8bfdb91..e6c7298 100644
> --- a/arch/arm/mach-mx5/imx51-dt.c
> +++ b/arch/arm/mach-mx5/imx51-dt.c
> @@ -40,6 +40,8 @@ static const struct of_device_id tzic_of_match[] __initconst = {
>
>  static void __init imx51_dt_init(void)
>  {
> +       of_scan_aliases();
> +

Instead of calling this from board code.  You can add the call
directly to the bottom of unflatten_device_tree() in drivers/of/fdt.c

>        irq_domain_generate_simple(tzic_of_match, MX51_TZIC_BASE_ADDR, 0);
>
>        of_platform_populate(NULL, of_default_bus_match_table,
> diff --git a/drivers/of/base.c b/drivers/of/base.c
> index 632ebae..90349a2 100644
> --- a/drivers/of/base.c
> +++ b/drivers/of/base.c
> @@ -17,12 +17,27 @@
>  *      as published by the Free Software Foundation; either version
>  *      2 of the License, or (at your option) any later version.
>  */
> +#include <linux/ctype.h>
>  #include <linux/module.h>
>  #include <linux/of.h>
>  #include <linux/spinlock.h>
>  #include <linux/slab.h>
>  #include <linux/proc_fs.h>
>
> +struct alias_devname {
> +       char devname[32];
> +       struct list_head link;
> +       struct list_head head;
> +};
> +
> +struct alias_devid {
> +       int devid;
> +       struct device_node *node;
> +       struct list_head link;
> +};

Some LinuxDoc documentation on the meaning of these structures would
be helpful.  I'm not convinced that a two level lookup table is really
necessary.  A flat table containing alias, device_node pointer, and
possibly decoded devname and id is probably sufficient to get started.
 Also, I think it will still be useful to store a pointer to the
actual alias name in the alias_devid record.

> +
> +static LIST_HEAD(aliases_lookup);
> +
>  struct device_node *allnodes;
>  struct device_node *of_chosen;
>
> @@ -922,3 +937,170 @@ out_unlock:
>  }
>  #endif /* defined(CONFIG_OF_DYNAMIC) */
>
> +/*
> + * get_alias_dev_name_id - Get device name and id from alias name
> + *
> + * an: The alias name passed in
> + * dn: The pointer used to return device name

There is actually little point in decoding an alias to the device
name.  It is more useful to decode alias to the device_node pointer
which can be found with of_find_node_by_path().  I'd like to have a
lookup table generated which contains {const char *alias_name,
device_node *np} pairs.  It would also be useful for that table to
decode the 'id' from the end of the alias name when available.  Then,
given an alias stem and id (like imxuart and 2) the code could match
it to alias imxuart0 and look up the device_node associated with (I
could see this used by console setup code).  Alternately, driver probe
code could use its device_node pointer to lookup its alias, and if no
alias exists, then use the table to find an unused id (and possibly
even add an entry to the table when it allocates an id).

> + *
> + * Returns device id which should be the number at the end of alias
> + * name, otherwise returns -1.
> + */
> +static int get_alias_name_id(char *an, char *dn)

Even private static functions should have a prefix consistent with the
file.  In this case, all the functions should probably be something in
the form "of_alias_*()"

> +{
> +       int len = strlen(an);
> +       char *end = an + len;
> +
> +       while (isdigit(*--end))
> +               len--;

Clever!  :-)

> +
> +       end++;
> +       strncpy(dn, an, len);
> +       dn[len] = '\0';
> +
> +       return strlen(end) ? simple_strtol(end, NULL, 10) : -1;

Just to be pendantic: simple_strtoul()  :-)

> +}
> +
> +/*
> + * get_an_available_devid - Get an available devid for the given devname
> + *
> + * adn:        The pointer to the given alias_devname
> + *
> + * Returns the available devid
> + */
> +static int get_an_available_devid(struct alias_devname *adn)
> +{
> +       int devid = 0;
> +       struct alias_devid *adi;
> +
> +       while (1) {
> +               bool used = false;
> +               list_for_each_entry(adi, &adn->head, link) {
> +                       if (adi->devid == devid) {
> +                               used = true;
> +                               break;
> +                       }
> +               }
> +
> +               if (!used)
> +                       break;
> +
> +               devid++;
> +       }
> +
> +       return devid;
> +}
> +
> +/*
> + * of_scan_aliases - Scan all properties of aliases node and populate the
> + *                  global lookup table with the device name and id info
> + *
> + * Returns the number of aliases properties found, or error code in error case.
> + */

Use LinuxDoc format for documentation blocks.
Documentation/kernel-doc-nano-HOWTO.txt

> +int of_scan_aliases(void)
> +{
> +       struct device_node *aliases = of_find_node_by_name(NULL, "aliases");

Like the chosen node, it is useful to keep around a reference to the
aliases node.  There is other code that will use it that I hope to
merge soon.  You can add a global of_aliases pointer and initialized
it in unflatten_device_tree()

> +       struct property *pp;
> +       struct alias_devname *adn;
> +       struct alias_devid *adi;
> +       int ret = 0;
> +
> +       if (!aliases) {
> +               ret = -ENODEV;
> +               goto out;

The function hasn't done anything that needs unwinding yet. Just
return immediately.

> +       }
> +
> +       for (pp = aliases->properties; pp != NULL; pp = pp->next) {

A "for_each_property()" macro would be useful to have and use here.
Can you add one to include/linux/of.h?

> +               bool found = false;
> +               char devname[32];

Rather than a static sized string, I'd like this to be the actual size
of the string.  You can do this by making the name the last element of
the list and giving it a [0] length.  Then when memory is kzalloced
for it, the size of the devname can be added to the end:

struct alias_devname {
       struct list_head link;
       const char *alias;
       struct device_node *node;
       int alias_id;
       char alias_stem[0];
};

> +               int devid = get_alias_name_id(pp->name, devname);
> +
> +               /* We do not want to proceed this sentinel one */
> +               if (!strcmp(pp->name, "name") && !strcmp(pp->value, "aliases"))
> +                       break;

Skipping the 'name' property is good, but I don't think you need to
check the value.  You should also skip the "phandle" property.

> +
> +               /* See if the devname already exists */
> +               list_for_each_entry(adn, &aliases_lookup, link) {
> +                       if (!strcmp(adn->devname, devname)) {
> +                               found = true;
> +                               break;
> +                       }
> +               }
> +
> +               /*
> +                * Create the entry for this devname if not found,
> +                * and add it into aliases_lookup
> +                */
> +               if (!found) {
> +                       adn = kzalloc(sizeof(*adn), GFP_KERNEL);
> +                       if (!adn) {
> +                               ret = -ENOMEM;
> +                               goto out;
> +                       }
> +
> +                       strcpy(adn->devname, devname);
> +                       INIT_LIST_HEAD(&adn->head);
> +                       list_add_tail(&adn->link, &aliases_lookup);
> +               }
> +
> +               /*
> +                * Save the devid as one entry of the list for this
> +                * specified devname
> +                */
> +               adi = kzalloc(sizeof(*adi), GFP_KERNEL);
> +               if (!adi) {
> +                       ret = -ENOMEM;
> +                       goto out;
> +               }
> +
> +               adi->devid = (devid == -1) ? get_an_available_devid(adn) :
> +                                            devid;
> +               adi->node = of_find_node_by_path(pp->value);
> +
> +               list_add_tail(&adi->link, &adn->head);
> +               ret++;

Going to a single level lookup table will certainly simplify this function.

> +       }
> +
> +out:
> +       return ret;
> +}
> +
> +/**
> + *     of_get_device_id - Get device id by looking up "aliases" node
> + *     @np:    Pointer to device node that asks for device id
> + *     @name:  The device alias name
> + *
> + *     Returns the device id if find it, else returns -ENODEV.
> + */
> +int of_get_device_id(struct device_node *np, const char *name)
> +{
> +       struct alias_devname *adn;
> +       struct alias_devid *adi;
> +       bool found = false;
> +       int ret;
> +
> +       list_for_each_entry(adn, &aliases_lookup, link) {
> +               if (!strcmp(adn->devname, name)) {
> +                       found = true;
> +                       break;
> +               }
> +       }
> +
> +       if (!found) {
> +               ret = -ENODEV;
> +               goto out;
> +       }
> +
> +       found = false;
> +       list_for_each_entry(adi, &adn->head, link) {
> +               if (np == adi->node) {
> +                       found = true;
> +                       break;
> +               }
> +       }
> +
> +       ret = found ? adi->devid : -ENODEV;
> +out:
> +       return ret;
> +}
> +EXPORT_SYMBOL(of_get_device_id);
> diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c
> index 2769353..062639e 100644
> --- a/drivers/tty/serial/imx.c
> +++ b/drivers/tty/serial/imx.c
> @@ -1225,43 +1265,33 @@ static int serial_imx_resume(struct platform_device *dev)
>        return 0;
>  }
>
>  static int serial_imx_probe_dt(struct imx_port *sport,
>                struct platform_device *pdev)
>  {
>        struct device_node *node = pdev->dev.of_node;
> -       const __be32 *line;
> +       int line;
>
>        if (!node)
>                return -ENODEV;
>
> -       line = of_get_property(node, "id", NULL);
> -       if (!line)
> +       line = of_get_device_id(node, "serial");
> +       if (IS_ERR_VALUE(line))

if (line < 0) is a sufficient test.  I don't much like the IS_ERR_VALUE() macro.

>                return -ENODEV;
>
> -       sport->port.line = be32_to_cpup(line) - 1;
> +       sport->port.line = line;
>
> diff --git a/include/linux/of.h b/include/linux/of.h
> index bfc0ed1..270c671 100644
> --- a/include/linux/of.h
> +++ b/include/linux/of.h
> @@ -213,6 +213,9 @@ extern int of_parse_phandles_with_args(struct device_node *np,
>        const char *list_name, const char *cells_name, int index,
>        struct device_node **out_node, const void **out_args);
>
> +extern int of_scan_aliases(void);
> +extern int of_get_device_id(struct device_node *np, const char *name);
> +
>  extern int of_machine_is_compatible(const char *compat);
>
>  extern int prom_add_property(struct device_node* np, struct property* prop);
>
> --
> Regards,
> Shawn
>
>



-- 
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

^ permalink raw reply

* [PATCH 0/2] Enable RXFCS as a feature.
From: greearb @ 2011-06-23 23:13 UTC (permalink / raw)
  To: netdev; +Cc: Ben Greear

From: Ben Greear <greearb@candelatech.com>

These patches are on top of the features work that
Michal Miroslaw posted recently.

A small patch to ethtool is needed as well.

These are just for comment until his patches go in.

Ben Greear (2):
  net:  Support RXFCS feature flag.
  e100:  Support RXFCS feature flag.

 drivers/net/e100.c              |   15 ++++++++++++---
 include/linux/ethtool.h         |    1 +
 include/linux/netdev_features.h |    2 ++
 net/core/ethtool.c              |   10 ++++++++--
 4 files changed, 23 insertions(+), 5 deletions(-)

-- 
1.7.3.4


^ permalink raw reply

* [PATCH 1/2] net:  Support RXFCS feature flag.
From: greearb @ 2011-06-23 23:13 UTC (permalink / raw)
  To: netdev; +Cc: Ben Greear
In-Reply-To: <1308870819-15938-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb@candelatech.com>

When set, this causes the Ethernet FCS to be appended
to the end of the skb.

Useful for sniffing packets.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 06a8318... afdc2da... M	include/linux/ethtool.h
:100644 100644 d0ab610... 55f359e... M	include/linux/netdev_features.h
:100644 100644 80b88fe... 4920c73... M	net/core/ethtool.c
 include/linux/ethtool.h         |    1 +
 include/linux/netdev_features.h |    2 ++
 net/core/ethtool.c              |   10 ++++++++--
 3 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index 06a8318..afdc2da 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -347,6 +347,7 @@ struct ethtool_perm_addr {
  * flag differs from the read-only value.
  */
 enum ethtool_flags {
+	ETH_FLAG_RXFCS		= (1 << 0),	/* Append FCS to skb */
 	ETH_FLAG_TXVLAN		= (1 << 7),	/* TX VLAN offload enabled */
 	ETH_FLAG_RXVLAN		= (1 << 8),	/* RX VLAN offload enabled */
 	ETH_FLAG_LRO		= (1 << 15),	/* LRO is enabled */
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index d0ab610..55f359e 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -54,6 +54,7 @@ enum {
 	NETIF_F_RXCSUM_BIT,		/* Receive checksumming offload */
 	NETIF_F_NOCACHE_COPY_BIT,	/* Use no-cache copyfromuser */
 	NETIF_F_LOOPBACK_BIT,		/* Enable loopback */
+	NETIF_F_RXFCS_BIT,		/* Append FCS to skb */
 
 	/*
 	 * Add your fresh new feature above and remember to update
@@ -98,6 +99,7 @@ enum {
 #define NETIF_F_RXCSUM		__NETIF_F(RXCSUM)
 #define NETIF_F_NOCACHE_COPY	__NETIF_F(NOCACHE_COPY)
 #define NETIF_F_LOOPBACK	__NETIF_F(LOOPBACK)
+#define NETIF_F_RXFCS		__NETIF_F(RXFCS)
 
 /* Features valid for ethtool to change */
 /* = all defined minus driver/device-class-related */
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index 80b88fe..4920c73 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -74,6 +74,7 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
 	[NETIF_F_RXCSUM_BIT] =           "rx-checksum",
 	[NETIF_F_NOCACHE_COPY_BIT] =     "tx-nocache-copy",
 	[NETIF_F_LOOPBACK_BIT] =         "loopback",
+	[NETIF_F_RXFCS_BIT] =            "rx-fcs",
 };
 
 static int ethtool_get_features(struct net_device *dev, void __user *useraddr)
@@ -249,9 +250,10 @@ static int ethtool_set_one_feature(struct net_device *dev,
 }
 
 #define ETH_ALL_FLAGS    (ETH_FLAG_LRO | ETH_FLAG_RXVLAN | ETH_FLAG_TXVLAN | \
-			  ETH_FLAG_NTUPLE | ETH_FLAG_RXHASH)
+			  ETH_FLAG_NTUPLE | ETH_FLAG_RXHASH | ETH_FLAG_RXFCS)
 #define ETH_ALL_FEATURES (NETIF_F_LRO | NETIF_F_HW_VLAN_RX | \
-			  NETIF_F_HW_VLAN_TX | NETIF_F_NTUPLE | NETIF_F_RXHASH)
+			  NETIF_F_HW_VLAN_TX | NETIF_F_NTUPLE | \
+			  NETIF_F_RXHASH | NETIF_F_RXFCS)
 
 static u32 __ethtool_get_flags(struct net_device *dev)
 {
@@ -262,6 +264,8 @@ static u32 __ethtool_get_flags(struct net_device *dev)
 	if (dev->features & NETIF_F_HW_VLAN_TX)	flags |= ETH_FLAG_TXVLAN;
 	if (dev->features & NETIF_F_NTUPLE)	flags |= ETH_FLAG_NTUPLE;
 	if (dev->features & NETIF_F_RXHASH)	flags |= ETH_FLAG_RXHASH;
+	if (dev->features & NETIF_F_RXFCS)
+		flags |= ETH_FLAG_RXFCS;
 
 	return flags;
 }
@@ -278,6 +282,8 @@ static int __ethtool_set_flags(struct net_device *dev, u32 data)
 	if (data & ETH_FLAG_TXVLAN)	features |= NETIF_F_HW_VLAN_TX;
 	if (data & ETH_FLAG_NTUPLE)	features |= NETIF_F_NTUPLE;
 	if (data & ETH_FLAG_RXHASH)	features |= NETIF_F_RXHASH;
+	if (data & ETH_FLAG_RXFCS)
+		features |= NETIF_F_RXFCS;
 
 	/* allow changing only bits set in hw_features */
 	changed = (features ^ dev->features) & ETH_ALL_FEATURES;
-- 
1.7.3.4


^ permalink raw reply related

* [PATCH 2/2] e100:  Support RXFCS feature flag.
From: greearb @ 2011-06-23 23:13 UTC (permalink / raw)
  To: netdev; +Cc: Ben Greear
In-Reply-To: <1308870819-15938-1-git-send-email-greearb@candelatech.com>

From: Ben Greear <greearb@candelatech.com>

This allows e100 to be configured to append the
Ethernet FCS to the skb.

Useful for sniffing networks.

Signed-off-by: Ben Greear <greearb@candelatech.com>
---
:100644 100644 c1352c6... 761f6f5... M	drivers/net/e100.c
 drivers/net/e100.c |   15 ++++++++++++---
 1 files changed, 12 insertions(+), 3 deletions(-)

diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index c1352c6..761f6f5 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1089,6 +1089,7 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
 {
 	struct config *config = &cb->u.config;
 	u8 *c = (u8 *)config;
+	struct net_device *netdev = nic->netdev;
 
 	cb->command = cpu_to_le16(cb_config);
 
@@ -1132,6 +1133,9 @@ static void e100_configure(struct nic *nic, struct cb *cb, struct sk_buff *skb)
 		config->promiscuous_mode = 0x1;		/* 1=on, 0=off */
 	}
 
+	if (netdev->wanted_features & NETIF_F_RXFCS)
+		config->rx_crc_transfer = 0x1;	/* 1=save, 0=discard */
+
 	if (nic->flags & multicast_all)
 		config->multicast_all = 0x1;		/* 1=accept, 0=no */
 
@@ -1919,6 +1923,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
 	struct sk_buff *skb = rx->skb;
 	struct rfd *rfd = (struct rfd *)skb->data;
 	u16 rfd_status, actual_size;
+	u16 fcs_pad = 0;
 
 	if (unlikely(work_done && *work_done >= work_to_do))
 		return -EAGAIN;
@@ -1951,9 +1956,11 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
 	}
 
 	/* Get actual data size */
+	if (dev->wanted_features & NETIF_F_RXFCS)
+		fcs_pad = 4;
 	actual_size = le16_to_cpu(rfd->actual_size) & 0x3FFF;
-	if (unlikely(actual_size > RFD_BUF_LEN - sizeof(struct rfd)))
-		actual_size = RFD_BUF_LEN - sizeof(struct rfd);
+	if (unlikely(actual_size > RFD_BUF_LEN + fcs_pad - sizeof(struct rfd)))
+		actual_size = RFD_BUF_LEN + fcs_pad - sizeof(struct rfd);
 
 	/* Get data */
 	pci_unmap_single(nic->pdev, rx->dma_addr,
@@ -1980,7 +1987,7 @@ static int e100_rx_indicate(struct nic *nic, struct rx *rx,
 	if (unlikely(!(rfd_status & cb_ok))) {
 		/* Don't indicate if hardware indicates errors */
 		dev_kfree_skb_any(skb);
-	} else if (actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN) {
+	} else if (actual_size > ETH_DATA_LEN + VLAN_ETH_HLEN + fcs_pad) {
 		/* Don't indicate oversized frames */
 		nic->rx_over_length_errors++;
 		dev_kfree_skb_any(skb);
@@ -2761,6 +2768,8 @@ static int __devinit e100_probe(struct pci_dev *pdev,
 		return -ENOMEM;
 	}
 
+	netdev->hw_features |= NETIF_F_RXFCS;
+
 	netdev->netdev_ops = &e100_netdev_ops;
 	SET_ETHTOOL_OPS(netdev, &e100_ethtool_ops);
 	netdev->watchdog_timeo = E100_WATCHDOG_PERIOD;
-- 
1.7.3.4


^ permalink raw reply related

* Re: [PATCH 1/2] net:  Support RXFCS feature flag.
From: Ben Hutchings @ 2011-06-23 23:22 UTC (permalink / raw)
  To: greearb; +Cc: netdev
In-Reply-To: <1308870819-15938-2-git-send-email-greearb@candelatech.com>

On Thu, 2011-06-23 at 16:13 -0700, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> When set, this causes the Ethernet FCS to be appended
> to the end of the skb.
> 
> Useful for sniffing packets.
[...]
> --- a/include/linux/ethtool.h
> +++ b/include/linux/ethtool.h
> @@ -347,6 +347,7 @@ struct ethtool_perm_addr {
>   * flag differs from the read-only value.
>   */
>  enum ethtool_flags {
> +	ETH_FLAG_RXFCS		= (1 << 0),	/* Append FCS to skb */
>  	ETH_FLAG_TXVLAN		= (1 << 7),	/* TX VLAN offload enabled */
>  	ETH_FLAG_RXVLAN		= (1 << 8),	/* RX VLAN offload enabled */
>  	ETH_FLAG_LRO		= (1 << 15),	/* LRO is enabled */
[...]

No, all new features should be accessed through the
ETHTOOL_{G,S}FEATURES commands only.

Ben.

-- 
Ben Hutchings, Senior Software Engineer, Solarflare
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.


^ permalink raw reply

* [PATCH] MAINTAINERS: mark socketcan-core lists as subscribers-only
From: Mike Frysinger @ 2011-06-24  0:25 UTC (permalink / raw)
  To: socketcan-core-0fE9KPoRgkgATYTw5x5z8w, Urs Thuermann,
	Oliver Hartkopp, netdev-u79uwXL29TY76Z2rM5mHXA, David S. Miller
  Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA

The socketcan-core lists require subscription, so mark them as such.

Signed-off-by: Mike Frysinger <vapier-aBrp7R+bbdUdnm+yROfE0A@public.gmane.org>
---
 MAINTAINERS |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index f0358cd..d3765e8 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1639,7 +1639,7 @@ CAN NETWORK LAYER
 M:	Oliver Hartkopp <socketcan-fJ+pQTUTwRTk1uMJSBkQmQ@public.gmane.org>
 M:	Oliver Hartkopp <oliver.hartkopp-l29pVbxQd1IUtdQbppsyvg@public.gmane.org>
 M:	Urs Thuermann <urs.thuermann-l29pVbxQd1IUtdQbppsyvg@public.gmane.org>
-L:	socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
+L:	socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org (subscribers-only)
 L:	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
 W:	http://developer.berlios.de/projects/socketcan/
 S:	Maintained
@@ -1651,7 +1651,7 @@ F:	include/linux/can/raw.h
 
 CAN NETWORK DRIVERS
 M:	Wolfgang Grandegger <wg-5Yr1BZd7O62+XT7JhA+gdA@public.gmane.org>
-L:	socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org
+L:	socketcan-core-0fE9KPoRgkgATYTw5x5z8w@public.gmane.org (subscribers-only)
 L:	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
 W:	http://developer.berlios.de/projects/socketcan/
 S:	Maintained
-- 
1.7.5.3

^ permalink raw reply related

* Re: [PATCH] MAINTAINERS: mark socketcan-core lists as subscribers-only
From: Jesper Juhl @ 2011-06-24  0:30 UTC (permalink / raw)
  To: Mike Frysinger
  Cc: socketcan-core, Urs Thuermann, Oliver Hartkopp, netdev,
	David S. Miller, Andrew Morton, linux-kernel
In-Reply-To: <1308875142-10429-1-git-send-email-vapier@gentoo.org>

On Thu, 23 Jun 2011, Mike Frysinger wrote:

> The socketcan-core lists require subscription, so mark them as such.
> 
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
>  MAINTAINERS |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/MAINTAINERS b/MAINTAINERS
> index f0358cd..d3765e8 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -1639,7 +1639,7 @@ CAN NETWORK LAYER
>  M:	Oliver Hartkopp <socketcan@hartkopp.net>
>  M:	Oliver Hartkopp <oliver.hartkopp@volkswagen.de>
>  M:	Urs Thuermann <urs.thuermann@volkswagen.de>
> -L:	socketcan-core@lists.berlios.de
> +L:	socketcan-core@lists.berlios.de (subscribers-only)
>  L:	netdev@vger.kernel.org
>  W:	http://developer.berlios.de/projects/socketcan/
>  S:	Maintained
> @@ -1651,7 +1651,7 @@ F:	include/linux/can/raw.h
>  
>  CAN NETWORK DRIVERS
>  M:	Wolfgang Grandegger <wg@grandegger.com>
> -L:	socketcan-core@lists.berlios.de
> +L:	socketcan-core@lists.berlios.de (subscribers-only)
>  L:	netdev@vger.kernel.org
>  W:	http://developer.berlios.de/projects/socketcan/
>  S:	Maintained
> 

I just ran into this "subscribers only" policy recently - yeah, it should 
at least be noted in MAINTAINERS.

Patch looks good to me.

Reviewed-by: Jesper Juhl <jj@chaosbits.net>

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


^ permalink raw reply

* Re: linux-next: Tree for June 23 (net/can & i/o)
From: Stephen Rothwell @ 2011-06-24  1:04 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: netdev, socketcan-core, linux-next, LKML
In-Reply-To: <BANLkTi=ZxHDvhCs8Qki2ZrhCbfY6Mjx5+w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 896 bytes --]

Hi Mike,

On Thu, 23 Jun 2011 16:38:56 -0400 Mike Frysinger <vapier.adi@gmail.com> wrote:
>
> not sure where this is coming from, but some Blackfin boards now fail with:
> 
> drivers/net/can/bfin_can.c: In function 'bfin_can_start_xmit':
> drivers/net/can/bfin_can.c:247: error: implicit declaration of function 'writew'
> make[3]: *** [drivers/net/can/bfin_can.o] Error 1

yeah, caused by the removal of the inclusion of mm.h from netdevice.h
(most probably).

> at any rate, the usage of writew() in this driver is wrong, so i sent
> a patch to fix it.  but since nothing in this file nor in my Blackfin
> tree changed, i wonder if whatever common code changed is going to
> break other stuff ...

It did indeed :-(

ah, well, I guess that is what I am here for :-)
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply

* [PATCH net-2.6] cxgb3: skb_record_rx_queue now records the queue index relative to the net_device.
From: John Hernandez @ 2011-06-24  0:39 UTC (permalink / raw)
  To: davem; +Cc: netdev, divy, jay

From: John (Jay) Hernandez <jay@chelsio.com>

Fixed call to skb_record_rx_queue where we were passing the queue index
relative to the adapter when it should have been relative to the net_device.

Signed-off-by: John (Jay) Hernandez <jay@chelsio.com>
Signed-off-by: Divy Le Ray <divy@chelsio.com>

---

 drivers/net/cxgb3/sge.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)


diff --git a/drivers/net/cxgb3/sge.c b/drivers/net/cxgb3/sge.c
index 3f562ba..76bf589 100644
--- a/drivers/net/cxgb3/sge.c
+++ b/drivers/net/cxgb3/sge.c
@@ -2026,7 +2026,7 @@ static void rx_eth(struct adapter *adap, struct sge_rspq *rq,
 		skb->ip_summed = CHECKSUM_UNNECESSARY;
 	} else
 		skb_checksum_none_assert(skb);
-	skb_record_rx_queue(skb, qs - &adap->sge.qs[0]);
+	skb_record_rx_queue(skb, qs - &adap->sge.qs[pi->first_qset]);
 
 	if (unlikely(p->vlan_valid)) {
 		struct vlan_group *grp = pi->vlan_grp;
@@ -2145,7 +2145,7 @@ static void lro_add_page(struct adapter *adap, struct sge_qset *qs,
 	if (!complete)
 		return;
 
-	skb_record_rx_queue(skb, qs - &adap->sge.qs[0]);
+	skb_record_rx_queue(skb, qs - &adap->sge.qs[pi->first_qset]);
 
 	if (unlikely(cpl->vlan_valid)) {
 		struct vlan_group *grp = pi->vlan_grp;


^ permalink raw reply related

* [PATCH] net: sh_eth: tidyup compile warning
From: Kuninori Morimoto @ 2011-06-24  2:02 UTC (permalink / raw)
  To: David S. Miller; +Cc: Linux-Net, shimoda

This patch tidyup below warning

${LINUX}/drivers/net/sh_eth.c:1773: warning:
'mdp' may be used uninitialized in this function

Cc: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Kuninori Morimoto <morimoto.kuninori@renesas.com>
---
 drivers/net/sh_eth.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/sh_eth.c b/drivers/net/sh_eth.c
index 8a72a97..96a629f 100644
--- a/drivers/net/sh_eth.c
+++ b/drivers/net/sh_eth.c
@@ -1770,7 +1770,7 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
 	int ret, devno = 0;
 	struct resource *res;
 	struct net_device *ndev = NULL;
-	struct sh_eth_private *mdp;
+	struct sh_eth_private *mdp = NULL;
 	struct sh_eth_plat_data *pd;
 
 	/* get base addr */
@@ -1888,7 +1888,7 @@ out_unregister:
 
 out_release:
 	/* net_dev free */
-	if (mdp->tsu_addr)
+	if (mdp && mdp->tsu_addr)
 		iounmap(mdp->tsu_addr);
 	if (ndev)
 		free_netdev(ndev);
-- 
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