* Re: [INET]: Prevent out-of-sync truesize on ip_fragment slow path
From: David Miller @ 2008-01-29 4:45 UTC (permalink / raw)
To: herbert; +Cc: netdev
In-Reply-To: <20080128111259.GA6490@gondor.apana.org.au>
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Mon, 28 Jan 2008 22:12:59 +1100
> Hi:
>
> [INET]: Prevent out-of-sync truesize on ip_fragment slow path
>
> When ip_fragment has to hit the slow path the value of skb->truesize
> may go out of sync because we would have updated it without changing
> the packet length. This violates the constraints on truesize.
>
> This patch postpones the update of skb->truesize to prevent this.
>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Applied, I'll queue this up for 2.6.24-stable too.
^ permalink raw reply
* Re: [PATCH][INET_DIAG]: Fix inet_diag_lock_handler error path
From: David Miller @ 2008-01-29 4:52 UTC (permalink / raw)
To: herbert; +Cc: acme, spike, netdev, stable
In-Reply-To: <20080128110310.GA6305@gondor.apana.org.au>
From: Herbert Xu <herbert@gondor.apana.org.au>
Date: Mon, 28 Jan 2008 22:03:10 +1100
> On Mon, Jan 28, 2008 at 12:20:50AM -0200, Arnaldo Carvalho de Melo wrote:
> > Fixes: http://bugzilla.kernel.org/show_bug.cgi?id=9825
> >
> > The inet_diag_lock_handler function uses ERR_PTR to encode errors but
> > its callers were testing against NULL.
>
> Thanks for catching this Arnaldo!
Applied and queued up for 2.6.24-stable, thanks!
^ permalink raw reply
* Re: [PATCHv2 2.6.24] fib: fix route replacement, fib_info is shared
From: David Miller @ 2008-01-29 5:14 UTC (permalink / raw)
To: ja; +Cc: netdev, joonwpark81
In-Reply-To: <Pine.LNX.4.58.0801261439020.7864@u.domain.uli>
From: Julian Anastasov <ja@ssi.bg>
Date: Sat, 26 Jan 2008 14:41:32 +0200 (EET)
>
> fib_info can be shared by many route prefixes but we don't
> want duplicate alternative routes for a prefix+tos+priority. Last
> change was not correct to check fib_treeref because it accounts usage
> from other prefixes. Additionally, avoid replacement without error
> if new route is same, as Joonwoo Park suggests.
>
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
Applied, thank you.
^ permalink raw reply
* Re: [PATCHv2 2.6.24] fib_trie: apply fixes from fib_hash
From: David Miller @ 2008-01-29 5:18 UTC (permalink / raw)
To: ja; +Cc: robert.olsson, netdev, joonwpark81
In-Reply-To: <Pine.LNX.4.58.0801261441470.7864@u.domain.uli>
From: Julian Anastasov <ja@ssi.bg>
Date: Sat, 26 Jan 2008 14:44:36 +0200 (EET)
>
> Update fib_trie with some fib_hash fixes:
> - check for duplicate alternative routes for prefix+tos+priority when
> replacing route
> - properly insert by matching tos together with priority
> - fix alias walking to use list_for_each_entry_continue for insertion
> and deletion when fa_head is not NULL
> - copy state from fa to new_fa on replace (not a problem for now)
> - additionally, avoid replacement without error if new route is same,
> as Joonwoo Park suggests.
>
> Signed-off-by: Julian Anastasov <ja@ssi.bg>
Also applied, thanks a lot.
^ permalink raw reply
* Feel more pleasure in love!
From: drandsu @ 2008-01-29 5:25 UTC (permalink / raw)
To: netdev
Join the world of boundless enjoyments! http://uiwm.measureremember.com
^ permalink raw reply
* Re: [PATCH net-2.6.25 4/7][ATM]: [br2864] routed support
From: Chung-Chi Lo @ 2008-01-29 7:42 UTC (permalink / raw)
To: chas3; +Cc: netdev, davem
In-Reply-To: <200801261220.m0QCKJ15023510@cmf.nrl.navy.mil>
On Jan 26, 2008 8:20 PM, chas williams - CONTRACTOR
<chas@cmf.nrl.navy.mil> wrote:
> In message <3f696b20801152016r52048016g7c293dbfdc6c9f29@mail.gmail.com>,"Chung-
> Chi Lo" writes:
> >By the way, this routed mode patch doesn't include encaps=VCMUX and
> >RFC2684 routed
> >protocol decapsulation?
>
> yep. eric believes the following should fix both problems:
>
> commit 43e4b025ffe130cd6a292fa9ff909e39a88f849c
> Author: Chas Williams - CONTRACTOR <chas@relax.cmf.nrl.navy.mil>
> Date: Sat Jan 26 07:18:26 2008 -0500
>
> [ATM]: [br2864] fix vcmux support
>
> From: Eric Kinzie <ekinzie@cmf.nrl.navy.mil>
> Signed-off-by: Chas Williams <chas@cmf.nrl.navy.mil>
>
> diff --git a/net/atm/br2684.c b/net/atm/br2684.c
> index 31347cb..97b422c 100644
> --- a/net/atm/br2684.c
> +++ b/net/atm/br2684.c
> @@ -400,15 +400,20 @@ static void br2684_push(struct atm_vcc *atmvcc, struct sk_buff *skb)
> return;
> }
>
> - } else {
> - /* first 2 chars should be 0 */
> - if (*((u16 *) (skb->data)) != 0) {
> - brdev->stats.rx_errors++;
> - dev_kfree_skb(skb);
> - return;
> + } else { /* vc-mux */
> + if (brdev->payload == p_routed) {
add line
skb->protocol = __constant_htons(ETH_P_IP);
here just like LLC did?
> + skb_reset_network_header(skb);
> + skb->pkt_type = PACKET_HOST;
> + } else { /* p_bridged */
> + /* first 2 chars should be 0 */
> + if (*((u16 *) (skb->data)) != 0) {
> + brdev->stats.rx_errors++;
> + dev_kfree_skb(skb);
> + return;
> + }
> + skb_pull(skb, BR2684_PAD_LEN);
> + skb->protocol = eth_type_trans(skb, net_dev);
> }
> - skb_pull(skb, BR2684_PAD_LEN + ETH_HLEN); /* pad, dstmac, srcmac, ethtype */
> - skb->protocol = eth_type_trans(skb, net_dev);
> }
>
Also have a problem when encapsulation is VCMUX and routed mode, in
/*
@@ -136,6 +156,7 @@ static int br2684_xmit_vcc(struct sk_buff *skb,
struct br2684_dev *brdev,
{
..
..
+ if (brvcc->encaps == e_llc) {
..
+ } else {
+ skb_push(skb, 2);
+ if (brdev->payload == p_bridged)
+ memset(skb->data, 0, 2);
+ }
Here should be
} else {
if (brdev->payload == p_bridged) {
skb_push(skb, 2);
memset(skb->data, 0, 2);
}
}
Because VCMUX and routed mode doesn't need two bytes in header.
--
Lino, Chung-Chi Lo
^ permalink raw reply
* Re: ipcomp regression in 2.6.24
From: Marco Berizzi @ 2008-01-29 8:07 UTC (permalink / raw)
To: Beschorner Daniel; +Cc: netdev
In-Reply-To: <3C59DB883F7B0B4D8096010D45ACCD134F2086@exch.facton.local>
Beschorner Daniel wrote:
> Has someone an idea which patch could have damaged ipcomp?
>
> Daniel
>
> > With 2.6.24 IPSEC/ESP tunnels to older kernels establish fine, data
> > flows in both directions, but no data comes out of the tunnel.
> > Needed to disable ipcomp.
Same problem here: linux 2.6.24 driven by openswan 2.4.11
on Slackware 11.0
^ permalink raw reply
* Re: [PATCHv2 2.6.24] fib: fix route replacement, fib_info is shared
From: Jarek Poplawski @ 2008-01-29 8:49 UTC (permalink / raw)
To: Julian Anastasov; +Cc: David S. Miller, netdev, Joonwoo Park
In-Reply-To: <Pine.LNX.4.58.0801290139450.3181@u.domain.uli>
On Tue, Jan 29, 2008 at 02:30:47AM +0200, Julian Anastasov wrote:
>
> Hello,
>
> On Mon, 28 Jan 2008, Jarek Poplawski wrote:
>
> > BTW, the way "add" works wasn't questioned now, but it seems could be,
> > or man ip should call it e.g. "ip route add - add new destination",
> > and append "ip route append" (unless I have old man).
>
> "add" is similar to "prepend", only that checks NLM_F_EXCL
> to avoid many alternative routes, only one route for tos+priority is
> allowed for "add". As for the sorting by tos/priority and the
> insertion position I remember for thread on this issue:
Yes but I've meant this man (8) ip description could be confusing:
" ip route add - add new route
ip route change - change route
ip route replace - change or add new one"
One can wonder why there is an error while adding two new routes with
"add", but OK to do the same with "replace". But, it's "man" problem
of course.
>
> http://marc.info/?t=109614290600002&r=1&w=2
>
> > > + fa = list_entry(fa->fa_list.prev, struct fib_alias, fa_list);
> > > + list_for_each_entry_continue(fa, &f->fn_alias, fa_list) {
> > > + if (fa->fa_tos != tos)
> > > + break;
> > > + if (fa->fa_info->fib_priority != fi->fib_priority)
> > > + break;
> > > + if (fa->fa_type == cfg->fc_type &&
> > > + fa->fa_scope == cfg->fc_scope &&
> > > + fa->fa_info == fi) {
> > > + fa_match = fa;
> > > + break;
> >
> > Why can't we try goto out from here? (less reading...)
>
> The case with NLM_F_REPLACE needs to check more things, one
> day one can combine NLM_F_APPEND+NLM_F_REPLACE to replace last
> alternative route, not only the first one as currently implemented.
I'm not sure I can understand your point: do you mean there could be
something to do for these options is fa_match exists? But, maybe it
relates to my question below...
>
> > > + fa = fa_first;
> > > + if (fa_match) {
> > > + if (fa == fa_match)
> > > + err = 0;
> >
> > Could you comment more why returning an error seems to depend on the
> > order of aliases here? But, IMHO there is no reason to change the old
> > behavior WRT this error, so probably this err = 0 should be always if
> > NLM_F_REPLACE is set.
>
> fa_match is some existing alias that matches all new parameters.
> As NLM_F_REPLACE changes the first alternative route for
> tos+priority if fa_match == fa_first (we are replacing alias that
> matches all parameters) we return 0, only that routing cache is not
> flushed - nothing is replaced/changed. So, "fa == fa_match" means
> "replace will not change existing parameters", return 0 as this is
> not an error.
Probably I miss something, but what parameters do we change if
(fa_match) && (fa != fa_match)? Isn't this "goto out" in any case?
>
> > PS: I think, this FIB info you sent earlier is just fine for
> > Documentation/networking without any changes! (Maybe one more patch?)
>
> This is so small part of the picture, such 15-minute listing
> is not enough to explain everything. May be such and other information
> can be added as part of some known documentation.
This is small but condensed, and IMHO it fits very well what is now
in this directory.
Thanks,
Jarek P.
^ permalink raw reply
* [PATCH] Add another Prism2 card to hostap
From: Marcin Juszkiewicz @ 2008-01-29 8:42 UTC (permalink / raw)
To: linux-wireless-u79uwXL29TY76Z2rM5mHXA
Cc: Jouni Malinen, Pavel Roskin, netdev-u79uwXL29TY76Z2rM5mHXA
From: Marcin Juszkiewicz <openembedded-sbG99h22wavzs492ZWNkEA@public.gmane.org>
Card reported by Ångström user:
http://bugs.openembedded.net/show_bug.cgi?id=3236
Socket 1:
product info: "Wireless LAN", "11Mbps PC Card", "Version 01.02", ""
manfid: 0x0156, 0x0002
function: 6 (network)
Signed-off-by: Marcin Juszkiewicz <openembedded-sbG99h22wavzs492ZWNkEA@public.gmane.org>
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index 877d3bd..4f6707c 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -894,6 +894,9 @@ static struct pcmcia_device_id hostap_cs_ids[] = {
"The Linksys Group, Inc.", "Wireless Network CF Card", "ISL37300P",
"RevA",
0xa5f472c2, 0x9c05598d, 0xc9049a39, 0x57a66194),
+ PCMCIA_DEVICE_PROD_ID123(
+ "Wireless LAN" , "11Mbps PC Card", "Version 01.02",
+ 0x4b8870ff, 0x70e946d1, 0x4b74baa0),
PCMCIA_DEVICE_NULL
};
MODULE_DEVICE_TABLE(pcmcia, hostap_cs_ids);
--
JID: hrw-jabber.org
OpenEmbedded developer/consultant
Computers are not intelligent. They only think they are.
^ permalink raw reply related
* Re: [PATCHv2 2.6.24] fib: fix route replacement, fib_info is shared
From: Jarek Poplawski @ 2008-01-29 9:10 UTC (permalink / raw)
To: Julian Anastasov; +Cc: David S. Miller, netdev, Joonwoo Park
In-Reply-To: <20080129084915.GA1624@ff.dom.local>
On Tue, Jan 29, 2008 at 09:49:15AM +0100, Jarek Poplawski wrote:
> On Tue, Jan 29, 2008 at 02:30:47AM +0200, Julian Anastasov wrote:
...
> > fa_match is some existing alias that matches all new parameters.
> > As NLM_F_REPLACE changes the first alternative route for
> > tos+priority if fa_match == fa_first (we are replacing alias that
> > matches all parameters) we return 0, only that routing cache is not
> > flushed - nothing is replaced/changed. So, "fa == fa_match" means
> > "replace will not change existing parameters", return 0 as this is
> > not an error.
>
> Probably I miss something, but what parameters do we change if
> (fa_match) && (fa != fa_match)? Isn't this "goto out" in any case?
OOPS! You mean change is needed, but we can't do this! (I'm so slow...)
All correct!
Thanks again,
Jarek P.
^ permalink raw reply
* Re: [PATCHv2 2.6.24] fib: fix route replacement, fib_info is shared
From: Jarek Poplawski @ 2008-01-29 9:52 UTC (permalink / raw)
To: Julian Anastasov; +Cc: David S. Miller, netdev, Joonwoo Park
In-Reply-To: <20080129091030.GB1624@ff.dom.local>
On Tue, Jan 29, 2008 at 10:10:30AM +0100, Jarek Poplawski wrote:
> On Tue, Jan 29, 2008 at 09:49:15AM +0100, Jarek Poplawski wrote:
> > On Tue, Jan 29, 2008 at 02:30:47AM +0200, Julian Anastasov wrote:
> ...
> > > fa_match is some existing alias that matches all new parameters.
> > > As NLM_F_REPLACE changes the first alternative route for
> > > tos+priority if fa_match == fa_first (we are replacing alias that
> > > matches all parameters) we return 0, only that routing cache is not
> > > flushed - nothing is replaced/changed. So, "fa == fa_match" means
> > > "replace will not change existing parameters", return 0 as this is
> > > not an error.
> >
> > Probably I miss something, but what parameters do we change if
> > (fa_match) && (fa != fa_match)? Isn't this "goto out" in any case?
>
> OOPS! You mean change is needed, but we can't do this! (I'm so slow...)
...On the other hand, I wonder how bad would be switching these two
to avoid this error? After all "replace" with this "add or change"
meaning looks quite permissive, and after all it was used before with
no such errors, so, even if correct, it could still break some
scripts...
Jarek P.
^ permalink raw reply
* Re: Udev coldplugging loads 8139too driver instead of 8139cp
From: Michael Tokarev @ 2008-01-29 10:43 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: netdev, linux-kernel
In-Reply-To: <20080128170830.6f67fa5a@deepthought>
Stephen Hemminger wrote:
> On Tue, 29 Jan 2008 03:46:08 +0300
> Michael Tokarev <mjt@tls.msk.ru> wrote:
[]
>> There are 2 drivers for 8139-based NICs. For really different two kinds
>> of hardware, which both uses the same PCI identifiers. Both drivers
>> "claims" to work with all NICs with those PCI ids, because "externally"
>> (by means of udev for example) it's impossible to distinguish the two
>> kinds of hardware, it becomes clean only when the driver (either of the
>> two) loads and actually checks which hardware we have here.
>
> Is there any chance of using subdevice or subversion to tell them apart?
> That worked for other vendors like DLINK who slapped same ID on different
> cards.
If it were that simple... ;)
No. The difference is in PCI revision number (byte #8 in PCI config space).
If it's >= 0x40 - it's 8139too, < 0x40 - 8139cp. Or 0x20 - I forgot.
Here's a code snippet from a shell script I used ages ago to automatically
load modules (similar to what udev does nowadays):
# special hack for 8139{too,cp} stuff
case "$modalias" in
*v000010ECd00008139*)
rev="$(dd if="$1/config" bs=1 skip=8 count=1 2>/dev/null)"
if [ -n "$rev" ]; then
list=
for module in $modlist; do
case "$module" in
8139cp)
if [ ".$rev" \< ". " ]; then
$vecho1 "$TAG: not loading $module for this device"
continue
fi
;;
8139too)
if [ ".$rev" \> ". " ]; then
$vecho1 "$TAG: not loading $module for this device"
continue
fi
;;
esac
list="$list $module"
done
modlist="$list"
fi
;;
esac
/mjt
^ permalink raw reply
* [PATCH net-2.6.25] [NETNS] change net/Kconfig to avoid a broken build when building with network namesapce support.
From: Rami Rosen @ 2008-01-29 10:53 UTC (permalink / raw)
To: David Miller; +Cc: netdev
[-- Attachment #1: Type: text/plain, Size: 1033 bytes --]
Hi,
The build is broken with the following kernel configuration:
- net-2.6.25
- Support for network namespaces enabled (CONFIG_NET_NS=y)
- CONFIG_RCU_TRACE=y
CONFIG_RCU_TRACE can be set by:
make menuconfig ->Processor type and features->Enable tracing for RCU.
- The error in build is :
fs/built-in.o: In function `debugfs_init':
/work/src/netGit2.6.25/2.6.25/fs/debugfs/inode.c:435: undefined
reference to `kernel_kobj'
make: *** [.tmp_vmlinux1] Error 1
The reason is : RCU_TRACE selects DEBUG_FS,
but CONFIG_NET_NS depends on EXPERIMENTAL && !SYSFS;
debugfs can't be built without sysfs.
There is currently a bit of mess with SYSFS and in fact it seems that
maybe selecting DEBUG_FS
should depend on SYSFS; to avoid this problem in the build,
this patch adds !DEBUG_FS to CONFIG_NET_NS dependencies in net/Kconfig.
This way, if CONFIG_RCU_TRACE is set, ( or other configuration items which
selects DEBUG_FS), we cannot set CONFIG_NET_NS.
Regards,
Rami Rosen
Signed-off-by: Rami Rosen <ramirose@gmail.com>
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 397 bytes --]
diff --git a/net/Kconfig b/net/Kconfig
index b6a5d45..82337e2 100644
--- a/net/Kconfig
+++ b/net/Kconfig
@@ -30,7 +30,7 @@ menu "Networking options"
config NET_NS
bool "Network namespace support"
default n
- depends on EXPERIMENTAL && !SYSFS
+ depends on EXPERIMENTAL && !SYSFS && !DEBUG_FS
help
Allow user space to create what appear to be multiple instances
of the network stack.
^ permalink raw reply related
* [PATCH] bfin_mac: Fix MDIO clock frequency
From: Kalle Pokki @ 2008-01-29 12:27 UTC (permalink / raw)
To: netdev, Bryan Wu
The clock divisor is set to all ones at reset.
---
drivers/net/bfin_mac.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index eb97175..c199633 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -425,7 +425,7 @@ static int mii_probe(struct net_device *dev)
/* MDC = 2.5 MHz */
sysctl = bfin_read_EMAC_SYSCTL();
- sysctl |= SET_MDCDIV(24);
+ sysctl = (sysctl & ~MDCDIV) | SET_MDCDIV(24);
bfin_write_EMAC_SYSCTL(sysctl);
/* search for connect PHY device */
--
1.4.4.2
^ permalink raw reply related
* [PATCH] bfin_mac: Make the MDIO polling faster
From: Kalle Pokki @ 2008-01-29 12:28 UTC (permalink / raw)
To: netdev, Bryan Wu
The poll routine always got 10 ms penalty when called immediately
after starting the transfer. The MDIO transfer takes 25.6 us at the
nominal 2.5 MHz, so MAX_TIMEOUT_CNT being 500 is still big enough.
---
drivers/net/bfin_mac.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c
index c199633..d2e6813 100644
--- a/drivers/net/bfin_mac.c
+++ b/drivers/net/bfin_mac.c
@@ -296,7 +296,7 @@ static void mdio_poll(void)
/* poll the STABUSY bit */
while ((bfin_read_EMAC_STAADD()) & STABUSY) {
- mdelay(10);
+ udelay(1);
if (timeout_cnt-- < 0) {
printk(KERN_ERR DRV_NAME
": wait MDC/MDIO transaction to complete timeout\n");
--
1.4.4.2
^ permalink raw reply related
* Re: [PATCH 2/2] [NETFILTER] nf_conntrack_core: kill unused static inline (do_iter)
From: Patrick McHardy @ 2008-01-29 13:41 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: netfilter-devel, David Miller, netdev
In-Reply-To: <12013009401505-git-send-email-ilpo.jarvinen@helsinki.fi>
Ilpo Järvinen wrote:
> From: =?ISO-8859-1?q?Ilpo=20J=E4rvinen?= <ilpo.jarvinen@helsinki.fi>
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
> ---
> net/netfilter/nf_conntrack_core.c | 8 --------
> 1 files changed, 0 insertions(+), 8 deletions(-)
Applied.
-
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply
* Re: [PATCH 1/2] [NETFILTER] ipt_CLUSTERIP: kill clusterip_config_entry_get
From: Patrick McHardy @ 2008-01-29 13:40 UTC (permalink / raw)
To: Ilpo Järvinen; +Cc: netfilter-devel, David Miller, netdev
In-Reply-To: <12013009403114-git-send-email-ilpo.jarvinen@helsinki.fi>
Ilpo Järvinen wrote:
> From: =?ISO-8859-1?q?Ilpo=20J=E4rvinen?= <ilpo.jarvinen@helsinki.fi>
>
> It's unused static inline.
>
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
Applied, thanks.
^ permalink raw reply
* pppoe, /proc/net/pppoe wrong (extra entries)
From: Denys Fedoryshchenko @ 2008-01-29 14:36 UTC (permalink / raw)
To: netdev; +Cc: paulus, mostrows
Hi again
I notice strange thing, with /proc/net/pppoe, not sure if it is bug, but for
me it looks wrong.
cat /proc/net/pppoe
there is normal entries of users, but at the end i have
....
00000D00 00:16:D3:0B:F9:34 eth1
00004000 00:50:22:00:1C:FC eth1
00007E00 00:03:47:BD:34:25 eth1
00007E00 00:03:47:BD:34:25 eth1
00007E00 00:03:47:BD:34:25 eth1
00007E00 00:03:47:BD:34:25 eth1
00007E00 00:03:47:BD:34:25 eth1
....
and last entry duplicates till end.
i have script to get customers interfaces, so i am using it to calculate
amount of users logged in
defaulthost ~ #cat /proc/net/pppoe |grep -i '00:03:47:BD:34:25'|wc -l
40
defaulthost ~ #cat /proc/net/pppoe |wc -l
113
defaulthost ~ #pppctrl |wc -l
73
It means there is 40 extra entries. 00:03:47:BD:34:25 host have established,
but only one session. I am seeing similar issue on all remaining pppoe
servers, extra entries with same mac at the end.
If you need more info or access, please let me know.
--
Denys Fedoryshchenko
Technical Manager
Virtual ISP S.A.L.
^ permalink raw reply
* [GIT PULL] pull request for lblnet-2.6_testing
From: Paul Moore @ 2008-01-29 15:09 UTC (permalink / raw)
To: James Morris; +Cc: selinux, linux-security-module, netdev
Hi James,
I've just rebased the lblnet-2.6_testing tree against Linus' latest
which already includes DaveM's net-2.6.25 tree so there shouldn't be
any collisions with the core networking bits. Other than minor changes
needed to merge cleanly with the current linux-2.6 tree there have been
no changes to the labeled networking patches since they were last
posted. The git tree can be found here:
* git://git.infradead.org/users/pcmoore/lblnet-2.6_testing
In the interest of full disclosure, I was not able to test this tree as
there are a few compile errors in the drivers area which are preventing
me from getting a kernel built. However, all of the relevant areas
(security/selinux, net/netlabel, net/netfilter, net/xfrm, net/ipv4,
net/ipv6) compiled without issue. I will continue to try and get a
kernel compiled but I thought getting this out in a reasonable
timeframe to minimize merge issues was a better decision. Thse patches
applied to 2.6.24 do compile, boot, and run without any known
regressions.
--
paul moore
linux security @ hp
^ permalink raw reply
* [VLAN]: set_rx_mode support for unicast address list
From: Patrick McHardy @ 2008-01-29 15:09 UTC (permalink / raw)
To: David S. Miller; +Cc: Linux Netdev List
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 8731 bytes --]
commit fbf2742ff936c751444ae610ae45c6ef54c14658
Author: Chris Leech <christopher.leech@intel.com>
Date: Thu Jan 24 18:24:53 2008 +0100
[VLAN]: set_rx_mode support for unicast address list
Reuse the existing logic for multicast list synchronization for the unicast
address list. The core of dev_mc_sync/unsync are split out as
__dev_addr_sync/unsync and moved from dev_mcast.c to dev.c. These are then
used to implement dev_unicast_sync/unsync as well.
I'm working on cleaning up Intel's FCoE stack, which generates new MAC
addresses from the fibre channel device id assigned by the fabric as per the
current draft specification in T11. When using such a protocol in a VLAN
environment it would be nice to not always be forced into promiscuous mode,
assuming the underlying Ethernet driver supports multiple unicast addresses as
well.
Signed-off-by: Chris Leech <christopher.leech@intel.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index b0813c3..047d432 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1414,12 +1414,16 @@ extern void dev_set_rx_mode(struct net_device *dev);
extern void __dev_set_rx_mode(struct net_device *dev);
extern int dev_unicast_delete(struct net_device *dev, void *addr, int alen);
extern int dev_unicast_add(struct net_device *dev, void *addr, int alen);
+extern int dev_unicast_sync(struct net_device *to, struct net_device *from);
+extern void dev_unicast_unsync(struct net_device *to, struct net_device *from);
extern int dev_mc_delete(struct net_device *dev, void *addr, int alen, int all);
extern int dev_mc_add(struct net_device *dev, void *addr, int alen, int newonly);
extern int dev_mc_sync(struct net_device *to, struct net_device *from);
extern void dev_mc_unsync(struct net_device *to, struct net_device *from);
extern int __dev_addr_delete(struct dev_addr_list **list, int *count, void *addr, int alen, int all);
extern int __dev_addr_add(struct dev_addr_list **list, int *count, void *addr, int alen, int newonly);
+extern int __dev_addr_sync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
+extern void __dev_addr_unsync(struct dev_addr_list **to, int *to_count, struct dev_addr_list **from, int *from_count);
extern void dev_set_promiscuity(struct net_device *dev, int inc);
extern void dev_set_allmulti(struct net_device *dev, int inc);
extern void netdev_state_change(struct net_device *dev);
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index 8059fa4..77f04e4 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -563,6 +563,7 @@ static int vlan_dev_stop(struct net_device *dev)
struct net_device *real_dev = vlan_dev_info(dev)->real_dev;
dev_mc_unsync(real_dev, dev);
+ dev_unicast_unsync(real_dev, dev);
if (dev->flags & IFF_ALLMULTI)
dev_set_allmulti(real_dev, -1);
if (dev->flags & IFF_PROMISC)
@@ -634,9 +635,10 @@ static void vlan_dev_change_rx_flags(struct net_device *dev, int change)
dev_set_promiscuity(real_dev, dev->flags & IFF_PROMISC ? 1 : -1);
}
-static void vlan_dev_set_multicast_list(struct net_device *vlan_dev)
+static void vlan_dev_set_rx_mode(struct net_device *vlan_dev)
{
dev_mc_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev);
+ dev_unicast_sync(vlan_dev_info(vlan_dev)->real_dev, vlan_dev);
}
/*
@@ -702,7 +704,8 @@ void vlan_setup(struct net_device *dev)
dev->open = vlan_dev_open;
dev->stop = vlan_dev_stop;
dev->set_mac_address = vlan_dev_set_mac_address;
- dev->set_multicast_list = vlan_dev_set_multicast_list;
+ dev->set_rx_mode = vlan_dev_set_rx_mode;
+ dev->set_multicast_list = vlan_dev_set_rx_mode;
dev->change_rx_flags = vlan_dev_change_rx_flags;
dev->do_ioctl = vlan_dev_ioctl;
dev->destructor = free_netdev;
diff --git a/net/core/dev.c b/net/core/dev.c
index c9c593e..edaff27 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2962,6 +2962,102 @@ int dev_unicast_add(struct net_device *dev, void *addr, int alen)
}
EXPORT_SYMBOL(dev_unicast_add);
+int __dev_addr_sync(struct dev_addr_list **to, int *to_count,
+ struct dev_addr_list **from, int *from_count)
+{
+ struct dev_addr_list *da, *next;
+ int err = 0;
+
+ da = *from;
+ while (da != NULL) {
+ next = da->next;
+ if (!da->da_synced) {
+ err = __dev_addr_add(to, to_count,
+ da->da_addr, da->da_addrlen, 0);
+ if (err < 0)
+ break;
+ da->da_synced = 1;
+ da->da_users++;
+ } else if (da->da_users == 1) {
+ __dev_addr_delete(to, to_count,
+ da->da_addr, da->da_addrlen, 0);
+ __dev_addr_delete(from, from_count,
+ da->da_addr, da->da_addrlen, 0);
+ }
+ da = next;
+ }
+ return err;
+}
+
+void __dev_addr_unsync(struct dev_addr_list **to, int *to_count,
+ struct dev_addr_list **from, int *from_count)
+{
+ struct dev_addr_list *da, *next;
+
+ da = *from;
+ while (da != NULL) {
+ next = da->next;
+ if (da->da_synced) {
+ __dev_addr_delete(to, to_count,
+ da->da_addr, da->da_addrlen, 0);
+ da->da_synced = 0;
+ __dev_addr_delete(from, from_count,
+ da->da_addr, da->da_addrlen, 0);
+ }
+ da = next;
+ }
+}
+
+/**
+ * dev_unicast_sync - Synchronize device's unicast list to another device
+ * @to: destination device
+ * @from: source device
+ *
+ * Add newly added addresses to the destination device and release
+ * addresses that have no users left. The source device must be
+ * locked by netif_tx_lock_bh.
+ *
+ * This function is intended to be called from the dev->set_rx_mode
+ * function of layered software devices.
+ */
+int dev_unicast_sync(struct net_device *to, struct net_device *from)
+{
+ int err = 0;
+
+ netif_tx_lock_bh(to);
+ err = __dev_addr_sync(&to->uc_list, &to->uc_count,
+ &from->uc_list, &from->uc_count);
+ if (!err)
+ __dev_set_rx_mode(to);
+ netif_tx_unlock_bh(to);
+ return err;
+}
+EXPORT_SYMBOL(dev_unicast_sync);
+
+/**
+ * dev_unicast_unsync - Remove synchronized addresses from the destination
+ * device
+ * @to: destination device
+ * @from: source device
+ *
+ * Remove all addresses that were added to the destination device by
+ * dev_unicast_sync(). This function is intended to be called from the
+ * dev->stop function of layered software devices.
+ */
+void dev_unicast_unsync(struct net_device *to, struct net_device *from)
+{
+ netif_tx_lock_bh(from);
+ netif_tx_lock_bh(to);
+
+ __dev_addr_unsync(&to->uc_list, &to->uc_count,
+ &from->uc_list, &from->uc_count);
+ __dev_set_rx_mode(to);
+
+ netif_tx_unlock_bh(to);
+ netif_tx_unlock_bh(from);
+}
+EXPORT_SYMBOL(dev_unicast_unsync);
+
static void __dev_addr_discard(struct dev_addr_list **list)
{
struct dev_addr_list *tmp;
diff --git a/net/core/dev_mcast.c b/net/core/dev_mcast.c
index cadbfbf..cec5825 100644
--- a/net/core/dev_mcast.c
+++ b/net/core/dev_mcast.c
@@ -113,32 +113,15 @@ int dev_mc_add(struct net_device *dev, void *addr, int alen, int glbl)
* locked by netif_tx_lock_bh.
*
* This function is intended to be called from the dev->set_multicast_list
- * function of layered software devices.
+ * or dev->set_rx_mode function of layered software devices.
*/
int dev_mc_sync(struct net_device *to, struct net_device *from)
{
- struct dev_addr_list *da, *next;
int err = 0;
netif_tx_lock_bh(to);
- da = from->mc_list;
- while (da != NULL) {
- next = da->next;
- if (!da->da_synced) {
- err = __dev_addr_add(&to->mc_list, &to->mc_count,
- da->da_addr, da->da_addrlen, 0);
- if (err < 0)
- break;
- da->da_synced = 1;
- da->da_users++;
- } else if (da->da_users == 1) {
- __dev_addr_delete(&to->mc_list, &to->mc_count,
- da->da_addr, da->da_addrlen, 0);
- __dev_addr_delete(&from->mc_list, &from->mc_count,
- da->da_addr, da->da_addrlen, 0);
- }
- da = next;
- }
+ err = __dev_addr_sync(&to->mc_list, &to->mc_count,
+ &from->mc_list, &from->mc_count);
if (!err)
__dev_set_rx_mode(to);
netif_tx_unlock_bh(to);
@@ -160,23 +143,11 @@ EXPORT_SYMBOL(dev_mc_sync);
*/
void dev_mc_unsync(struct net_device *to, struct net_device *from)
{
- struct dev_addr_list *da, *next;
-
netif_tx_lock_bh(from);
netif_tx_lock_bh(to);
- da = from->mc_list;
- while (da != NULL) {
- next = da->next;
- if (da->da_synced) {
- __dev_addr_delete(&to->mc_list, &to->mc_count,
- da->da_addr, da->da_addrlen, 0);
- da->da_synced = 0;
- __dev_addr_delete(&from->mc_list, &from->mc_count,
- da->da_addr, da->da_addrlen, 0);
- }
- da = next;
- }
+ __dev_addr_unsync(&to->mc_list, &to->mc_count,
+ &from->mc_list, &from->mc_count);
__dev_set_rx_mode(to);
netif_tx_unlock_bh(to);
^ permalink raw reply related
* [PATCH net-2.6.25] [MACVLAN] Setting macvlan_handle_frame_hook to NULL when rtnl_link_register() fails.
From: Rami Rosen @ 2008-01-29 15:14 UTC (permalink / raw)
To: kaber, netdev
[-- Attachment #1: Type: text/plain, Size: 357 bytes --]
Hi,
In drivers/net/macvlan.c, when rtnl_link_register() fails
in macvlan_init_module(), there is no point to set it (second time in this
method) to macvlan_handle_frame; macvlan_init_module() will return a negative
number, so instead this patch sets macvlan_handle_frame_hook to NULL.
Regards,
Rami Rosen
Signed-off-by: Rami Rosen <ramirose@gmail.com>
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 405 bytes --]
diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 6ef6b8b..f651a81 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -508,7 +508,7 @@ static int __init macvlan_init_module(void)
goto err1;
return 0;
err1:
- macvlan_handle_frame_hook = macvlan_handle_frame;
+ macvlan_handle_frame_hook = NULL;
unregister_netdevice_notifier(&macvlan_notifier_block);
return err;
}
^ permalink raw reply related
* Re: [PATCH net-2.6.25] [MACVLAN] Setting macvlan_handle_frame_hook to NULL when rtnl_link_register() fails.
From: Patrick McHardy @ 2008-01-29 15:19 UTC (permalink / raw)
To: Rami Rosen; +Cc: netdev, David S. Miller
In-Reply-To: <eb3ff54b0801290714ja7e7e67t3349028b7db8dc5e@mail.gmail.com>
Rami Rosen wrote:
> Hi,
> In drivers/net/macvlan.c, when rtnl_link_register() fails
> in macvlan_init_module(), there is no point to set it (second time in this
> method) to macvlan_handle_frame; macvlan_init_module() will return a negative
> number, so instead this patch sets macvlan_handle_frame_hook to NULL.
Indeed, that seems to be a stupid cut-and-paste error. Thanks for
catching this.
Dave, please apply.
^ permalink raw reply
* Re: sky2: tx hang on dual-port Yukon XL when rx csum disabled
From: Tony Battersby @ 2008-01-29 15:26 UTC (permalink / raw)
To: Stephen Hemminger, netdev
In-Reply-To: <479E2247.8080109@cybernetics.com>
Tony Battersby wrote:
> "iperf -c 192.168.1.1" never finishes, but "iperf -c 192.168.2.1" does
> finish. Press Ctrl-C to abort the hung iperf. Ping 192.168.1.1 does
> not respond. Ping 192.168.2.1 does respond, but each ping has almost
> exactly 1 second latency (the latency should be < 1 ms).
>
>
Update: after triggering the problem, the ping latency on the interface
that still responds is the same as the ping interval. The default ping
interval is 1 second, so in my initial test I was seeing a 1 second ping
latency. If I do "ping -i 2 192.168.2.1", then each ping takes 2
seconds to receive the response. If I do "ping -i 5 192.168.2.1", then
each ping takes 5 seconds to receive the response. This implies that
the network stack doesn't realize that it received the ping reply until
it goes to send another ping.
Hope that helps.
Tony Battersby
Cybernetics
^ permalink raw reply
* [NET_SCHED]: sch_ingress: remove netfilter support
From: Patrick McHardy @ 2008-01-29 15:28 UTC (permalink / raw)
To: David S. Miller; +Cc: jamal, Linux Netdev List
[-- Attachment #1: Type: text/plain, Size: 0 bytes --]
[-- Attachment #2: 01.diff --]
[-- Type: text/x-patch, Size: 4402 bytes --]
commit 3b27667029825ba16f8509fb119bca1b445a3dc9
Author: Patrick McHardy <kaber@trash.net>
Date: Mon Jan 28 13:57:56 2008 +0100
[NET_SCHED]: sch_ingress: remove netfilter support
Since the old policer code is gone, TC actions are needed for policing.
The ingress qdisc can get packets directly from netif_receive_skb()
in case TC actions are enabled or through netfilter otherwise, but
since without TC actions there is no policer the only thing it actually
does is count packets.
Remove the netfilter support and always require TC actions.
Signed-off-by: Patrick McHardy <kaber@trash.net>
diff --git a/net/sched/Kconfig b/net/sched/Kconfig
index 87af7c9..7d4085a 100644
--- a/net/sched/Kconfig
+++ b/net/sched/Kconfig
@@ -198,7 +198,7 @@ config NET_SCH_NETEM
config NET_SCH_INGRESS
tristate "Ingress Qdisc"
- depends on NET_CLS_ACT || NETFILTER
+ depends on NET_CLS_ACT
---help---
Say Y here if you want to use classifiers for incoming packets.
If unsure, say Y.
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index 3f72d52..274b1dd 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -12,18 +12,10 @@
#include <linux/list.h>
#include <linux/skbuff.h>
#include <linux/rtnetlink.h>
-#include <linux/netfilter_ipv4.h>
-#include <linux/netfilter_ipv6.h>
-#include <linux/netfilter.h>
#include <net/netlink.h>
#include <net/pkt_sched.h>
-/* Thanks to Doron Oz for this hack */
-#if !defined(CONFIG_NET_CLS_ACT) && defined(CONFIG_NETFILTER)
-static int nf_registered;
-#endif
-
struct ingress_qdisc_data {
struct tcf_proto *filter_list;
};
@@ -84,11 +76,6 @@ static int ingress_enqueue(struct sk_buff *skb, struct Qdisc *sch)
result = tc_classify(skb, p->filter_list, &res);
- /*
- * Unlike normal "enqueue" functions, ingress_enqueue returns a
- * firewall FW_* code.
- */
-#ifdef CONFIG_NET_CLS_ACT
sch->bstats.packets++;
sch->bstats.bytes += skb->len;
switch (result) {
@@ -107,71 +94,10 @@ static int ingress_enqueue(struct sk_buff *skb, struct Qdisc *sch)
result = TC_ACT_OK;
break;
}
-#else
- result = NF_ACCEPT;
- sch->bstats.packets++;
- sch->bstats.bytes += skb->len;
-#endif
return result;
}
-#if !defined(CONFIG_NET_CLS_ACT) && defined(CONFIG_NETFILTER)
-static unsigned int ing_hook(unsigned int hook, struct sk_buff *skb,
- const struct net_device *indev,
- const struct net_device *outdev,
- int (*okfn)(struct sk_buff *))
-{
-
- struct Qdisc *q;
- struct net_device *dev = skb->dev;
- int fwres = NF_ACCEPT;
-
- if (dev->qdisc_ingress) {
- spin_lock(&dev->ingress_lock);
- if ((q = dev->qdisc_ingress) != NULL)
- fwres = q->enqueue(skb, q);
- spin_unlock(&dev->ingress_lock);
- }
-
- return fwres;
-}
-
-/* after ipt_filter */
-static struct nf_hook_ops ing_ops[] __read_mostly = {
- {
- .hook = ing_hook,
- .owner = THIS_MODULE,
- .pf = PF_INET,
- .hooknum = NF_INET_PRE_ROUTING,
- .priority = NF_IP_PRI_FILTER + 1,
- },
- {
- .hook = ing_hook,
- .owner = THIS_MODULE,
- .pf = PF_INET6,
- .hooknum = NF_INET_PRE_ROUTING,
- .priority = NF_IP6_PRI_FILTER + 1,
- },
-};
-#endif
-
-static int ingress_init(struct Qdisc *sch, struct nlattr *opt)
-{
-#if !defined(CONFIG_NET_CLS_ACT) && defined(CONFIG_NETFILTER)
- printk("Ingress scheduler: Classifier actions prefered over netfilter\n");
-
- if (!nf_registered) {
- if (nf_register_hooks(ing_ops, ARRAY_SIZE(ing_ops)) < 0) {
- printk("ingress qdisc registration error \n");
- return -EINVAL;
- }
- nf_registered++;
- }
-#endif
- return 0;
-}
-
/* ------------------------------------------------------------- */
static void ingress_destroy(struct Qdisc *sch)
@@ -213,7 +139,6 @@ static struct Qdisc_ops ingress_qdisc_ops __read_mostly = {
.id = "ingress",
.priv_size = sizeof(struct ingress_qdisc_data),
.enqueue = ingress_enqueue,
- .init = ingress_init,
.destroy = ingress_destroy,
.dump = ingress_dump,
.owner = THIS_MODULE,
@@ -227,10 +152,6 @@ static int __init ingress_module_init(void)
static void __exit ingress_module_exit(void)
{
unregister_qdisc(&ingress_qdisc_ops);
-#if !defined(CONFIG_NET_CLS_ACT) && defined(CONFIG_NETFILTER)
- if (nf_registered)
- nf_unregister_hooks(ing_ops, ARRAY_SIZE(ing_ops));
-#endif
}
module_init(ingress_module_init)
^ permalink raw reply related
* [PATCH] PHYLIB: Locking fixes for PHY I/O potentially sleeping
From: Nate Case @ 2008-01-29 16:05 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Andy Fleming, David S. Miller, netdev
In-Reply-To: <479E76A2.8020304@garzik.org>
PHY read/write functions can potentially sleep (e.g., a PHY accessed
via I2C). The following changes were made to account for this:
* Change spin locks to mutex locks
* Add a BUG_ON() to phy_read() phy_write() to warn against
calling them from an interrupt context.
* Use work queue for PHY state machine handling since
it can potentially sleep
* Change phydev lock from spinlock to mutex
Signed-off-by: Nate Case <ncase@xes-inc.com>
Acked-by: Andy Fleming <afleming@freescale.com>
---
Note: This is a resend of the patch submitted on January 3rd, 2008
drivers/net/phy/mdio_bus.c | 2 +-
drivers/net/phy/phy.c | 68 ++++++++++++++++++++++++++++-------------
drivers/net/phy/phy_device.c | 11 +++----
include/linux/phy.h | 5 ++-
4 files changed, 55 insertions(+), 31 deletions(-)
diff --git a/drivers/net/phy/mdio_bus.c b/drivers/net/phy/mdio_bus.c
index c30196d..6e9f619 100644
--- a/drivers/net/phy/mdio_bus.c
+++ b/drivers/net/phy/mdio_bus.c
@@ -49,7 +49,7 @@ int mdiobus_register(struct mii_bus *bus)
int i;
int err = 0;
- spin_lock_init(&bus->mdio_lock);
+ mutex_init(&bus->mdio_lock);
if (NULL == bus || NULL == bus->name ||
NULL == bus->read ||
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 7c9e6e3..12fccb1 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -26,7 +26,6 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
-#include <linux/spinlock.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/mii.h>
@@ -72,9 +71,11 @@ int phy_read(struct phy_device *phydev, u16 regnum)
int retval;
struct mii_bus *bus = phydev->bus;
- spin_lock_bh(&bus->mdio_lock);
+ BUG_ON(in_interrupt());
+
+ mutex_lock(&bus->mdio_lock);
retval = bus->read(bus, phydev->addr, regnum);
- spin_unlock_bh(&bus->mdio_lock);
+ mutex_unlock(&bus->mdio_lock);
return retval;
}
@@ -95,9 +96,11 @@ int phy_write(struct phy_device *phydev, u16 regnum, u16 val)
int err;
struct mii_bus *bus = phydev->bus;
- spin_lock_bh(&bus->mdio_lock);
+ BUG_ON(in_interrupt());
+
+ mutex_lock(&bus->mdio_lock);
err = bus->write(bus, phydev->addr, regnum, val);
- spin_unlock_bh(&bus->mdio_lock);
+ mutex_unlock(&bus->mdio_lock);
return err;
}
@@ -428,7 +431,7 @@ int phy_start_aneg(struct phy_device *phydev)
{
int err;
- spin_lock_bh(&phydev->lock);
+ mutex_lock(&phydev->lock);
if (AUTONEG_DISABLE == phydev->autoneg)
phy_sanitize_settings(phydev);
@@ -449,13 +452,14 @@ int phy_start_aneg(struct phy_device *phydev)
}
out_unlock:
- spin_unlock_bh(&phydev->lock);
+ mutex_unlock(&phydev->lock);
return err;
}
EXPORT_SYMBOL(phy_start_aneg);
static void phy_change(struct work_struct *work);
+static void phy_state_machine(struct work_struct *work);
static void phy_timer(unsigned long data);
/**
@@ -476,6 +480,7 @@ void phy_start_machine(struct phy_device *phydev,
{
phydev->adjust_state = handler;
+ INIT_WORK(&phydev->state_queue, phy_state_machine);
init_timer(&phydev->phy_timer);
phydev->phy_timer.function = &phy_timer;
phydev->phy_timer.data = (unsigned long) phydev;
@@ -493,11 +498,12 @@ void phy_start_machine(struct phy_device *phydev,
void phy_stop_machine(struct phy_device *phydev)
{
del_timer_sync(&phydev->phy_timer);
+ cancel_work_sync(&phydev->state_queue);
- spin_lock_bh(&phydev->lock);
+ mutex_lock(&phydev->lock);
if (phydev->state > PHY_UP)
phydev->state = PHY_UP;
- spin_unlock_bh(&phydev->lock);
+ mutex_unlock(&phydev->lock);
phydev->adjust_state = NULL;
}
@@ -541,9 +547,9 @@ static void phy_force_reduction(struct phy_device *phydev)
*/
void phy_error(struct phy_device *phydev)
{
- spin_lock_bh(&phydev->lock);
+ mutex_lock(&phydev->lock);
phydev->state = PHY_HALTED;
- spin_unlock_bh(&phydev->lock);
+ mutex_unlock(&phydev->lock);
}
/**
@@ -705,10 +711,10 @@ static void phy_change(struct work_struct *work)
if (err)
goto phy_err;
- spin_lock_bh(&phydev->lock);
+ mutex_lock(&phydev->lock);
if ((PHY_RUNNING == phydev->state) || (PHY_NOLINK == phydev->state))
phydev->state = PHY_CHANGELINK;
- spin_unlock_bh(&phydev->lock);
+ mutex_unlock(&phydev->lock);
atomic_dec(&phydev->irq_disable);
enable_irq(phydev->irq);
@@ -735,7 +741,7 @@ phy_err:
*/
void phy_stop(struct phy_device *phydev)
{
- spin_lock_bh(&phydev->lock);
+ mutex_lock(&phydev->lock);
if (PHY_HALTED == phydev->state)
goto out_unlock;
@@ -751,7 +757,7 @@ void phy_stop(struct phy_device *phydev)
phydev->state = PHY_HALTED;
out_unlock:
- spin_unlock_bh(&phydev->lock);
+ mutex_unlock(&phydev->lock);
/*
* Cannot call flush_scheduled_work() here as desired because
@@ -773,7 +779,7 @@ out_unlock:
*/
void phy_start(struct phy_device *phydev)
{
- spin_lock_bh(&phydev->lock);
+ mutex_lock(&phydev->lock);
switch (phydev->state) {
case PHY_STARTING:
@@ -787,19 +793,26 @@ void phy_start(struct phy_device *phydev)
default:
break;
}
- spin_unlock_bh(&phydev->lock);
+ mutex_unlock(&phydev->lock);
}
EXPORT_SYMBOL(phy_stop);
EXPORT_SYMBOL(phy_start);
-/* PHY timer which handles the state machine */
-static void phy_timer(unsigned long data)
+/**
+ * phy_state_machine - Handle the state machine
+ * @work: work_struct that describes the work to be done
+ *
+ * Description: Scheduled by the state_queue workqueue each time
+ * phy_timer is triggered.
+ */
+static void phy_state_machine(struct work_struct *work)
{
- struct phy_device *phydev = (struct phy_device *)data;
+ struct phy_device *phydev =
+ container_of(work, struct phy_device, state_queue);
int needs_aneg = 0;
int err = 0;
- spin_lock_bh(&phydev->lock);
+ mutex_lock(&phydev->lock);
if (phydev->adjust_state)
phydev->adjust_state(phydev->attached_dev);
@@ -965,7 +978,7 @@ static void phy_timer(unsigned long data)
break;
}
- spin_unlock_bh(&phydev->lock);
+ mutex_unlock(&phydev->lock);
if (needs_aneg)
err = phy_start_aneg(phydev);
@@ -976,3 +989,14 @@ static void phy_timer(unsigned long data)
mod_timer(&phydev->phy_timer, jiffies + PHY_STATE_TIME * HZ);
}
+/* PHY timer which schedules the state machine work */
+static void phy_timer(unsigned long data)
+{
+ struct phy_device *phydev = (struct phy_device *)data;
+
+ /*
+ * PHY I/O operations can potentially sleep so we ensure that
+ * it's done from a process context
+ */
+ schedule_work(&phydev->state_queue);
+}
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 5b9e175..f4c4fd8 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -25,7 +25,6 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
-#include <linux/spinlock.h>
#include <linux/mm.h>
#include <linux/module.h>
#include <linux/mii.h>
@@ -80,7 +79,7 @@ struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id)
dev->state = PHY_DOWN;
- spin_lock_init(&dev->lock);
+ mutex_init(&dev->lock);
return dev;
}
@@ -656,7 +655,7 @@ static int phy_probe(struct device *dev)
if (!(phydrv->flags & PHY_HAS_INTERRUPT))
phydev->irq = PHY_POLL;
- spin_lock_bh(&phydev->lock);
+ mutex_lock(&phydev->lock);
/* Start out supporting everything. Eventually,
* a controller will attach, and may modify one
@@ -670,7 +669,7 @@ static int phy_probe(struct device *dev)
if (phydev->drv->probe)
err = phydev->drv->probe(phydev);
- spin_unlock_bh(&phydev->lock);
+ mutex_unlock(&phydev->lock);
return err;
@@ -682,9 +681,9 @@ static int phy_remove(struct device *dev)
phydev = to_phy_device(dev);
- spin_lock_bh(&phydev->lock);
+ mutex_lock(&phydev->lock);
phydev->state = PHY_DOWN;
- spin_unlock_bh(&phydev->lock);
+ mutex_unlock(&phydev->lock);
if (phydev->drv->remove)
phydev->drv->remove(phydev);
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 554836e..5e43ae7 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -88,7 +88,7 @@ struct mii_bus {
/* A lock to ensure that only one thing can read/write
* the MDIO bus at a time */
- spinlock_t mdio_lock;
+ struct mutex mdio_lock;
struct device *dev;
@@ -284,10 +284,11 @@ struct phy_device {
/* Interrupt and Polling infrastructure */
struct work_struct phy_queue;
+ struct work_struct state_queue;
struct timer_list phy_timer;
atomic_t irq_disable;
- spinlock_t lock;
+ struct mutex lock;
struct net_device *attached_dev;
--
1.5.3.3
^ 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