* Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx
From: Shawn Guo @ 2011-07-08 0:06 UTC (permalink / raw)
To: Grant Likely
Cc: David Miller, netdev, s.hauer, troy.kisky, u.kleine-koenig,
shawn.guo, linux-arm-kernel, LW
In-Reply-To: <20110707184409.GH2824@ponder.secretlab.ca>
On Thu, Jul 07, 2011 at 12:44:09PM -0600, Grant Likely wrote:
> On Thu, Jul 07, 2011 at 09:41:58PM +0800, Shawn Guo wrote:
> > On Thu, Jul 07, 2011 at 04:12:57AM -0700, David Miller wrote:
> > > From: Shawn Guo <shawn.guo@linaro.org>
> > > Date: Fri, 1 Jul 2011 18:11:22 +0800
> > >
> > > > On the recent i.mx (mx25/50/53), there is a gasket inside fec
> > > > controller which needs to be enabled no matter phy works in MII
> > > > or RMII mode.
> > > >
> > > > The current code enables the gasket only when phy interface is RMII.
> > > > It's broken when the driver works with a MII phy. The patch uses
> > > > platform_device_id to distinguish the SoCs that have the gasket and
> > > > enables it on these SoCs for both MII and RMII mode.
> > > >
> > > > Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> > > > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > >
> > > Acked-by: David S. Miller <davem@davemloft.net>
> > > --
> >
> > Thanks, David. I will try to get it through Sascha's tree after
> > the rebase again dt series.
> >
> > Hi Sascha,
> >
> > How should we proceed? It seems Grant will take the fec-dt series
> > on his tree. Would you then merge that tree into yours, so that I
> > can rebase this patch on your tree and get it go through there?
>
> I should probably just take the lot.
>
Thanks, Grant. That makes people's life easier. Please let me know
once you apply the dt series, so that I can start rebase the patch on
your tree.
--
Regards,
Shawn
^ permalink raw reply
* Re: [PATCH 3/4] x86: Implement strict user copy checks for x86_64
From: Stephen Boyd @ 2011-07-08 1:15 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel, netdev
In-Reply-To: <20110707145413.90578915.akpm@linux-foundation.org>
On 07/07/2011 02:54 PM, Andrew Morton wrote:
> On Tue, 31 May 2011 11:14:32 -0700
> Stephen Boyd <sboyd@codeaurora.org> wrote:
>
>> Strict user copy checks are only really supported on x86_32 even
>> though the config option is selectable on x86_64. Add the
>> necessary support to the 64 bit code to trigger copy_from_user()
>> warnings at compile time.
>
> I'm still reluctant to go and throw a pile of warnings into many
> people's faces without having made an attempt to fix them.
>
>
I agree.
> We get a screen full of these:
>
> inlined from 'pktgen_if_write' at net/core/pktgen.c:877:
> /usr/src/devel/arch/x86/include/asm/uaccess_64.h:64: warning: call to 'copy_from_user_overflow' declared with attribute warning: copy_from_user() buffer size is not provably correct
> In function 'copy_from_user',
> inlined from 'pktgen_if_write' at net/core/pktgen.c:1145:
> /usr/src/devel/arch/x86/include/asm/uaccess_64.h:64: warning: call to 'copy_from_user_overflow' declared with attribute warning: copy_from_user() buffer size is not provably correct
> In function 'copy_from_user',
> ...
>
> and I don't immediately see a way of suppressing them without adding
> additional code.
>
> Ideas?
I think your compiler is newer than mine. I tried the 4.6.0 compilers
from kernel.org and only got the mempolicy warning. Ugh. When I sent the
series I was using a 4.4.1 gcc.
What happens if you inline strn_len()? I believe gcc can't prove to
itself that the function returns an int that is always less than the
size of f (or buf). This in turn requires it to generate the code for a
buffer overflow possibility (even though we can tell its never possible).
That's the thing with these strict user copy checks. First off we're
relying on aggressive dead code optimization. Second, the compiler can
easily get confused about constraints when function calls aren't
inlined. I'm tempted to say we should rewrite it from
char f[32];
memset(f, 0, 32);
len = strn_len(&user_buffer[i], sizeof(f) - 1);
if (len < 0)
return len;
if (copy_from_user(f, &user_buffer[i], len))
to
int len = strn_len(&user_buffer[i], 31);
char f[len + 1];
memset(f, 0, sizeof(f));
if (len < 0)
return len;
if (copy_from_user(f, &user_buffer[i], len))
so that gcc can easily see that f is always 1 more than len. But I can't
convince myself that is better (and it's actually broken with regards to
negative return values but you get the idea).
--
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
^ permalink raw reply
* Re: [PATCH linux-firmware] bnx2x: Adding FW 7.0.23.0
From: Ben Hutchings @ 2011-07-08 1:31 UTC (permalink / raw)
To: ariele; +Cc: dwmw2, eilong, netdev
In-Reply-To: <1310021987.3746.0.camel@lb-tlvb-ariel.il.broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 880 bytes --]
On Thu, 2011-07-07 at 09:59 +0300, Ariel Elior wrote:
> On Mon, 2011-07-04 at 19:07 +0300, Ariel Elior wrote:
> > On Mon, 2011-07-04 at 18:59 +0300, Ariel Elior wrote:
> > > This FW supports multiple concurrent classes of service in network traffic.
> > >
> > > Signed-off-by: Ariel Elior <ariele@broadcom.com>
> > > Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
> > > ---
> > in case you need it, the patch is also available under
> > http://linux.broadcom.com/eilong/FW-7.0.23.0/0001-bnx2x-Adding-FW-7.0.23.0.patch
> > thanks,
> > Ariel
> David, were you able to obtain the FW?
> Thanks,
> Ariel
I also have commit rights to linux-firmware, so if you mail both David
and me about new firmware then it may be added sooner.
I've applied this now.
Ben.
--
Ben Hutchings
The two most common things in the universe are hydrogen and stupidity.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]
^ permalink raw reply
* [PATCH] XFRM: Fix memory leak in xfrm_state_update
From: Tushar Gohad @ 2011-07-08 1:38 UTC (permalink / raw)
To: David Miller, Herbert Xu; +Cc: netdev, tusharsg
Upon "ip xfrm state update ..", xfrm_add_sa() takes an extra reference on
the user-supplied SA and forgets to drop the reference when
xfrm_state_update() returns 0. This leads to a memory leak as the
parameter SA is never freed. This change attempts to fix the leak by
calling __xfrm_state_put() when xfrm_state_update() updates a valid SA
(err = 0). The parameter SA is added to the gc list when the final
reference is dropped by xfrm_add_sa() upon completion.
Signed-off-by: Tushar Gohad <tgohad@mvista.com>
---
net/xfrm/xfrm_state.c | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c
index d70f85e..9414b9c 100644
--- a/net/xfrm/xfrm_state.c
+++ b/net/xfrm/xfrm_state.c
@@ -1345,6 +1345,8 @@ out:
xfrm_state_check_expire(x1);
err = 0;
+ x->km.state = XFRM_STATE_DEAD;
+ __xfrm_state_put(x);
}
spin_unlock_bh(&x1->lock);
--
1.6.3.3.202.g91879
^ permalink raw reply related
* trying to set skb->tstamp before netif_rx did not work in tun/tap driver, 2.6.27
From: Bill F @ 2011-07-08 2:33 UTC (permalink / raw)
To: netdev
Hi all,
I am trying to set the receive timestamp for a packet in the tun/tap device
driver before sending it into the network stack (by calling netif_rx_ni). On the
application side I'm using recvmsg() to receive the timestamp along with the
received packet.
I expected that any non-zero skb->tstamp I set would be the value my
application would see when it used recvmsg(), but a corrupted value is
coming out.
* If I hardcode skb->tstamp.tv64 to x7777777766666666
then recvmsg() always gets x011afd371a82fcc0.
* If I hardcode x4de684b100000000,
then recvmsg always gets x4f5f96640f2d1608.
* If I set a timestamp that a different process gave to the tun/tap driver
(this is the goal), then recvmsg gets a corrupted version of that
timestamp.
* If I hardcode a zero tstamp,
then an accurate timestamp comes out (but not precise enough for my
project).
The kernel build is 2.6.27.7, the architecture is MIPS, 64bit. Shouldn't this
work? Do I need to apply any known patches?
This arrangement worked last month in a similar setup: an e1000 driver
setting tstamp before calling netif_receive_skb() in a 2.6.24 kernel and a
686 architecture, 32 bit.
Thanks in advance.
Bill
^ permalink raw reply
* Re: [PATCH] XFRM: Fix memory leak in xfrm_state_update
From: Herbert Xu @ 2011-07-08 3:00 UTC (permalink / raw)
To: Tushar Gohad; +Cc: David Miller, netdev, tusharsg
In-Reply-To: <alpine.LFD.1.10.1107071820060.7677@net-test1.az.mvista.com>
On Thu, Jul 07, 2011 at 06:38:52PM -0700, Tushar Gohad wrote:
>
> Upon "ip xfrm state update ..", xfrm_add_sa() takes an extra reference on
> the user-supplied SA and forgets to drop the reference when
> xfrm_state_update() returns 0. This leads to a memory leak as the
> parameter SA is never freed. This change attempts to fix the leak by
> calling __xfrm_state_put() when xfrm_state_update() updates a valid SA
> (err = 0). The parameter SA is added to the gc list when the final
> reference is dropped by xfrm_add_sa() upon completion.
>
> Signed-off-by: Tushar Gohad <tgohad@mvista.com>
Ouch, thanks for catching this bug!
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: trying to set skb->tstamp before netif_rx did not work in tun/tap driver, 2.6.27
From: Eric Dumazet @ 2011-07-08 5:45 UTC (permalink / raw)
To: Bill F; +Cc: netdev
In-Reply-To: <loom.20110708T042440-631@post.gmane.org>
Le vendredi 08 juillet 2011 à 02:33 +0000, Bill F a écrit :
> Hi all,
>
> I am trying to set the receive timestamp for a packet in the tun/tap device
> driver before sending it into the network stack (by calling netif_rx_ni). On the
> application side I'm using recvmsg() to receive the timestamp along with the
> received packet.
>
> I expected that any non-zero skb->tstamp I set would be the value my
> application would see when it used recvmsg(), but a corrupted value is
> coming out.
> * If I hardcode skb->tstamp.tv64 to x7777777766666666
> then recvmsg() always gets x011afd371a82fcc0.
> * If I hardcode x4de684b100000000,
> then recvmsg always gets x4f5f96640f2d1608.
> * If I set a timestamp that a different process gave to the tun/tap driver
> (this is the goal), then recvmsg gets a corrupted version of that
> timestamp.
> * If I hardcode a zero tstamp,
> then an accurate timestamp comes out (but not precise enough for my
> project).
>
> The kernel build is 2.6.27.7, the architecture is MIPS, 64bit. Shouldn't this
> work? Do I need to apply any known patches?
>
> This arrangement worked last month in a similar setup: an e1000 driver
> setting tstamp before calling netif_receive_skb() in a 2.6.24 kernel and a
> 686 architecture, 32 bit.
>
You probably are hardcoding too much things ;)
The only portable tv64 value is the zero one.
Check CONFIG_KTIME_SCALAR on your config, and ktime_set()
implementations in include/linux/ktime.h
^ permalink raw reply
* [patch] dcbnl: unlock on an error path in dcbnl_cee_fill()
From: Dan Carpenter @ 2011-07-08 7:27 UTC (permalink / raw)
To: Shmulik Ravid
Cc: David S. Miller, John Fastabend, Shmulik Ravid,
open list:NETWORKING [GENERAL], kernel-janitors
We need to release "dcb_lock" which we took on the previous line.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/net/dcb/dcbnl.c b/net/dcb/dcbnl.c
index 6a015f2..3cb56af 100644
--- a/net/dcb/dcbnl.c
+++ b/net/dcb/dcbnl.c
@@ -1409,7 +1409,7 @@ static int dcbnl_cee_fill(struct sk_buff *skb, struct net_device *netdev)
spin_lock(&dcb_lock);
app = nla_nest_start(skb, DCB_ATTR_CEE_APP_TABLE);
if (!app)
- goto nla_put_failure;
+ goto dcb_unlock;
list_for_each_entry(itr, &dcb_app_list, list) {
if (strncmp(itr->name, netdev->name, IFNAMSIZ) == 0) {
^ permalink raw reply related
* [patch] packet: add an unlock on error in fanout_add()
From: Dan Carpenter @ 2011-07-08 7:28 UTC (permalink / raw)
To: David S. Miller
Cc: Eric Dumazet, Changli Gao, Ben Greear, Neil Horman,
open list:NETWORKING [GENERAL], kernel-janitors
We need to release the "fanout_mutex" here.
Signed-off-by: Dan Carpenter <error27@gmail.com>
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c
index aec50a1..3cbe950 100644
--- a/net/packet/af_packet.c
+++ b/net/packet/af_packet.c
@@ -589,8 +589,10 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
break;
}
}
- if (match && match->defrag != defrag)
- return -EINVAL;
+ if (match && match->defrag != defrag) {
+ err = -EINVAL;
+ goto out_unlock;
+ }
if (!match) {
match = kzalloc(sizeof(*match), GFP_KERNEL);
if (match) {
@@ -626,6 +628,8 @@ static int fanout_add(struct sock *sk, u16 id, u16 type_flags)
}
}
}
+
+out_unlock:
mutex_unlock(&fanout_mutex);
return err;
}
^ permalink raw reply related
* Re: [patch] packet: add an unlock on error in fanout_add()
From: Eric Dumazet @ 2011-07-08 8:01 UTC (permalink / raw)
To: Dan Carpenter
Cc: David S. Miller, Changli Gao, Ben Greear, Neil Horman,
open list:NETWORKING [GENERAL], kernel-janitors
In-Reply-To: <20110708072812.GX18655@shale.localdomain>
Le vendredi 08 juillet 2011 à 10:28 +0300, Dan Carpenter a écrit :
> We need to release the "fanout_mutex" here.
>
> Signed-off-by: Dan Carpenter <error27@gmail.com>
>
Thanks, was fixed yesterday :
http://git.kernel.org/?p=linux/kernel/git/davem/net-next-2.6.git;a=commit;h=afe62c68cd3562c5f8e3ea293e82906dd5a87936
^ permalink raw reply
* [PATCH] drivers/net: Omit check for multicast bit in netdev_for_each_mc_addr
From: Tobias Klauser @ 2011-07-08 8:06 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Joe Perches
There is no need to check for the address being a multicast address in
the netdev_for_each_mc_addr loop, so remove it.
There is no need to check for the address being a multicast address in
the netdev_for_each_mc_addr loop, so remove it. This patch covers all
remaining network drivers still containing such a check.
Cc: Joe Perches <joe@perches.com>
Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
---
drivers/net/7990.c | 9 +--------
drivers/net/a2065.c | 9 +--------
drivers/net/bmac.c | 8 +-------
drivers/net/declance.c | 9 +--------
drivers/net/ewrk3.c | 31 ++++++++++++++-----------------
drivers/net/fec.c | 4 ----
drivers/net/hp100.c | 18 ++++++++----------
drivers/net/ioc3-eth.c | 7 +------
drivers/net/korina.c | 7 +------
drivers/net/ks8851_mll.c | 2 --
drivers/net/ksz884x.c | 2 --
drivers/net/pcnet32.c | 9 +--------
drivers/net/smc911x.c | 5 -----
drivers/net/smc9194.c | 5 -----
drivers/net/smc91x.c | 5 -----
drivers/net/sunbmac.c | 8 +-------
drivers/net/sungem.c | 7 +------
drivers/net/sunhme.c | 16 ++--------------
drivers/net/sunlance.c | 8 +-------
drivers/net/sunqe.c | 7 +------
20 files changed, 35 insertions(+), 141 deletions(-)
diff --git a/drivers/net/7990.c b/drivers/net/7990.c
index 903bcb3..60b35fb 100644
--- a/drivers/net/7990.c
+++ b/drivers/net/7990.c
@@ -594,7 +594,6 @@ static void lance_load_multicast (struct net_device *dev)
volatile struct lance_init_block *ib = lp->init_block;
volatile u16 *mcast_table = (u16 *)&ib->filter;
struct netdev_hw_addr *ha;
- char *addrs;
u32 crc;
/* set all multicast bits */
@@ -609,13 +608,7 @@ static void lance_load_multicast (struct net_device *dev)
/* Add addresses */
netdev_for_each_mc_addr(ha, dev) {
- addrs = ha->addr;
-
- /* multicast address? */
- if (!(*addrs & 1))
- continue;
-
- crc = ether_crc_le(6, addrs);
+ crc = ether_crc_le(6, ha->addr);
crc = crc >> 26;
mcast_table [crc >> 4] |= 1 << (crc & 0xf);
}
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c
index 7d9a1a6..e1e1b07 100644
--- a/drivers/net/a2065.c
+++ b/drivers/net/a2065.c
@@ -587,7 +587,6 @@ static void lance_load_multicast(struct net_device *dev)
volatile struct lance_init_block *ib = lp->init_block;
volatile u16 *mcast_table = (u16 *)&ib->filter;
struct netdev_hw_addr *ha;
- char *addrs;
u32 crc;
/* set all multicast bits */
@@ -602,13 +601,7 @@ static void lance_load_multicast(struct net_device *dev)
/* Add addresses */
netdev_for_each_mc_addr(ha, dev) {
- addrs = ha->addr;
-
- /* multicast address? */
- if (!(*addrs & 1))
- continue;
-
- crc = ether_crc_le(6, addrs);
+ crc = ether_crc_le(6, ha->addr);
crc = crc >> 26;
mcast_table[crc >> 4] |= 1 << (crc & 0xf);
}
diff --git a/drivers/net/bmac.c b/drivers/net/bmac.c
index d2e58e2..45e45e8 100644
--- a/drivers/net/bmac.c
+++ b/drivers/net/bmac.c
@@ -1015,7 +1015,6 @@ static void bmac_set_multicast(struct net_device *dev)
static void bmac_set_multicast(struct net_device *dev)
{
struct netdev_hw_addr *ha;
- char *addrs;
int i;
unsigned short rx_cfg;
u32 crc;
@@ -1039,12 +1038,7 @@ static void bmac_set_multicast(struct net_device *dev)
for(i = 0; i < 4; i++) hash_table[i] = 0;
netdev_for_each_mc_addr(ha, dev) {
- addrs = ha->addr;
-
- if(!(*addrs & 1))
- continue;
-
- crc = ether_crc_le(6, addrs);
+ crc = ether_crc_le(6, ha->addr);
crc >>= 26;
hash_table[crc >> 4] |= 1 << (crc & 0xf);
}
diff --git a/drivers/net/declance.c b/drivers/net/declance.c
index cabd3a5..d5598f6 100644
--- a/drivers/net/declance.c
+++ b/drivers/net/declance.c
@@ -946,7 +946,6 @@ static void lance_load_multicast(struct net_device *dev)
struct lance_private *lp = netdev_priv(dev);
volatile u16 *ib = (volatile u16 *)dev->mem_start;
struct netdev_hw_addr *ha;
- char *addrs;
u32 crc;
/* set all multicast bits */
@@ -965,13 +964,7 @@ static void lance_load_multicast(struct net_device *dev)
/* Add addresses */
netdev_for_each_mc_addr(ha, dev) {
- addrs = ha->addr;
-
- /* multicast address? */
- if (!(*addrs & 1))
- continue;
-
- crc = ether_crc_le(ETH_ALEN, addrs);
+ crc = ether_crc_le(ETH_ALEN, ha->addr);
crc = crc >> 26;
*lib_ptr(ib, filter[crc >> 4], lp->type) |= 1 << (crc & 0xf);
}
diff --git a/drivers/net/ewrk3.c b/drivers/net/ewrk3.c
index d1e229f..05a5f71 100644
--- a/drivers/net/ewrk3.c
+++ b/drivers/net/ewrk3.c
@@ -1169,7 +1169,7 @@ static void SetMulticastFilter(struct net_device *dev)
struct netdev_hw_addr *ha;
u_long iobase = dev->base_addr;
int i;
- char *addrs, bit, byte;
+ char bit, byte;
short __iomem *p = lp->mctbl;
u16 hashcode;
u32 crc;
@@ -1211,25 +1211,22 @@ static void SetMulticastFilter(struct net_device *dev)
/* Update table */
netdev_for_each_mc_addr(ha, dev) {
- addrs = ha->addr;
- if ((*addrs & 0x01) == 1) { /* multicast address? */
- crc = ether_crc_le(ETH_ALEN, addrs);
- hashcode = crc & ((1 << 9) - 1); /* hashcode is 9 LSb of CRC */
+ crc = ether_crc_le(ETH_ALEN, ha->addr);
+ hashcode = crc & ((1 << 9) - 1); /* hashcode is 9 LSb of CRC */
- byte = hashcode >> 3; /* bit[3-8] -> byte in filter */
- bit = 1 << (hashcode & 0x07); /* bit[0-2] -> bit in byte */
+ byte = hashcode >> 3; /* bit[3-8] -> byte in filter */
+ bit = 1 << (hashcode & 0x07); /* bit[0-2] -> bit in byte */
- if (lp->shmem_length == IO_ONLY) {
- u_char tmp;
+ if (lp->shmem_length == IO_ONLY) {
+ u_char tmp;
- outw(PAGE0_HTE + byte, EWRK3_PIR1);
- tmp = inb(EWRK3_DATA);
- tmp |= bit;
- outw(PAGE0_HTE + byte, EWRK3_PIR1);
- outb(tmp, EWRK3_DATA);
- } else {
- writeb(readb(lp->mctbl + byte) | bit, lp->mctbl + byte);
- }
+ outw(PAGE0_HTE + byte, EWRK3_PIR1);
+ tmp = inb(EWRK3_DATA);
+ tmp |= bit;
+ outw(PAGE0_HTE + byte, EWRK3_PIR1);
+ outb(tmp, EWRK3_DATA);
+ } else {
+ writeb(readb(lp->mctbl + byte) | bit, lp->mctbl + byte);
}
}
}
diff --git a/drivers/net/fec.c b/drivers/net/fec.c
index 7ae3f28..5b631fe 100644
--- a/drivers/net/fec.c
+++ b/drivers/net/fec.c
@@ -1227,10 +1227,6 @@ static void set_multicast_list(struct net_device *ndev)
writel(0, fep->hwp + FEC_GRP_HASH_TABLE_LOW);
netdev_for_each_mc_addr(ha, ndev) {
- /* Only support group multicast for now */
- if (!(ha->addr[0] & 1))
- continue;
-
/* calculate crc32 value of mac address */
crc = 0xffffffff;
diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
index c3ecb11..b6519c1 100644
--- a/drivers/net/hp100.c
+++ b/drivers/net/hp100.c
@@ -2103,20 +2103,18 @@ static void hp100_set_multicast_list(struct net_device *dev)
#endif
netdev_for_each_mc_addr(ha, dev) {
addrs = ha->addr;
- if ((*addrs & 0x01) == 0x01) { /* multicast address? */
#ifdef HP100_DEBUG
- printk("hp100: %s: multicast = %pM, ",
- dev->name, addrs);
+ printk("hp100: %s: multicast = %pM, ",
+ dev->name, addrs);
#endif
- for (i = idx = 0; i < 6; i++) {
- idx ^= *addrs++ & 0x3f;
- printk(":%02x:", idx);
- }
+ for (i = idx = 0; i < 6; i++) {
+ idx ^= *addrs++ & 0x3f;
+ printk(":%02x:", idx);
+ }
#ifdef HP100_DEBUG
- printk("idx = %i\n", idx);
+ printk("idx = %i\n", idx);
#endif
- lp->hash_bytes[idx >> 3] |= (1 << (idx & 7));
- }
+ lp->hash_bytes[idx >> 3] |= (1 << (idx & 7));
}
}
#else
diff --git a/drivers/net/ioc3-eth.c b/drivers/net/ioc3-eth.c
index 318a25a..a234e45 100644
--- a/drivers/net/ioc3-eth.c
+++ b/drivers/net/ioc3-eth.c
@@ -1664,12 +1664,7 @@ static void ioc3_set_multicast_list(struct net_device *dev)
ip->ehar_l = 0xffffffff;
} else {
netdev_for_each_mc_addr(ha, dev) {
- char *addr = ha->addr;
-
- if (!(*addr & 1))
- continue;
-
- ehar |= (1UL << ioc3_hash(addr));
+ ehar |= (1UL << ioc3_hash(ha->addr));
}
ip->ehar_h = ehar >> 32;
ip->ehar_l = ehar & 0xffffffff;
diff --git a/drivers/net/korina.c b/drivers/net/korina.c
index c7a9bef..763844c 100644
--- a/drivers/net/korina.c
+++ b/drivers/net/korina.c
@@ -504,12 +504,7 @@ static void korina_multicast_list(struct net_device *dev)
hash_table[i] = 0;
netdev_for_each_mc_addr(ha, dev) {
- char *addrs = ha->addr;
-
- if (!(*addrs & 1))
- continue;
-
- crc = ether_crc_le(6, addrs);
+ crc = ether_crc_le(6, ha->addr);
crc >>= 26;
hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf));
}
diff --git a/drivers/net/ks8851_mll.c b/drivers/net/ks8851_mll.c
index a823782..d19c849 100644
--- a/drivers/net/ks8851_mll.c
+++ b/drivers/net/ks8851_mll.c
@@ -1190,8 +1190,6 @@ static void ks_set_rx_mode(struct net_device *netdev)
int i = 0;
netdev_for_each_mc_addr(ha, netdev) {
- if (!(*ha->addr & 1))
- continue;
if (i >= MAX_MCAST_LST)
break;
memcpy(ks->mcast_lst[i++], ha->addr, ETH_ALEN);
diff --git a/drivers/net/ksz884x.c b/drivers/net/ksz884x.c
index 2ac6c6c..27418d3 100644
--- a/drivers/net/ksz884x.c
+++ b/drivers/net/ksz884x.c
@@ -5785,8 +5785,6 @@ static void netdev_set_rx_mode(struct net_device *dev)
}
netdev_for_each_mc_addr(ha, dev) {
- if (!(*ha->addr & 1))
- continue;
if (i >= MAX_MULTICAST_LIST)
break;
memcpy(hw->multi_list[i++], ha->addr, MAC_ADDR_LEN);
diff --git a/drivers/net/pcnet32.c b/drivers/net/pcnet32.c
index b48aba9..8b3090d 100644
--- a/drivers/net/pcnet32.c
+++ b/drivers/net/pcnet32.c
@@ -2570,7 +2570,6 @@ static void pcnet32_load_multicast(struct net_device *dev)
volatile __le16 *mcast_table = (__le16 *)ib->filter;
struct netdev_hw_addr *ha;
unsigned long ioaddr = dev->base_addr;
- char *addrs;
int i;
u32 crc;
@@ -2590,13 +2589,7 @@ static void pcnet32_load_multicast(struct net_device *dev)
/* Add addresses */
netdev_for_each_mc_addr(ha, dev) {
- addrs = ha->addr;
-
- /* multicast address? */
- if (!(*addrs & 1))
- continue;
-
- crc = ether_crc_le(6, addrs);
+ crc = ether_crc_le(6, ha->addr);
crc = crc >> 26;
mcast_table[crc >> 4] |= cpu_to_le16(1 << (crc & 0xf));
}
diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c
index 053863a..a91fe17 100644
--- a/drivers/net/smc911x.c
+++ b/drivers/net/smc911x.c
@@ -1351,11 +1351,6 @@ static void smc911x_set_multicast_list(struct net_device *dev)
netdev_for_each_mc_addr(ha, dev) {
u32 position;
- /* make sure this is a multicast address -
- shouldn't this be a given if we have it here ? */
- if (!(*ha->addr & 1))
- continue;
-
/* upper 6 bits are used as hash index */
position = ether_crc(ETH_ALEN, ha->addr)>>26;
diff --git a/drivers/net/smc9194.c b/drivers/net/smc9194.c
index 7486d09..5b65ac4 100644
--- a/drivers/net/smc9194.c
+++ b/drivers/net/smc9194.c
@@ -447,11 +447,6 @@ static void smc_setmulticast(int ioaddr, struct net_device *dev)
netdev_for_each_mc_addr(ha, dev) {
int position;
- /* make sure this is a multicast address - shouldn't this
- be a given if we have it here ? */
- if (!(*ha->addr & 1))
- continue;
-
/* only use the low order bits */
position = ether_crc_le(6, ha->addr) & 0x3f;
diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index f628574..2b1d254 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -1425,11 +1425,6 @@ static void smc_set_multicast_list(struct net_device *dev)
netdev_for_each_mc_addr(ha, dev) {
int position;
- /* make sure this is a multicast address -
- shouldn't this be a given if we have it here ? */
- if (!(*ha->addr & 1))
- continue;
-
/* only use the low order bits */
position = crc32_le(~0, ha->addr, 6) & 0x3f;
diff --git a/drivers/net/sunbmac.c b/drivers/net/sunbmac.c
index aa47658..297a424 100644
--- a/drivers/net/sunbmac.c
+++ b/drivers/net/sunbmac.c
@@ -998,7 +998,6 @@ static void bigmac_set_multicast(struct net_device *dev)
struct bigmac *bp = netdev_priv(dev);
void __iomem *bregs = bp->bregs;
struct netdev_hw_addr *ha;
- char *addrs;
int i;
u32 tmp, crc;
@@ -1027,12 +1026,7 @@ static void bigmac_set_multicast(struct net_device *dev)
hash_table[i] = 0;
netdev_for_each_mc_addr(ha, dev) {
- addrs = ha->addr;
-
- if (!(*addrs & 1))
- continue;
-
- crc = ether_crc_le(6, addrs);
+ crc = ether_crc_le(6, ha->addr);
crc >>= 26;
hash_table[crc >> 4] |= 1 << (crc & 0xf);
}
diff --git a/drivers/net/sungem.c b/drivers/net/sungem.c
index 32b11a3..be745ae 100644
--- a/drivers/net/sungem.c
+++ b/drivers/net/sungem.c
@@ -1801,12 +1801,7 @@ static u32 gem_setup_multicast(struct gem *gp)
memset(hash_table, 0, sizeof(hash_table));
netdev_for_each_mc_addr(ha, gp->dev) {
- char *addrs = ha->addr;
-
- if (!(*addrs & 1))
- continue;
-
- crc = ether_crc_le(6, addrs);
+ crc = ether_crc_le(6, ha->addr);
crc >>= 24;
hash_table[crc >> 4] |= 1 << (15 - (crc & 0xf));
}
diff --git a/drivers/net/sunhme.c b/drivers/net/sunhme.c
index 30aad54..856e05b 100644
--- a/drivers/net/sunhme.c
+++ b/drivers/net/sunhme.c
@@ -1524,17 +1524,11 @@ static int happy_meal_init(struct happy_meal *hp)
} else if ((hp->dev->flags & IFF_PROMISC) == 0) {
u16 hash_table[4];
struct netdev_hw_addr *ha;
- char *addrs;
u32 crc;
memset(hash_table, 0, sizeof(hash_table));
netdev_for_each_mc_addr(ha, hp->dev) {
- addrs = ha->addr;
-
- if (!(*addrs & 1))
- continue;
-
- crc = ether_crc_le(6, addrs);
+ crc = ether_crc_le(6, ha->addr);
crc >>= 26;
hash_table[crc >> 4] |= 1 << (crc & 0xf);
}
@@ -2361,7 +2355,6 @@ static void happy_meal_set_multicast(struct net_device *dev)
struct happy_meal *hp = netdev_priv(dev);
void __iomem *bregs = hp->bigmacregs;
struct netdev_hw_addr *ha;
- char *addrs;
u32 crc;
spin_lock_irq(&hp->happy_lock);
@@ -2379,12 +2372,7 @@ static void happy_meal_set_multicast(struct net_device *dev)
memset(hash_table, 0, sizeof(hash_table));
netdev_for_each_mc_addr(ha, dev) {
- addrs = ha->addr;
-
- if (!(*addrs & 1))
- continue;
-
- crc = ether_crc_le(6, addrs);
+ crc = ether_crc_le(6, ha->addr);
crc >>= 26;
hash_table[crc >> 4] |= 1 << (crc & 0xf);
}
diff --git a/drivers/net/sunlance.c b/drivers/net/sunlance.c
index 32a5c7f..06f2d43 100644
--- a/drivers/net/sunlance.c
+++ b/drivers/net/sunlance.c
@@ -1170,7 +1170,6 @@ static void lance_load_multicast(struct net_device *dev)
{
struct lance_private *lp = netdev_priv(dev);
struct netdev_hw_addr *ha;
- char *addrs;
u32 crc;
u32 val;
@@ -1195,12 +1194,7 @@ static void lance_load_multicast(struct net_device *dev)
/* Add addresses */
netdev_for_each_mc_addr(ha, dev) {
- addrs = ha->addr;
-
- /* multicast address? */
- if (!(*addrs & 1))
- continue;
- crc = ether_crc_le(6, addrs);
+ crc = ether_crc_le(6, ha->addr);
crc = crc >> 26;
if (lp->pio_buffer) {
struct lance_init_block __iomem *ib = lp->init_block_iomem;
diff --git a/drivers/net/sunqe.c b/drivers/net/sunqe.c
index 18ecdc3..209c7f8 100644
--- a/drivers/net/sunqe.c
+++ b/drivers/net/sunqe.c
@@ -628,7 +628,6 @@ static void qe_set_multicast(struct net_device *dev)
struct sunqe *qep = netdev_priv(dev);
struct netdev_hw_addr *ha;
u8 new_mconfig = qep->mconfig;
- char *addrs;
int i;
u32 crc;
@@ -651,11 +650,7 @@ static void qe_set_multicast(struct net_device *dev)
memset(hash_table, 0, sizeof(hash_table));
netdev_for_each_mc_addr(ha, dev) {
- addrs = ha->addr;
-
- if (!(*addrs & 1))
- continue;
- crc = ether_crc_le(6, addrs);
+ crc = ether_crc_le(6, ha->addr);
crc >>= 26;
hash_table[crc >> 4] |= 1 << (crc & 0xf);
}
--
1.7.5.4
^ permalink raw reply related
* Re: [PATCH] drivers/net: Omit check for multicast bit in netdev_for_each_mc_addr
From: Joe Perches @ 2011-07-08 8:35 UTC (permalink / raw)
To: Tobias Klauser; +Cc: David S. Miller, netdev, Jaroslav Kysela
In-Reply-To: <1310112386-13716-1-git-send-email-tklauser@distanz.ch>
On Fri, 2011-07-08 at 10:06 +0200, Tobias Klauser wrote:
> There is no need to check for the address being a multicast address in
> the netdev_for_each_mc_addr loop, so remove it.
>
> There is no need to check for the address being a multicast address in
> the netdev_for_each_mc_addr loop, so remove it.
Thanks Tobias.
The commit message is a bit redundant, but this looks
good to me.
[]
> diff --git a/drivers/net/hp100.c b/drivers/net/hp100.c
[]
> @@ -2103,20 +2103,18 @@ static void hp100_set_multicast_list(struct net_device *dev)
> #endif
> netdev_for_each_mc_addr(ha, dev) {
> addrs = ha->addr;
> - if ((*addrs & 0x01) == 0x01) { /* multicast address? */
> #ifdef HP100_DEBUG
> - printk("hp100: %s: multicast = %pM, ",
> - dev->name, addrs);
> + printk("hp100: %s: multicast = %pM, ",
> + dev->name, addrs);
> #endif
> - for (i = idx = 0; i < 6; i++) {
> - idx ^= *addrs++ & 0x3f;
> - printk(":%02x:", idx);
> - }
> + for (i = idx = 0; i < 6; i++) {
> + idx ^= *addrs++ & 0x3f;
> + printk(":%02x:", idx);
> + }
It looks as if printing the per-byte hash
should also be guarded by HP100_DEBUG.
It's been this way since at least 2.4.1 though.
Does anyone still use this adapter?
^ permalink raw reply
* Re: [PATCH] drivers/net: Omit check for multicast bit in netdev_for_each_mc_addr
From: Tobias Klauser @ 2011-07-08 8:42 UTC (permalink / raw)
To: Joe Perches; +Cc: David S. Miller, netdev, Jaroslav Kysela
In-Reply-To: <1310114109.2755.18.camel@Joe-Laptop>
On 2011-07-08 at 10:35:09 +0200, Joe Perches <joe@perches.com> wrote:
> On Fri, 2011-07-08 at 10:06 +0200, Tobias Klauser wrote:
> > There is no need to check for the address being a multicast address in
> > the netdev_for_each_mc_addr loop, so remove it.
> >
> > There is no need to check for the address being a multicast address in
> > the netdev_for_each_mc_addr loop, so remove it.
>
> Thanks Tobias.
>
> The commit message is a bit redundant, but this looks
> good to me.
Oops, sorry. The first part should've gone away.
David, I can resend it with an adjusted commit message if you want, so
you don't need to edit it.
^ permalink raw reply
* Re: [PATCH net-next 1/5] sky2: force receive checksum when using RSS on some hardware (v2)
From: Michał Mirosław @ 2011-07-08 8:45 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David S. Miller, netdev
In-Reply-To: <20110707164000.6f3f58f4@nehalam.ftrdhcpuser.net>
2011/7/8 Stephen Hemminger <shemminger@vyatta.com>:
> Found when reviewing the vendor driver. Apparently some chip versions
> require receive checksumming to be enabled in order for RSS to work.
>
> Also, if fix_features has to change some settings; put in message
> in log in similar manner to netdev_fix_features.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> ---
> v2 - enforce the requirement in fix_features rather than set features
>
> --- a/drivers/net/sky2.c 2011-07-07 13:56:03.575420273 -0700
> +++ b/drivers/net/sky2.c 2011-07-07 14:03:17.775403938 -0700
[...]
> @@ -4176,8 +4180,18 @@ static u32 sky2_fix_features(struct net_
> /* In order to do Jumbo packets on these chips, need to turn off the
> * transmit store/forward. Therefore checksum offload won't work.
> */
> - if (dev->mtu > ETH_DATA_LEN && hw->chip_id == CHIP_ID_YUKON_EC_U)
> + if (dev->mtu > ETH_DATA_LEN && hw->chip_id == CHIP_ID_YUKON_EC_U) {
> + netdev_warn(dev, "checksum offload not possible with jumbo frames\n");
> features &= ~(NETIF_F_TSO|NETIF_F_SG|NETIF_F_ALL_CSUM);
> + }
> +
> + /* Some hardware requires receive checksum for RSS to work. */
> + if ( (features & NETIF_F_RXHASH) &&
> + !(features & NETIF_F_RXCSUM) &&
> + (sky2->hw->flags & SKY2_HW_RSS_CHKSUM)) {
> + netdev_warn(dev, "receive hashing forces receive checksum\n");
> + features |= NETIF_F_RXCSUM;
> + }
>
> return features;
> }
I suggest using netdev_dbg() instead of netdev_warn() so it won't spam
dmesg on every features update.
Otherwise, looks good.
Best Regards,
Michał Mirosław
^ permalink raw reply
* [PATCH] net/natsemi: Fix module parameter permissions
From: Jean Delvare @ 2011-07-08 9:01 UTC (permalink / raw)
To: netdev; +Cc: Tim Hockin, Mark Brown
The third parameter of module_param is supposed to represent sysfs
file permissions. A value of "1" leads to the following:
$ ls -l /sys/module/natsemi/parameters/
total 0
---------x 1 root root 4096 Jul 8 09:46 dspcfg_workaround
I am changing it to "0" to align with the other module parameters in
this driver.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Cc: Tim Hockin <thockin@hockin.org>
Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
drivers/net/natsemi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-3.0-rc6.orig/drivers/net/natsemi.c 2011-05-30 20:45:13.000000000 +0200
+++ linux-3.0-rc6/drivers/net/natsemi.c 2011-07-08 09:57:47.000000000 +0200
@@ -140,7 +140,7 @@ MODULE_LICENSE("GPL");
module_param(mtu, int, 0);
module_param(debug, int, 0);
module_param(rx_copybreak, int, 0);
-module_param(dspcfg_workaround, int, 1);
+module_param(dspcfg_workaround, int, 0);
module_param_array(options, int, NULL, 0);
module_param_array(full_duplex, int, NULL, 0);
MODULE_PARM_DESC(mtu, "DP8381x MTU (all boards)");
--
Jean Delvare
Suse L3
^ permalink raw reply
* Re: [PATCH v2 1/5] dt: add of_alias_scan and of_alias_get_id
From: Shawn Guo @ 2011-07-08 9:36 UTC (permalink / raw)
To: Shawn Guo
Cc: linux-arm-kernel, patches, netdev, devicetree-discuss,
linux-kernel, linux-serial
In-Reply-To: <1308938676-31121-2-git-send-email-shawn.guo@linaro.org>
Hi Grant,
I saw neither your comments nor ack on this patch. Where does it go?
Regards,
Shawn
On Sat, Jun 25, 2011 at 02:04:32AM +0800, Shawn Guo wrote:
> The patch adds function of_alias_scan to populate a global lookup
> table with the properties of 'aliases' node and function
> of_alias_get_id for drivers to find alias id from the lookup table.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Grant Likely <grant.likely@secretlab.ca>
> ---
^ permalink raw reply
* Re: [PATCH] net/fec: gasket needs to be enabled for some i.mx
From: Sascha Hauer @ 2011-07-08 10:18 UTC (permalink / raw)
To: Shawn Guo
Cc: netdev, linux-arm-kernel, u.kleine-koenig, LW, Troy Kisky,
David S. Miller
In-Reply-To: <1309515082-7386-1-git-send-email-shawn.guo@linaro.org>
On Fri, Jul 01, 2011 at 06:11:22PM +0800, Shawn Guo wrote:
> On the recent i.mx (mx25/50/53), there is a gasket inside fec
> controller which needs to be enabled no matter phy works in MII
> or RMII mode.
>
> The current code enables the gasket only when phy interface is RMII.
> It's broken when the driver works with a MII phy. The patch uses
> platform_device_id to distinguish the SoCs that have the gasket and
> enables it on these SoCs for both MII and RMII mode.
>
> Signed-off-by: Troy Kisky <troy.kisky@boundarydevices.com>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> arch/arm/mach-imx/clock-imx25.c | 2 +-
> arch/arm/mach-imx/clock-imx27.c | 2 +-
> arch/arm/mach-imx/clock-imx35.c | 2 +-
> arch/arm/mach-mx5/clock-mx51-mx53.c | 4 +-
> arch/arm/plat-mxc/devices/platform-fec.c | 17 ++++++++-------
> arch/arm/plat-mxc/include/mach/devices-common.h | 1 +
> drivers/net/fec.c | 26 ++++++++++++++++++++--
> 7 files changed, 38 insertions(+), 16 deletions(-)
>
> diff --git a/arch/arm/mach-imx/clock-imx25.c b/arch/arm/mach-imx/clock-imx25.c
> index a65838f..5527fff 100644
> --- a/arch/arm/mach-imx/clock-imx25.c
> +++ b/arch/arm/mach-imx/clock-imx25.c
> @@ -294,7 +294,7 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
> _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk)
> _REGISTER_CLOCK("imx-i2c.2", NULL, i2c_clk)
> - _REGISTER_CLOCK("fec.0", NULL, fec_clk)
> + _REGISTER_CLOCK("imx25-fec.0", NULL, fec_clk)
> _REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
> _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
> _REGISTER_CLOCK("imx2-wdt.0", NULL, wdt_clk)
> diff --git a/arch/arm/mach-imx/clock-imx27.c b/arch/arm/mach-imx/clock-imx27.c
> index 583f251..d197df2 100644
> --- a/arch/arm/mach-imx/clock-imx27.c
> +++ b/arch/arm/mach-imx/clock-imx27.c
> @@ -662,7 +662,7 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK(NULL, "brom", brom_clk)
> _REGISTER_CLOCK(NULL, "emma", emma_clk)
> _REGISTER_CLOCK(NULL, "slcdc", slcdc_clk)
> - _REGISTER_CLOCK("fec.0", NULL, fec_clk)
> + _REGISTER_CLOCK("imx27-fec.0", NULL, fec_clk)
> _REGISTER_CLOCK(NULL, "emi", emi_clk)
> _REGISTER_CLOCK(NULL, "sahara2", sahara2_clk)
> _REGISTER_CLOCK(NULL, "ata", ata_clk)
> diff --git a/arch/arm/mach-imx/clock-imx35.c b/arch/arm/mach-imx/clock-imx35.c
> index 5a4cc1e..fb4007b 100644
> --- a/arch/arm/mach-imx/clock-imx35.c
> +++ b/arch/arm/mach-imx/clock-imx35.c
> @@ -461,7 +461,7 @@ static struct clk_lookup lookups[] = {
> _REGISTER_CLOCK("sdhci-esdhc-imx.0", NULL, esdhc1_clk)
> _REGISTER_CLOCK("sdhci-esdhc-imx.1", NULL, esdhc2_clk)
> _REGISTER_CLOCK("sdhci-esdhc-imx.2", NULL, esdhc3_clk)
> - _REGISTER_CLOCK("fec.0", NULL, fec_clk)
> + _REGISTER_CLOCK("imx35-fec.0", NULL, fec_clk)
> _REGISTER_CLOCK(NULL, "gpio", gpio1_clk)
> _REGISTER_CLOCK(NULL, "gpio", gpio2_clk)
> _REGISTER_CLOCK(NULL, "gpio", gpio3_clk)
> diff --git a/arch/arm/mach-mx5/clock-mx51-mx53.c b/arch/arm/mach-mx5/clock-mx51-mx53.c
> index 699b0d2..04c5a01 100644
> --- a/arch/arm/mach-mx5/clock-mx51-mx53.c
> +++ b/arch/arm/mach-mx5/clock-mx51-mx53.c
> @@ -1426,7 +1426,7 @@ static struct clk_lookup mx51_lookups[] = {
> _REGISTER_CLOCK("imx-uart.1", NULL, uart2_clk)
> _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk)
> _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
> - _REGISTER_CLOCK("fec.0", NULL, fec_clk)
> + _REGISTER_CLOCK("imx51-fec.0", NULL, fec_clk)
> _REGISTER_CLOCK("mxc_pwm.0", "pwm", pwm1_clk)
> _REGISTER_CLOCK("mxc_pwm.1", "pwm", pwm2_clk)
> _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
> @@ -1475,7 +1475,7 @@ static struct clk_lookup mx53_lookups[] = {
> _REGISTER_CLOCK("imx-uart.3", NULL, uart4_clk)
> _REGISTER_CLOCK("imx-uart.4", NULL, uart5_clk)
> _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
> - _REGISTER_CLOCK("fec.0", NULL, fec_clk)
> + _REGISTER_CLOCK("imx53-fec.0", NULL, fec_clk)
> _REGISTER_CLOCK(NULL, "iim_clk", iim_clk)
> _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
> _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
> diff --git a/arch/arm/plat-mxc/devices/platform-fec.c b/arch/arm/plat-mxc/devices/platform-fec.c
> index ccc789e..3790c59 100644
> --- a/arch/arm/plat-mxc/devices/platform-fec.c
> +++ b/arch/arm/plat-mxc/devices/platform-fec.c
> @@ -10,40 +10,41 @@
> #include <mach/hardware.h>
> #include <mach/devices-common.h>
>
> -#define imx_fec_data_entry_single(soc) \
> +#define imx_fec_data_entry_single(soc, _devid) \
> { \
> + .devid = _devid, \
> .iobase = soc ## _FEC_BASE_ADDR, \
> .irq = soc ## _INT_FEC, \
> }
>
> #ifdef CONFIG_SOC_IMX25
> const struct imx_fec_data imx25_fec_data __initconst =
> - imx_fec_data_entry_single(MX25);
> + imx_fec_data_entry_single(MX25, "imx25-fec");
> #endif /* ifdef CONFIG_SOC_IMX25 */
>
> #ifdef CONFIG_SOC_IMX27
> const struct imx_fec_data imx27_fec_data __initconst =
> - imx_fec_data_entry_single(MX27);
> + imx_fec_data_entry_single(MX27, "imx27-fec");
> #endif /* ifdef CONFIG_SOC_IMX27 */
>
> #ifdef CONFIG_SOC_IMX35
> const struct imx_fec_data imx35_fec_data __initconst =
> - imx_fec_data_entry_single(MX35);
> + imx_fec_data_entry_single(MX35, "imx35-fec");
> #endif
>
> #ifdef CONFIG_SOC_IMX50
> const struct imx_fec_data imx50_fec_data __initconst =
> - imx_fec_data_entry_single(MX50);
> + imx_fec_data_entry_single(MX50, "imx50-fec");
> #endif
>
> #ifdef CONFIG_SOC_IMX51
> const struct imx_fec_data imx51_fec_data __initconst =
> - imx_fec_data_entry_single(MX51);
> + imx_fec_data_entry_single(MX51, "imx51-fec");
> #endif
>
> #ifdef CONFIG_SOC_IMX53
> const struct imx_fec_data imx53_fec_data __initconst =
> - imx_fec_data_entry_single(MX53);
> + imx_fec_data_entry_single(MX53, "imx53-fec");
> #endif
>
> struct platform_device *__init imx_add_fec(
> @@ -62,7 +63,7 @@ struct platform_device *__init imx_add_fec(
> },
> };
>
> - return imx_add_platform_device_dmamask("fec", 0,
> + return imx_add_platform_device_dmamask(data->devid, 0,
> res, ARRAY_SIZE(res),
> pdata, sizeof(*pdata), DMA_BIT_MASK(32));
> }
> diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
> index bf93820..6ac2450 100644
> --- a/arch/arm/plat-mxc/include/mach/devices-common.h
> +++ b/arch/arm/plat-mxc/include/mach/devices-common.h
> @@ -30,6 +30,7 @@ static inline struct platform_device *imx_add_platform_device(
>
> #include <linux/fec.h>
> struct imx_fec_data {
> + const char *devid;
> resource_size_t iobase;
> resource_size_t irq;
> };
> diff --git a/drivers/net/fec.c b/drivers/net/fec.c
> index 885d8ba..9161a82 100644
> --- a/drivers/net/fec.c
> +++ b/drivers/net/fec.c
> @@ -66,14 +66,31 @@
> #define FEC_QUIRK_ENET_MAC (1 << 0)
> /* Controller needs driver to swap frame */
> #define FEC_QUIRK_SWAP_FRAME (1 << 1)
> +/* Controller uses gasket */
> +#define FEC_QUIRK_USE_GASKET (1 << 2)
>
> static struct platform_device_id fec_devtype[] = {
> {
> - .name = DRIVER_NAME,
> + .name = "imx25-fec",
Just realized that this change breaks m68k support. You shouldn't remove
DRIVER_NAME from fec_devtype[]
Sascha
> + .driver_data = FEC_QUIRK_USE_GASKET,
> + }, {
> + .name = "imx27-fec",
> .driver_data = 0,
> }, {
> .name = "imx28-fec",
> .driver_data = FEC_QUIRK_ENET_MAC | FEC_QUIRK_SWAP_FRAME,
> + }, {
> + .name = "imx35-fec",
> + .driver_data = 0,
> + }, {
> + .name = "imx50-fec",
> + .driver_data = FEC_QUIRK_USE_GASKET,
> + }, {
> + .name = "imx51-fec",
> + .driver_data = 0,
> + }, {
> + .name = "imx53-fec",
> + .driver_data = FEC_QUIRK_USE_GASKET,
> },
> { }
> };
> @@ -425,7 +442,7 @@ fec_restart(struct net_device *ndev, int duplex)
>
> } else {
> #ifdef FEC_MIIGSK_ENR
> - if (fep->phy_interface == PHY_INTERFACE_MODE_RMII) {
> + if (id_entry->driver_data & FEC_QUIRK_USE_GASKET) {
> /* disable the gasket and wait */
> writel(0, fep->hwp + FEC_MIIGSK_ENR);
> while (readl(fep->hwp + FEC_MIIGSK_ENR) & 4)
> @@ -434,8 +451,11 @@ fec_restart(struct net_device *ndev, int duplex)
> /*
> * configure the gasket:
> * RMII, 50 MHz, no loopback, no echo
> + * MII, 25 MHz, no loopback, no echo
> */
> - writel(1, fep->hwp + FEC_MIIGSK_CFGR);
> + writel((fep->phy_interface == PHY_INTERFACE_MODE_RMII) ?
> + 1 : 0, fep->hwp + FEC_MIIGSK_CFGR);
> +
>
> /* re-enable the gasket */
> writel(2, fep->hwp + FEC_MIIGSK_ENR);
> --
> 1.7.4.1
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply
* Re: [PATCH 2/2] vhost: set log when updating used flags or avail event
From: Jason Wang @ 2011-07-08 10:38 UTC (permalink / raw)
To: Michael S. Tsirkin; +Cc: netdev, virtualization, linux-kernel, kvm
In-Reply-To: <20110707125728.GA2469@redhat.com>
On 07/07/2011 08:57 PM, Michael S. Tsirkin wrote:
> Subject: vhost: used ring logging cleanup
>
> remove extra log bit setting for used ring updates: it's no longer
> necessary. Also, use vhost_avail_event instead of duplicating offset
> math.
>
> Signed-off-by: Michael S. Tsirkin<mst@redhat.com>
> ---
>
>> We need set log when updating used flags and avail event. Otherwise guest may
>> see stale values after migration and then do not exit or exit unexpectedly.
>>
>> Signed-off-by: Jason Wang<jasowang@redhat.com>
> OK but this means we set the log twice now.
> Also, hardcording offset is not as nice as using
> vhost_avail_event. So I think the below is needed
> on top. Comments?
>
Right, thanks for the cleanup.
> drivers/vhost/vhost.c | 29 +++++++++--------------------
> 1 files changed, 9 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> index 540591b..c5f96ba 100644
> --- a/drivers/vhost/vhost.c
> +++ b/drivers/vhost/vhost.c
> @@ -946,14 +946,16 @@ int vhost_log_write(struct vhost_virtqueue *vq, struct vhost_log *log,
>
> static int vhost_update_used_flags(struct vhost_virtqueue *vq)
> {
> + void __user *used;
> if (put_user(vq->used_flags,&vq->used->flags)< 0)
> return -EFAULT;
> if (unlikely(vq->log_used)) {
> /* Make sure the flag is seen before log. */
> smp_wmb();
> /* Log used flag write. */
> - log_write(vq->log_base,
> - vq->log_addr + offsetof(struct vring_used, flags),
> + used =&vq->used->flags;
> + log_write(vq->log_base, vq->log_addr +
> + (used - (void __user *)vq->used),
> sizeof vq->used->flags);
> if (vq->log_ctx)
> eventfd_signal(vq->log_ctx, 1);
> @@ -966,13 +968,14 @@ static int vhost_update_avail_event(struct vhost_virtqueue *vq, u16 avail_event)
> if (put_user(vq->avail_idx, vhost_avail_event(vq)))
> return -EFAULT;
> if (unlikely(vq->log_used)) {
> + void __user *used;
> /* Make sure the event is seen before log. */
> smp_wmb();
> /* Log avail event write */
> - log_write(vq->log_base,
> - vq->log_addr + offsetof(struct vring_used,
> - ring[vq->num]),
> - sizeof avail_event);
> + used = vhost_avail_event(vq);
> + log_write(vq->log_base, vq->log_addr +
> + (used - (void __user *)vq->used),
> + sizeof *vhost_avail_event(vq));
> if (vq->log_ctx)
> eventfd_signal(vq->log_ctx, 1);
> }
> @@ -1474,20 +1477,6 @@ bool vhost_enable_notify(struct vhost_dev *dev, struct vhost_virtqueue *vq)
> return false;
> }
> }
> - if (unlikely(vq->log_used)) {
> - void __user *used;
> - /* Make sure data is seen before log. */
> - smp_wmb();
> - used = vhost_has_feature(dev, VIRTIO_RING_F_EVENT_IDX) ?
> - &vq->used->flags : vhost_avail_event(vq);
> - /* Log used flags or event index entry write. Both are 16 bit
> - * fields. */
> - log_write(vq->log_base, vq->log_addr +
> - (used - (void __user *)vq->used),
> - sizeof(u16));
> - if (vq->log_ctx)
> - eventfd_signal(vq->log_ctx, 1);
> - }
> /* They could have slipped one in as we were doing that: make
> * sure it's written, then check again. */
> smp_mb();
^ permalink raw reply
* [PATCHv2] sctp: ABORT if receive queue is not empty while closing socket
From: Thomas Graf @ 2011-07-08 10:57 UTC (permalink / raw)
To: Vladislav Yasevich
Cc: netdev, davem, Wei Yongjun, Sridhar Samudrala, linux-sctp
In-Reply-To: <4E0C83FA.2090909@hp.com>
Trigger user ABORT if application closes a socket which has data
queued on the socket receive queue as this would imply data being
lost which defeats the point of a graceful shutdown.
This behavior is already practiced in TCP.
We do not check the input queue because that would mean to parse
all chunks on it to look for unacknowledged data which seems too
much of an effort. Control chunks or duplicated chunks may also
be in the input queue and should not be stopping a graceful
shutdown.
Signed-off-by: Thomas Graf <tgraf@infradead.org>
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 99b027b..ca4693b 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -80,7 +80,7 @@ static inline struct sctp_ulpevent *sctp_skb2event(struct sk_buff *skb)
void sctp_ulpevent_free(struct sctp_ulpevent *);
int sctp_ulpevent_is_notification(const struct sctp_ulpevent *);
-void sctp_queue_purge_ulpevents(struct sk_buff_head *list);
+unsigned int sctp_queue_purge_ulpevents(struct sk_buff_head *list);
struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
const struct sctp_association *asoc,
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 08c6238..17cb3fc 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1384,6 +1384,7 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
struct sctp_endpoint *ep;
struct sctp_association *asoc;
struct list_head *pos, *temp;
+ unsigned int data_was_unread;
SCTP_DEBUG_PRINTK("sctp_close(sk: 0x%p, timeout:%ld)\n", sk, timeout);
@@ -1393,6 +1394,10 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
ep = sctp_sk(sk)->ep;
+ /* Clean up any skbs sitting on the receive queue. */
+ data_was_unread = sctp_queue_purge_ulpevents(&sk->sk_receive_queue);
+ data_was_unread += sctp_queue_purge_ulpevents(&sctp_sk(sk)->pd_lobby);
+
/* Walk all associations on an endpoint. */
list_for_each_safe(pos, temp, &ep->asocs) {
asoc = list_entry(pos, struct sctp_association, asocs);
@@ -1410,7 +1415,8 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
}
}
- if (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime) {
+ if (data_was_unread ||
+ (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime)) {
struct sctp_chunk *chunk;
chunk = sctp_make_abort_user(asoc, NULL, 0);
@@ -1420,10 +1426,6 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
sctp_primitive_SHUTDOWN(asoc, NULL);
}
- /* Clean up any skbs sitting on the receive queue. */
- sctp_queue_purge_ulpevents(&sk->sk_receive_queue);
- sctp_queue_purge_ulpevents(&sctp_sk(sk)->pd_lobby);
-
/* On a TCP-style socket, block for at most linger_time if set. */
if (sctp_style(sk, TCP) && timeout)
sctp_wait_for_close(sk, timeout);
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index e70e5fc..8a84017 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -1081,9 +1081,19 @@ void sctp_ulpevent_free(struct sctp_ulpevent *event)
}
/* Purge the skb lists holding ulpevents. */
-void sctp_queue_purge_ulpevents(struct sk_buff_head *list)
+unsigned int sctp_queue_purge_ulpevents(struct sk_buff_head *list)
{
struct sk_buff *skb;
- while ((skb = skb_dequeue(list)) != NULL)
- sctp_ulpevent_free(sctp_skb2event(skb));
+ unsigned int data_unread = 0;
+
+ while ((skb = skb_dequeue(list)) != NULL) {
+ struct sctp_ulpevent *event = sctp_skb2event(skb);
+
+ if (!sctp_ulpevent_is_notification(event))
+ data_unread += skb->len;
+
+ sctp_ulpevent_free(event);
+ }
+
+ return data_unread;
}
^ permalink raw reply related
* [PATCH] ATM: Delete no use FILL_RX_POOLS_IN_BH marco
From: stufever @ 2011-07-08 13:01 UTC (permalink / raw)
To: netdev; +Cc: Wang Shaoyan, Chas Williams, linux-atm-general
From: Wang Shaoyan <wangshaoyan.pt@taobao.com>
The macro FILL_RX_POOLS_IN_BH is never been used, in order to avoid
the compiler reports error because of the usage of function INIT_WORK,
we just delete the marco.
Cc: Chas Williams <chas@cmf.nrl.navy.mil>
Cc: linux-atm-general@lists.sourceforge.net
Signed-off-by: Wang Shaoyan <wangshaoyan.pt@taobao.com>
---
drivers/atm/ambassador.c | 11 +----------
drivers/atm/ambassador.h | 4 ----
2 files changed, 1 insertions(+), 14 deletions(-)
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index a5fcb1e..bb3b016 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -813,7 +813,7 @@ static void fill_rx_pool (amb_dev * dev, unsigned char pool,
return;
}
-// top up all RX pools (can also be called as a bottom half)
+// top up all RX pools
static void fill_rx_pools (amb_dev * dev) {
unsigned char pool;
@@ -872,11 +872,7 @@ static irqreturn_t interrupt_handler(int irq, void *dev_id) {
++irq_work;
if (irq_work) {
-#ifdef FILL_RX_POOLS_IN_BH
- schedule_work (&dev->bh);
-#else
fill_rx_pools (dev);
-#endif
PRINTD (DBG_IRQ, "work done: %u", irq_work);
} else {
@@ -2154,11 +2150,6 @@ static void setup_dev(amb_dev *dev, struct pci_dev *pci_dev)
dev->tx_avail = ATM_OC3_PCR;
dev->rx_avail = ATM_OC3_PCR;
-#ifdef FILL_RX_POOLS_IN_BH
- // initialise bottom half
- INIT_WORK(&dev->bh, (void (*)(void *)) fill_rx_pools, dev);
-#endif
-
// semaphore for txer/rxer modifications - we cannot use a
// spinlock as the critical region needs to switch processes
mutex_init(&dev->vcc_sf);
diff --git a/drivers/atm/ambassador.h b/drivers/atm/ambassador.h
index bd1c46a..aa97105 100644
--- a/drivers/atm/ambassador.h
+++ b/drivers/atm/ambassador.h
@@ -630,10 +630,6 @@ struct amb_dev {
u32 iobase;
u32 * membase;
-#ifdef FILL_RX_POOLS_IN_BH
- struct work_struct bh;
-#endif
-
amb_cq cq;
amb_txq txq;
amb_rxq rxq[NUM_RX_POOLS];
--
1.7.4.1
^ permalink raw reply related
* Re: [PATCH linux-firmware] bnx2x: Adding FW 7.0.23.0
From: Eilon Greenstein @ 2011-07-08 13:06 UTC (permalink / raw)
To: Ben Hutchings; +Cc: Ariel Elior, dwmw2@infradead.org, netdev@vger.kernel.org
In-Reply-To: <1310088712.4280.67.camel@localhost>
On Thu, 2011-07-07 at 18:31 -0700, Ben Hutchings wrote:
> On Thu, 2011-07-07 at 09:59 +0300, Ariel Elior wrote:
> > On Mon, 2011-07-04 at 19:07 +0300, Ariel Elior wrote:
> > > On Mon, 2011-07-04 at 18:59 +0300, Ariel Elior wrote:
> > > > This FW supports multiple concurrent classes of service in network traffic.
> > > >
> > > > Signed-off-by: Ariel Elior <ariele@broadcom.com>
> > > > Signed-off-by: Eilon Greenstein <eilong@broadcom.com>
> > > > ---
> > > in case you need it, the patch is also available under
> > > http://linux.broadcom.com/eilong/FW-7.0.23.0/0001-bnx2x-Adding-FW-7.0.23.0.patch
> > > thanks,
> > > Ariel
> > David, were you able to obtain the FW?
> > Thanks,
> > Ariel
>
> I also have commit rights to linux-firmware, so if you mail both David
> and me about new firmware then it may be added sooner.
>
> I've applied this now.
>
> Ben.
>
Thanks Ben! That's good to know.
Eilon
^ permalink raw reply
* [PATCH] hso: fix a use after free condition
From: Greg KH @ 2011-07-08 13:45 UTC (permalink / raw)
To: Alan Cox, netdev-u79uwXL29TY76Z2rM5mHXA
Cc: j.dumon-x9gZzRpC1QbQT0dZR+AlfA, linux-usb-u79uwXL29TY76Z2rM5mHXA
This needs to go to netdev:
From: Octavian Purdila <octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
In hso_free_net_device hso_net pointer is freed and then used to
cleanup urb pools. Catched with SLAB_DEBUG during S3 resume:
[ 95.824442] Pid: 389, comm: khubd Tainted: G C 2.6.36greenridge-01400-g423cf13-dirty #154 Type2 - Board Product Name1/OakTrail
[ 95.824442] EIP: 0060:[<c1151551>] EFLAGS: 00010202 CPU: 0
[ 95.824442] EIP is at kref_put+0x29/0x42
[ 95.824442] EAX: 6b6b6b6b EBX: 6b6b6b6b ECX: c2806b40 EDX: 00000037
[ 95.824442] ESI: c1258d56 EDI: edd3d128 EBP: ee8cde0c ESP: ee8cde04
[ 95.824442] DS: 007b ES: 007b FS: 00d8 GS: 0000 SS: 0068
[ 95.824442] Process khubd (pid: 389, ti=ee8cc000 task=ee95ed10 task.ti=ee8cc000)
[ 95.824442] Stack:
[ 95.824442] edd07020 00000000 ee8cde14 c1258b77 ee8cde38 ef933a44 ef93572b ef935dec
[ 95.824442] <0> 0000099a 6b6b6b6b 00000000 ee2da748 edd3e0c0 ee8cde54 ef933b9f ee3b53f8
[ 95.824442] <0> 00000002 ee2da748 ee2da764 ef936658 ee8cde60 ef933d0c ee2da748 ee8cde84
[ 95.824442] Call Trace:
[ 95.824442] [<c1258b77>] ? usb_free_urb+0x11/0x13
[ 95.824442] [<ef933a44>] ? hso_free_net_device+0x81/0xd8 [hso]
[ 95.824442] [<ef933b9f>] ? hso_free_interface+0x104/0x111 [hso]
[ 95.824442] [<ef933d0c>] ? hso_disconnect+0xb/0x18 [hso]
[ 95.824442] [<c125b7f1>] ? usb_unbind_interface+0x44/0x14a
[ 95.824442] [<c11e56e8>] ? __device_release_driver+0x6f/0xb1
[ 95.824442] [<c11e57c7>] ? device_release_driver+0x18/0x23
[ 95.824442] [<c11e4e92>] ? bus_remove_device+0x8a/0xa1
[ 95.824442] [<c11e3970>] ? device_del+0x129/0x163
[ 95.824442] [<c11e2dc0>] ? put_device+0xf/0x11
[ 95.824442] [<c11e39bc>] ? device_unregister+0x12/0x15
[ 95.824442] [<c125915f>] ? usb_disable_device+0x90/0xf0
[ 95.824442] [<c125544f>] ? usb_disconnect+0x6d/0xf8
[ 95.824442] [<c1255f91>] ? hub_thread+0x3fc/0xc57
[ 95.824442] [<c1048526>] ? autoremove_wake_function+0x0/0x2f
[ 95.824442] [<c102529d>] ? complete+0x34/0x3e
[ 95.824442] [<c1255b95>] ? hub_thread+0x0/0xc57
[ 95.824442] [<c10481fc>] ? kthread+0x63/0x68
[ 95.824442] [<c1048199>] ? kthread+0x0/0x68
[ 95.824442] [<c1002d76>] ? kernel_thread_helper+0x6/0x10
Signed-off-by: Octavian Purdila <octavian.purdila-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Signed-off-by: Alan Cox <alan-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
---
drivers/net/usb/hso.c | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/net/usb/hso.c b/drivers/net/usb/hso.c
index 387ca43..304fe78 100644
--- a/drivers/net/usb/hso.c
+++ b/drivers/net/usb/hso.c
@@ -2421,10 +2421,8 @@ static void hso_free_net_device(struct hso_device *hso_dev)
remove_net_device(hso_net->parent);
- if (hso_net->net) {
+ if (hso_net->net)
unregister_netdev(hso_net->net);
- free_netdev(hso_net->net);
- }
/* start freeing */
for (i = 0; i < MUX_BULK_RX_BUF_COUNT; i++) {
@@ -2436,6 +2434,9 @@ static void hso_free_net_device(struct hso_device *hso_dev)
kfree(hso_net->mux_bulk_tx_buf);
hso_net->mux_bulk_tx_buf = NULL;
+ if (hso_net->net)
+ free_netdev(hso_net->net);
+
kfree(hso_dev);
}
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
----- End forwarded message -----
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related
* Re: [PATCHv2] sctp: ABORT if receive queue is not empty while closing socket
From: Vladislav Yasevich @ 2011-07-08 13:49 UTC (permalink / raw)
To: netdev, davem, Wei Yongjun, Sridhar Samudrala, linux-sctp
In-Reply-To: <20110708105705.GA14583@canuck.infradead.org>
On 07/08/2011 06:57 AM, Thomas Graf wrote:
> Trigger user ABORT if application closes a socket which has data
> queued on the socket receive queue as this would imply data being
> lost which defeats the point of a graceful shutdown.
>
> This behavior is already practiced in TCP.
>
> We do not check the input queue because that would mean to parse
> all chunks on it to look for unacknowledged data which seems too
> much of an effort. Control chunks or duplicated chunks may also
> be in the input queue and should not be stopping a graceful
> shutdown.
I think you need to check the ulpq as well.
It is possible to have a condition where you only have data
in the ulpq (imagine a few lost out of order packets or a few lost
fragments from very large messages). In those circumstances, either fragmentation
or ordering queues may consume all of the window (especially if the buffer was
set small) and you would never trigger the abort.
Since there would never be any notifications in the ulpq (just data), you can
simply use skb_queue_empty() call.
-vlad
>
> Signed-off-by: Thomas Graf <tgraf@infradead.org>
>
> diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
> index 99b027b..ca4693b 100644
> --- a/include/net/sctp/ulpevent.h
> +++ b/include/net/sctp/ulpevent.h
> @@ -80,7 +80,7 @@ static inline struct sctp_ulpevent *sctp_skb2event(struct sk_buff *skb)
>
> void sctp_ulpevent_free(struct sctp_ulpevent *);
> int sctp_ulpevent_is_notification(const struct sctp_ulpevent *);
> -void sctp_queue_purge_ulpevents(struct sk_buff_head *list);
> +unsigned int sctp_queue_purge_ulpevents(struct sk_buff_head *list);
>
> struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
> const struct sctp_association *asoc,
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 08c6238..17cb3fc 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
> @@ -1384,6 +1384,7 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
> struct sctp_endpoint *ep;
> struct sctp_association *asoc;
> struct list_head *pos, *temp;
> + unsigned int data_was_unread;
>
> SCTP_DEBUG_PRINTK("sctp_close(sk: 0x%p, timeout:%ld)\n", sk, timeout);
>
> @@ -1393,6 +1394,10 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
>
> ep = sctp_sk(sk)->ep;
>
> + /* Clean up any skbs sitting on the receive queue. */
> + data_was_unread = sctp_queue_purge_ulpevents(&sk->sk_receive_queue);
> + data_was_unread += sctp_queue_purge_ulpevents(&sctp_sk(sk)->pd_lobby);
> +
> /* Walk all associations on an endpoint. */
> list_for_each_safe(pos, temp, &ep->asocs) {
> asoc = list_entry(pos, struct sctp_association, asocs);
> @@ -1410,7 +1415,8 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
> }
> }
>
> - if (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime) {
> + if (data_was_unread ||
> + (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime)) {
> struct sctp_chunk *chunk;
>
> chunk = sctp_make_abort_user(asoc, NULL, 0);
> @@ -1420,10 +1426,6 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
> sctp_primitive_SHUTDOWN(asoc, NULL);
> }
>
> - /* Clean up any skbs sitting on the receive queue. */
> - sctp_queue_purge_ulpevents(&sk->sk_receive_queue);
> - sctp_queue_purge_ulpevents(&sctp_sk(sk)->pd_lobby);
> -
> /* On a TCP-style socket, block for at most linger_time if set. */
> if (sctp_style(sk, TCP) && timeout)
> sctp_wait_for_close(sk, timeout);
> diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
> index e70e5fc..8a84017 100644
> --- a/net/sctp/ulpevent.c
> +++ b/net/sctp/ulpevent.c
> @@ -1081,9 +1081,19 @@ void sctp_ulpevent_free(struct sctp_ulpevent *event)
> }
>
> /* Purge the skb lists holding ulpevents. */
> -void sctp_queue_purge_ulpevents(struct sk_buff_head *list)
> +unsigned int sctp_queue_purge_ulpevents(struct sk_buff_head *list)
> {
> struct sk_buff *skb;
> - while ((skb = skb_dequeue(list)) != NULL)
> - sctp_ulpevent_free(sctp_skb2event(skb));
> + unsigned int data_unread = 0;
> +
> + while ((skb = skb_dequeue(list)) != NULL) {
> + struct sctp_ulpevent *event = sctp_skb2event(skb);
> +
> + if (!sctp_ulpevent_is_notification(event))
> + data_unread += skb->len;
> +
> + sctp_ulpevent_free(event);
> + }
> +
> + return data_unread;
> }
>
^ permalink raw reply
* Re: [PATCHv2] sctp: ABORT if receive queue is not empty while closing socket
From: Thomas Graf @ 2011-07-08 14:29 UTC (permalink / raw)
To: Vladislav Yasevich
Cc: netdev, davem, Wei Yongjun, Sridhar Samudrala, linux-sctp
In-Reply-To: <4E170B00.9080406@hp.com>
On Fri, Jul 08, 2011 at 09:49:52AM -0400, Vladislav Yasevich wrote:
> On 07/08/2011 06:57 AM, Thomas Graf wrote:
> > Trigger user ABORT if application closes a socket which has data
> > queued on the socket receive queue as this would imply data being
> > lost which defeats the point of a graceful shutdown.
> >
> > This behavior is already practiced in TCP.
> >
> > We do not check the input queue because that would mean to parse
> > all chunks on it to look for unacknowledged data which seems too
> > much of an effort. Control chunks or duplicated chunks may also
> > be in the input queue and should not be stopping a graceful
> > shutdown.
>
> I think you need to check the ulpq as well.
>
> It is possible to have a condition where you only have data
> in the ulpq (imagine a few lost out of order packets or a few lost
> fragments from very large messages). In those circumstances, either fragmentation
> or ordering queues may consume all of the window (especially if the buffer was
> set small) and you would never trigger the abort.
Good point. Updating the patch.
^ permalink raw reply
* [PATCHv3] sctp: ABORT if receive, reassmbly, or reodering queue is not empty while closing socket
From: Thomas Graf @ 2011-07-08 14:37 UTC (permalink / raw)
To: Vladislav Yasevich
Cc: netdev, davem, Wei Yongjun, Sridhar Samudrala, linux-sctp
In-Reply-To: <4E170B00.9080406@hp.com>
Trigger user ABORT if application closes a socket which has data
queued on the socket receive queue or chunks waiting on the
reassembly or ordering queue as this would imply data being lost
which defeats the point of a graceful shutdown.
This behavior is already practiced in TCP.
We do not check the input queue because that would mean to parse
all chunks on it to look for unacknowledged data which seems too
much of an effort. Control chunks or duplicated chunks may also
be in the input queue and should not be stopping a graceful
shutdown.
Signed-off-by: Thomas Graf <tgraf@infradead.org>
diff --git a/include/net/sctp/ulpevent.h b/include/net/sctp/ulpevent.h
index 99b027b..ca4693b 100644
--- a/include/net/sctp/ulpevent.h
+++ b/include/net/sctp/ulpevent.h
@@ -80,7 +80,7 @@ static inline struct sctp_ulpevent *sctp_skb2event(struct sk_buff *skb)
void sctp_ulpevent_free(struct sctp_ulpevent *);
int sctp_ulpevent_is_notification(const struct sctp_ulpevent *);
-void sctp_queue_purge_ulpevents(struct sk_buff_head *list);
+unsigned int sctp_queue_purge_ulpevents(struct sk_buff_head *list);
struct sctp_ulpevent *sctp_ulpevent_make_assoc_change(
const struct sctp_association *asoc,
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index 08c6238..d3ccf79 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -1384,6 +1384,7 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
struct sctp_endpoint *ep;
struct sctp_association *asoc;
struct list_head *pos, *temp;
+ unsigned int data_was_unread;
SCTP_DEBUG_PRINTK("sctp_close(sk: 0x%p, timeout:%ld)\n", sk, timeout);
@@ -1393,6 +1394,10 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
ep = sctp_sk(sk)->ep;
+ /* Clean up any skbs sitting on the receive queue. */
+ data_was_unread = sctp_queue_purge_ulpevents(&sk->sk_receive_queue);
+ data_was_unread += sctp_queue_purge_ulpevents(&sctp_sk(sk)->pd_lobby);
+
/* Walk all associations on an endpoint. */
list_for_each_safe(pos, temp, &ep->asocs) {
asoc = list_entry(pos, struct sctp_association, asocs);
@@ -1410,7 +1415,9 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
}
}
- if (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime) {
+ if (data_was_unread || !skb_queue_empty(&asoc->ulpq.lobby) ||
+ !skb_queue_empty(&asoc->ulpq.reasm) ||
+ (sock_flag(sk, SOCK_LINGER) && !sk->sk_lingertime)) {
struct sctp_chunk *chunk;
chunk = sctp_make_abort_user(asoc, NULL, 0);
@@ -1420,10 +1427,6 @@ SCTP_STATIC void sctp_close(struct sock *sk, long timeout)
sctp_primitive_SHUTDOWN(asoc, NULL);
}
- /* Clean up any skbs sitting on the receive queue. */
- sctp_queue_purge_ulpevents(&sk->sk_receive_queue);
- sctp_queue_purge_ulpevents(&sctp_sk(sk)->pd_lobby);
-
/* On a TCP-style socket, block for at most linger_time if set. */
if (sctp_style(sk, TCP) && timeout)
sctp_wait_for_close(sk, timeout);
diff --git a/net/sctp/ulpevent.c b/net/sctp/ulpevent.c
index e70e5fc..8a84017 100644
--- a/net/sctp/ulpevent.c
+++ b/net/sctp/ulpevent.c
@@ -1081,9 +1081,19 @@ void sctp_ulpevent_free(struct sctp_ulpevent *event)
}
/* Purge the skb lists holding ulpevents. */
-void sctp_queue_purge_ulpevents(struct sk_buff_head *list)
+unsigned int sctp_queue_purge_ulpevents(struct sk_buff_head *list)
{
struct sk_buff *skb;
- while ((skb = skb_dequeue(list)) != NULL)
- sctp_ulpevent_free(sctp_skb2event(skb));
+ unsigned int data_unread = 0;
+
+ while ((skb = skb_dequeue(list)) != NULL) {
+ struct sctp_ulpevent *event = sctp_skb2event(skb);
+
+ if (!sctp_ulpevent_is_notification(event))
+ data_unread += skb->len;
+
+ sctp_ulpevent_free(event);
+ }
+
+ return data_unread;
}
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox