* Re: [PATCH 2/2][KEY]: Convert net/pfkey to use seq files.
From: David Miller @ 2008-02-10 7:21 UTC (permalink / raw)
To: xemul; +Cc: herbert, netdev
In-Reply-To: <47AC478E.3070507@openvz.org>
From: Pavel Emelyanov <xemul@openvz.org>
Date: Fri, 08 Feb 2008 15:14:06 +0300
> The seq files API disposes the caller of the difficulty of
> checking file position, the length of data to produce and
> the size of provided buffer.
>
> Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Applied, but this kind of stuff is borderline wrt. the
"no new features" declaration.
Please queue future instances of this kind of stuff for when I open up
net-2.6.26, thanks.
^ permalink raw reply
* Re: [PATCH] [IGMP]: Optimize kfree_skb in igmp_rcv.
From: David Miller @ 2008-02-10 7:22 UTC (permalink / raw)
To: den; +Cc: netdev, devel
In-Reply-To: <1202480057-23367-1-git-send-email-den@openvz.org>
From: "Denis V. Lunev" <den@openvz.org>
Date: Fri, 8 Feb 2008 17:14:17 +0300
> Merge error paths inside igmp_rcv.
>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
Applied, but this kind of cleanup is borderline during this
time period. Please queue such things up for when I open up
net-2.6.26, thanks.
Find some bugs to fix instead :-)
^ permalink raw reply
* Re: [PATCH 1/2][SCTP]: Use snmp_fold_field instead of a homebrew analogue.
From: David Miller @ 2008-02-10 7:24 UTC (permalink / raw)
To: vladislav.yasevich; +Cc: xemul, lksctp-developers, netdev
In-Reply-To: <47AC6E6A.4000101@hp.com>
From: Vlad Yasevich <vladislav.yasevich@hp.com>
Date: Fri, 08 Feb 2008 09:59:54 -0500
> Pavel Emelyanov wrote:
> > SCPT already depends in INET, so this doesn't create additional
> > dependencies.
> >
> > Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
>
> Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Applied.
^ permalink raw reply
* Re: [PATCH 2/2][SCTP]: Convert sctp_dbg_objcnt to seq files.
From: David Miller @ 2008-02-10 7:25 UTC (permalink / raw)
To: vladislav.yasevich; +Cc: xemul, lksctp-developers, netdev
In-Reply-To: <47AC6E87.5050905@hp.com>
From: Vlad Yasevich <vladislav.yasevich@hp.com>
Date: Fri, 08 Feb 2008 10:00:23 -0500
> Pavel Emelyanov wrote:
> > This makes the code use a good proc API and the text ~50 bytes shorter.
> >
> > Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
>
> Acked-by: Vlad Yasevich <vladislav.yasevich@hp.com>
Applied.
^ permalink raw reply
* Re: [PKT_SCHED] deinline functions in meta match
From: David Miller @ 2008-02-10 7:26 UTC (permalink / raw)
To: shemminger; +Cc: netdev
In-Reply-To: <20080208095557.15cee30f@extreme>
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Fri, 8 Feb 2008 09:55:57 -0800
> A couple of functions in meta match don't need to be inline.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Applied.
^ permalink raw reply
* Re: [PKT_SCHED] ematch: tcf_em_destroy robustness
From: David Miller @ 2008-02-10 7:27 UTC (permalink / raw)
To: shemminger; +Cc: netdev
In-Reply-To: <20080208104832.690e140e@extreme>
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Fri, 8 Feb 2008 10:48:32 -0800
> Make the code in tcf_em_tree_destroy more robust and cleaner:
> * Don't need to cast pointer to kfree() or avoid passing NULL.
> * After freeing the tree, clear the pointer to avoid possible problems
> from repeated free.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH] isdn: fix section mismatch warning in hfc_sx.c
From: David Miller @ 2008-02-10 7:27 UTC (permalink / raw)
To: sam; +Cc: netdev, jeff, jgarzik
In-Reply-To: <1202500804-32020-4-git-send-email-sam@ravnborg.org>
From: Sam Ravnborg <sam@ravnborg.org>
Date: Fri, 8 Feb 2008 21:00:04 +0100
> Fix the following warning:
> WARNING: drivers/isdn/hisax/built-in.o(.text+0x35818): Section mismatch in reference from the function hfcsx_card_msg() to the function .devinit.text:inithfcsx()
>
> hfcsx_card_msg() may be called outside __devinit context.
> Following the program logic is looks like the CARD_INIT branch
> will only be taken under __devinit context but to be consistent
> remove the __devinit annotation of inithfcsx() so we
> do not mix non-__devinit and __devinit code.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Acked-by: Karsten Keil <kkeil@suse.de>
> Cc: Jeff Garzik <jgarzik@pobox.com>
> Cc: David Miller <davem@davemloft.net>
Applied.
^ permalink raw reply
* Re: [PATCH] isdn: fix section mismatch warnings in isac.c and isar.c
From: David Miller @ 2008-02-10 7:28 UTC (permalink / raw)
To: sam; +Cc: netdev, jeff, jgarzik
In-Reply-To: <1202500804-32020-3-git-send-email-sam@ravnborg.org>
From: Sam Ravnborg <sam@ravnborg.org>
Date: Fri, 8 Feb 2008 21:00:03 +0100
> Fix the following warnings:
...
>
> initisar(), initisac() and clear_pending_isac_ints()
> were all used via a cardmsg fnction - which may be called
> ouside __devinit context.
> So remove the bogus __devinit annotation of the
> above three functions to fix the warnings.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Acked-by: Karsten Keil <kkeil@suse.de>
> Cc: Jeff Garzik <jgarzik@pobox.com>
> Cc: David Miller <davem@davemloft.net>
Applied.
^ permalink raw reply
* Re: [PATCH] isdn: fix section mismatch warnings from hisax_cs_setup_card
From: David Miller @ 2008-02-10 7:29 UTC (permalink / raw)
To: sam; +Cc: netdev, jeff, jgarzik
In-Reply-To: <1202500804-32020-1-git-send-email-sam@ravnborg.org>
From: Sam Ravnborg <sam@ravnborg.org>
Date: Fri, 8 Feb 2008 21:00:01 +0100
> Fix the following warnings:
...
>
> checkcard() are the only user of hisax_cs_setup_card().
> And checkcard is only used during init or when hot plugging
> ISDN devices. So annotate hisax_cs_setup_card() with __devinit.
> checkcard() is used by exported functions so it cannot be
> annotated __devinit. Annotate it with __ref so modpost
> ignore references to _devinit section.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Acked-by: Karsten Keil <kkeil@suse.de>
> Cc: Jeff Garzik <jgarzik@pobox.com>
> Cc: David Miller <davem@davemloft.net>
Applied.
^ permalink raw reply
* Re: [PATCH] isdn: fix section mismatch warning for ISACVer
From: David Miller @ 2008-02-10 7:29 UTC (permalink / raw)
To: sam; +Cc: netdev, jeff, jgarzik
In-Reply-To: <1202500804-32020-2-git-send-email-sam@ravnborg.org>
From: Sam Ravnborg <sam@ravnborg.org>
Date: Fri, 8 Feb 2008 21:00:02 +0100
> Fix following warnings:
> WARNING: drivers/isdn/hisax/built-in.o(.text+0x19723): Section mismatch in reference from the function ISACVersion() to the variable .devinit.data:ISACVer
> WARNING: drivers/isdn/hisax/built-in.o(.text+0x2005b): Section mismatch in reference from the function setup_avm_a1_pcmcia() to the function .devinit.text:setup_isac()
>
> ISACVer were only used from function annotated __devinit
> so add same annotation to ISACVer.
> One af the fererencing functions missed __devinit so add it
> and kill an additional warning.
>
> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
> Acked-by: Karsten Keil <kkeil@suse.de>
> Cc: Jeff Garzik <jgarzik@pobox.com>
> Cc: David Miller <davem@davemloft.net>
Also applied, thanks a lot Sam!
^ permalink raw reply
* Re: [patch 1/7] typhoon section fix
From: David Miller @ 2008-02-10 7:40 UTC (permalink / raw)
To: akpm; +Cc: jeff, netdev, sam
In-Reply-To: <200802081120.m18BK6cL021623@imap1.linux-foundation.org>
From: akpm@linux-foundation.org
Date: Fri, 08 Feb 2008 03:11:13 -0800
> From: Andrew Morton <akpm@linux-foundation.org>
>
> gcc-3.4.4 on powerpc:
>
> drivers/net/typhoon.c:137: error: version causes a section type conflict
>
> Cc: Jeff Garzik <jeff@garzik.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Applied.
^ permalink raw reply
* Re: [patch 2/7] natsemi section fix
From: David Miller @ 2008-02-10 7:41 UTC (permalink / raw)
To: akpm; +Cc: jeff, netdev, sam
In-Reply-To: <200802081120.m18BK7Fh021626@imap1.linux-foundation.org>
From: akpm@linux-foundation.org
Date: Fri, 08 Feb 2008 03:11:15 -0800
> From: Andrew Morton <akpm@linux-foundation.org>
>
> gcc-3.4.4 on powerpc:
>
> drivers/net/natsemi.c:245: error: natsemi_pci_info causes a section type conflict
>
> Cc: Jeff Garzik <jeff@garzik.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Applied.
^ permalink raw reply
* Re: [patch 5/7] via-velocity section fix
From: David Miller @ 2008-02-10 7:41 UTC (permalink / raw)
To: akpm; +Cc: jeff, netdev, sam
In-Reply-To: <200802081120.m18BK8ac021635@imap1.linux-foundation.org>
From: akpm@linux-foundation.org
Date: Fri, 08 Feb 2008 03:11:16 -0800
> From: Andrew Morton <akpm@linux-foundation.org>
>
> gcc-3.4.4 on powerpc:
>
> drivers/net/via-velocity.c:443: error: chip_info_table causes a section type conflict
>
> on this one I had to remove the __devinitdata too. Don't know why.
>
> Cc: Jeff Garzik <jeff@garzik.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Applied.
^ permalink raw reply
* Re: [patch 6/7] starfire secton fix
From: David Miller @ 2008-02-10 7:41 UTC (permalink / raw)
To: akpm; +Cc: jeff, netdev, sam
In-Reply-To: <200802081120.m18BK8cw021639@imap1.linux-foundation.org>
From: akpm@linux-foundation.org
Date: Fri, 08 Feb 2008 03:11:16 -0800
> From: Andrew Morton <akpm@linux-foundation.org>
>
> gcc-3.4.4 on powerpc:
>
> drivers/net/starfire.c:219: error: version causes a section type conflict
>
> Cc: Jeff Garzik <jeff@garzik.org>
> Cc: Sam Ravnborg <sam@ravnborg.org>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Applied.
^ permalink raw reply
* Re: [PATCH] [IPV6] Replace using the magic constant "1024" with IP6_RT_PRIO_USER for fc_metric.
From: David Miller @ 2008-02-10 7:43 UTC (permalink / raw)
To: ramirose; +Cc: netdev
In-Reply-To: <eb3ff54b0802080214u5c20f061of4144964c8776359@mail.gmail.com>
From: "Rami Rosen" <ramirose@gmail.com>
Date: Fri, 8 Feb 2008 12:14:18 +0200
> This patch replaces the explicit usage of the magic constant "1024"
> with IP6_RT_PRIO_USER in the IPV6 tree.
>
> Signed-off-by: Rami Rosen <ramirose@gmail.com>
Applied, thanks.
^ permalink raw reply
* Re: [PATCH][NET_SCHED] sch_htb: htb_requeue fix
From: David Miller @ 2008-02-10 7:44 UTC (permalink / raw)
To: jarkao2; +Cc: netdev
In-Reply-To: <20080208085749.GA5656@ff.dom.local>
From: Jarek Poplawski <jarkao2@gmail.com>
Date: Fri, 8 Feb 2008 08:57:49 +0000
> htb_requeue() enqueues skbs for which htb_classify() returns NULL.
> This is wrong because such skbs could be handled by NET_CLS_ACT code,
> and the decision could be different than earlier in htb_enqueue().
> So htb_requeue() is changed to work and look more like htb_enqueue().
>
>
> Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
Applied, thanks.
^ permalink raw reply
* [PATCH] Fix comment for skb_pull_rcsum
From: Urs Thuermann @ 2008-02-10 9:48 UTC (permalink / raw)
To: netdev
Fix comment for skb_pull_rcsum
Signed-off-by: Urs Thuermann <urs@isnogud.escape.de>
---
Index: net-2.6/net/core/skbuff.c
===================================================================
--- net-2.6.orig/net/core/skbuff.c 2008-02-06 22:17:58.000000000 +0100
+++ net-2.6/net/core/skbuff.c 2008-02-08 11:05:00.000000000 +0100
@@ -2106,11 +2106,10 @@
/**
* skb_pull_rcsum - pull skb and update receive checksum
* @skb: buffer to update
- * @start: start of data before pull
* @len: length of data pulled
*
* This function performs an skb_pull on the packet and updates
- * update the CHECKSUM_COMPLETE checksum. It should be used on
+ * the CHECKSUM_COMPLETE checksum. It should be used on
* receive path processing instead of skb_pull unless you know
* that the checksum difference is zero (e.g., a valid IP header)
* or you are setting ip_summed to CHECKSUM_NONE.
^ permalink raw reply
* [RFC, PATCH]: Pass link level header from/to PPP interface
From: Urs Thuermann @ 2008-02-10 9:48 UTC (permalink / raw)
To: netdev
The PPP interface strips off the PPP header from the packet before
passing it up with netif_rx(). On the xmit path, it has to add the
PPP header itself because dev->header_ops is NULL.
This means that a PF_PACKET, SOCK_RAW socket can't get the link level
header and has to use the sll_protocol field of the sockaddr_ll to
know what type of packet is received with recvfrom(2). I consider
this a design flaw since with most (all?) other interfaces you only
need to know the sll_hatype to know what type of packet you get.
I have patched the PPP code to include the PPP header. I tried with
IP and IPv6 over PPP and it works as expected. This patch, however,
changes the interface to the user space in an incompatible way. But
IMHO we could include it, since
* PF_PACKET is Linux specific and not portable anyway. Most apps use
libpcap instead of opening PF_PACKET sockets themselves.
* Using strace on tcpdump, it seems that libpcap on Linux uses
PF_PACKET/SOCK_DGRAM for PPP interfaces and thus is not affected by
my patch.
* Other apps using PF_PACKET/SOCK_RAW can easily be changed to
PF_PACKET/SOCK_DGRAM if they don't want to see the link level
header. After all, this is what SOCK_DGRAM is for.
Currently SOCK_RAW and SOCK_DGRAM are the same although the packet(7)
man page states that with SOCK_RAW packets are passed without any
changes. This makes having SOCK_RAW besides SOCK_DGRAM useless for
PPP.
So what is your opinion about this change?
Signed-off-by: Urs Thuermann <urs@isnogud.escape.de>
---
drivers/net/ppp_generic.c | 41 ++++++++++++++++++++++++++++-------------
1 file changed, 28 insertions(+), 13 deletions(-)
Index: net-2.6/drivers/net/ppp_generic.c
===================================================================
--- net-2.6.orig/drivers/net/ppp_generic.c 2008-02-08 11:09:03.000000000 +0100
+++ net-2.6/drivers/net/ppp_generic.c 2008-02-08 13:27:29.000000000 +0100
@@ -873,12 +873,32 @@
/*
* Network interface unit routines.
*/
+
+/* Put the 2-byte PPP protocol number on the front of skb */
+static int ppp_header(struct sk_buff *skb, struct net_device *dev,
+ unsigned short type,
+ const void *daddr, const void *saddr, unsigned len)
+{
+ unsigned char *pp;
+ int npi, proto;
+
+ npi = ethertype_to_npindex(ntohs(skb->protocol));
+ if (npi < 0)
+ return -dev->hard_header_len;
+
+ pp = skb_push(skb, 2);
+ proto = npindex_to_proto[npi];
+ pp[0] = proto >> 8;
+ pp[1] = proto;
+
+ return dev->hard_header_len;
+}
+
static int
ppp_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct ppp *ppp = (struct ppp *) dev->priv;
- int npi, proto;
- unsigned char *pp;
+ int npi;
npi = ethertype_to_npindex(ntohs(skb->protocol));
if (npi < 0)
@@ -897,16 +917,6 @@
goto outf;
}
- /* Put the 2-byte PPP protocol number on the front,
- making sure there is room for the address and control fields. */
- if (skb_cow_head(skb, PPP_HDRLEN))
- goto outf;
-
- pp = skb_push(skb, 2);
- proto = npindex_to_proto[npi];
- pp[0] = proto >> 8;
- pp[1] = proto;
-
netif_stop_queue(dev);
skb_queue_tail(&ppp->file.xq, skb);
ppp_xmit_process(ppp);
@@ -969,9 +979,14 @@
return err;
}
+static const struct header_ops ppp_header_ops ____cacheline_aligned = {
+ .create = ppp_header,
+};
+
static void ppp_setup(struct net_device *dev)
{
dev->hard_header_len = PPP_HDRLEN;
+ dev->header_ops = &ppp_header_ops;
dev->mtu = PPP_MTU;
dev->addr_len = 0;
dev->tx_queue_len = 3;
@@ -1677,10 +1692,10 @@
kfree_skb(skb);
} else {
/* chop off protocol */
+ skb_reset_mac_header(skb);
skb_pull_rcsum(skb, 2);
skb->dev = ppp->dev;
skb->protocol = htons(npindex_to_ethertype[npi]);
- skb_reset_mac_header(skb);
netif_rx(skb);
ppp->dev->last_rx = jiffies;
}
^ permalink raw reply
* [PATCH resend] qla3xxx: convert byte order of constant instead of variable
From: Marcin Slusarz @ 2008-02-10 10:06 UTC (permalink / raw)
To: netdev, linux-driver; +Cc: LKML
convert byte order of constant instead of variable
which can be done at compile time (vs run time)
Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
---
drivers/net/qla3xxx.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index a6aeb9d..b7f7b22 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -2472,8 +2472,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
if (seg_cnt == 1) {
/* Terminate the last segment. */
- oal_entry->len =
- cpu_to_le32(le32_to_cpu(oal_entry->len) | OAL_LAST_ENTRY);
+ oal_entry->len |= cpu_to_le32(OAL_LAST_ENTRY);
} else {
oal = tx_cb->oal;
for (completed_segs=0; completed_segs<frag_cnt; completed_segs++,seg++) {
@@ -2530,8 +2529,7 @@ static int ql_send_map(struct ql3_adapter *qdev,
frag->size);
}
/* Terminate the last segment. */
- oal_entry->len =
- cpu_to_le32(le32_to_cpu(oal_entry->len) | OAL_LAST_ENTRY);
+ oal_entry->len |= cpu_to_le32(OAL_LAST_ENTRY);
}
return NETDEV_TX_OK;
--
1.5.3.7
^ permalink raw reply related
* Re: [RFC] ipvs: Cleanup sync daemon code
From: Sven Wegener @ 2008-02-10 11:51 UTC (permalink / raw)
To: Christoph Hellwig; +Cc: netdev, linux-kernel
In-Reply-To: <20080210045952.GA8255@infradead.org>
On Sat, 9 Feb 2008, Christoph Hellwig wrote:
> On Sun, Feb 10, 2008 at 12:38:11AM +0100, Sven Wegener wrote:
>> struct ip_vs_sync_thread_data {
>> - struct completion *startup;
>> + struct completion *startup; /* set to NULL once completed */
>
> This is not needed anmore. kthread_run guarantees that the newly
> creates thread is run before returning to the caller.
The completion is currently used to return an error code for errors that
happen during initialization in the threads (open socket, allocate
memory). We could move the setup code out of the threads and have them
only run an error-safe loop.
>> +/* wait queue for master sync daemon */
>> +static DECLARE_WAIT_QUEUE_HEAD(sync_master_wait);
>
> I don't think you need this one either. You can use wake_up_process
> on the task_struct pointer instead.
Thanks, now using schedule_timeout with wake_up_process.
>> spin_lock(&ip_vs_sync_lock);
>> list_add_tail(&sb->list, &ip_vs_sync_queue);
>> + if (++ip_vs_sync_count == 10)
>> + wake_up_interruptible(&sync_master_wait);
>> spin_unlock(&ip_vs_sync_lock);
>> }
>
>> -static int sync_thread(void *startup)
>> +static int sync_thread(void *data)
>
> Btw, it might make sense to remove sync_thread and just call the
> master and backup threads directly.
When the setup code has been moved out of the threads, the code gets much
simpler.
>> +void __init ip_vs_sync_init(void)
>> +{
>> + /* set up multicast address */
>> + mcast_addr.sin_family = AF_INET;
>> + mcast_addr.sin_port = htons(IP_VS_SYNC_PORT);
>> + mcast_addr.sin_addr.s_addr = htonl(IP_VS_SYNC_GROUP);
>> }
>
> Why can't this be initialized at compile time by:
>
> static struct sockaddr_in mcast_addr = {
> .sin_family = AF_INET,
> .sin_port = htons(IP_VS_SYNC_PORT),
> .sin_addr.s_addr = htonl(IP_VS_SYNC_GROUP),
> }
>
> (the hton* might need __constant_hton* also I'm not sure without trying)
Thanks.
^ permalink raw reply
* [PATCH v2][AX25] af_ax25: remove sock lock in ax25_info_show()
From: Jarek Poplawski @ 2008-02-10 13:10 UTC (permalink / raw)
To: David Miller
Cc: Bernard Pidoux F6BVP, Ralf Baechle DL5RB, Jann Traschewski,
netdev
In-Reply-To: <47ADF4A2.6070705@free.fr>
Hi,
Here is a little bit better version, I hope.
Regards,
Jarek P.
--------------> (take 2)
Subject: [AX25] af_ax25: remove sock lock in ax25_info_show()
This lockdep warning:
> =======================================================
> [ INFO: possible circular locking dependency detected ]
> 2.6.24 #3
> -------------------------------------------------------
> swapper/0 is trying to acquire lock:
> (ax25_list_lock){-+..}, at: [<f91dd3b1>] ax25_destroy_socket+0x171/0x1f0 [ax25]
>
> but task is already holding lock:
> (slock-AF_AX25){-+..}, at: [<f91dbabc>] ax25_std_heartbeat_expiry+0x1c/0xe0 [ax25]
>
> which lock already depends on the new lock.
...
shows that ax25_list_lock and slock-AF_AX25 are taken in different
order: ax25_info_show() takes slock (bh_lock_sock(ax25->sk)) while
ax25_list_lock is held, so reversely to other functions. To fix this
the sock lock should be moved to ax25_info_start(), and there would
be still problem with breaking ax25_list_lock (it seems this "proper"
order isn't optimal yet). But, since it's only for reading proc info
it seems this is not necessary (e.g. ax25_send_to_raw() does similar
reading without this lock too).
So, this patch removes sock lock to avoid deadlock possibility; there
is also used sock_i_ino() function, which reads sk_socket under proper
read lock. Additionally printf format of this i_ino is changed to %lu.
Reported-by: Bernard Pidoux F6BVP <f6bvp@free.fr>
Signed-off-by: Jarek Poplawski <jarkao2@gmail.com>
---
net/ax25/af_ax25.c | 6 ++----
1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/net/ax25/af_ax25.c b/net/ax25/af_ax25.c
index 94b2b1b..48bfcc7 100644
--- a/net/ax25/af_ax25.c
+++ b/net/ax25/af_ax25.c
@@ -1924,12 +1924,10 @@ static int ax25_info_show(struct seq_file *seq, void *v)
ax25->paclen);
if (ax25->sk != NULL) {
- bh_lock_sock(ax25->sk);
- seq_printf(seq," %d %d %ld\n",
+ seq_printf(seq, " %d %d %lu\n",
atomic_read(&ax25->sk->sk_wmem_alloc),
atomic_read(&ax25->sk->sk_rmem_alloc),
- ax25->sk->sk_socket != NULL ? SOCK_INODE(ax25->sk->sk_socket)->i_ino : 0L);
- bh_unlock_sock(ax25->sk);
+ sock_i_ino(ax25->sk));
} else {
seq_puts(seq, " * * *\n");
}
^ permalink raw reply related
* [PATCH] [IPV6] Minor cleanup: remove unused method declaration (net/ndisc.h).
From: Rami Rosen @ 2008-02-10 16:40 UTC (permalink / raw)
To: David Miller, netdev
[-- Attachment #1: Type: text/plain, Size: 164 bytes --]
Hi,
This patch removes unused declaration of dflt_rt_lookup() method in
include/net/ndisc.h
Regards,
Rami Rosen
Signed-off-by: Rami Rosen <ramirose@gmail.com>
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 368 bytes --]
diff --git a/include/net/ndisc.h b/include/net/ndisc.h
index 6684f7e..59b7062 100644
--- a/include/net/ndisc.h
+++ b/include/net/ndisc.h
@@ -103,7 +103,6 @@ extern void ndisc_send_redirect(struct sk_buff *skb,
extern int ndisc_mc_map(struct in6_addr *addr, char *buf, struct net_device *dev, int dir);
-struct rt6_info * dflt_rt_lookup(void);
/*
* IGMP
^ permalink raw reply related
* Re: [patch 2.6.24-git] net/enc28j60: low power mode
From: David Brownell @ 2008-02-10 17:45 UTC (permalink / raw)
To: Claudio Lanconelli; +Cc: netdev
In-Reply-To: <47AAE99D.1000908@eptar.com>
On Thursday 07 February 2008, Claudio Lanconelli wrote:
> Sorry,
> let me repeat what I said in previous mail.
> I propose you to add set_lowpower(true) in the enc28j60_probe()
As the current patch does...
> and in the enc28j60_net_close() after enc28j60_hw_disable().
> Probably we don't need to set_lowpower(false) in enc28j60_net_open() since
> it performs a soft reset with enc28j60_hw_init() (not sure).
The current patch sets the device in low power mode in hw_disable(),
and takes it out of that mode in hw_enable(). I can move them; and
the only "soft" thing about this chip's reset is when it starts from
a protocol command not the reset command.
> Furthermore, as you suggested, we also need to remove hw_init() from the
> setlink()
> because hw_init() is called when we bring link up.
>
> --- enc28j60.c 20 Dec 2007 10:47:01 -0000 1.22
> +++ enc28j60.c 7 Feb 2008 11:07:20 -0000
> @@ -740,12 +740,6 @@
> if (!priv->hw_enable) {
> if (autoneg == AUTONEG_DISABLE && speed == SPEED_10) {
> priv->full_duplex = (duplex == DUPLEX_FULL);
> - if (!enc28j60_hw_init(priv)) {
> - if (netif_msg_drv(priv))
> - dev_err(&ndev->dev,
> - "hw_reset() failed\n");
> - ret = -EINVAL;
> - }
Right. Without the patch mangling presumably done by your mailer. ;)
> } else {
> if (netif_msg_link(priv))
> dev_warn(&ndev->dev,
>
> Can you update your low power patch with these modifications?
>
Done -- see my next patch.
^ permalink raw reply
* Re: [patch 2.6.24-git] net/enc28j60: oops fix, low power mode
From: David Brownell @ 2008-02-10 17:54 UTC (permalink / raw)
To: Claudio Lanconelli; +Cc: netdev
In-Reply-To: <47AAE32A.7070105@eptar.com>
On Thursday 07 February 2008, Claudio Lanconelli wrote:
> David Brownell wrote:
> > How long did that take? I did about four dozen
> >
> > ifconfig eth1 up
> > sleep 3
> > ifconfig eth1 down
> >
> > cycles ... it worked fine. The "sleep" was to let the link
> > negotiation complete.
> >
> >
> After a couple of :
>
> ifconfig eth0 down
> (wait just 1 second)
> ifconfig eth0 up
>
> the network is frozen.
>
> If I do another
> ifconfig eth0 down
> (wait just 1 second)
> ifconfig eth0 up
>
> restarts.
> It's random, no rule.
I write a shell loop to do that, and added a "ping -c2" too.
If that was done before the "sleep 1" no packets flowed.
Afterwards, no problem -- ever.
(And outside the loop, "ethool -s eth1 duplex full".)
^ permalink raw reply
* Re: [patch 2.6.24-git] net/enc28j60: low power mode
From: David Brownell @ 2008-02-10 17:46 UTC (permalink / raw)
To: Claudio Lanconelli; +Cc: netdev
In-Reply-To: <47AAE99D.1000908@eptar.com>
Keep enc28j60 chips in low-power mode when they're not in use.
At typically 120 mA, these chips run hot even when idle; this
low power mode cuts that power usage by a factor of around 100.
This version provides a generic routine to poll a register until
its masked value equals some value ... e.g. bit set or cleared.
It's basically what the previous wait_phy_ready() did, but this
version is generalized to support the handshaking needed to
enter and exit low power mode.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
drivers/net/enc28j60.c | 81 ++++++++++++++++++++++++++++++++++---------------
1 files changed, 57 insertions(+), 24 deletions(-)
--- a/drivers/net/enc28j60.c
+++ b/drivers/net/enc28j60.c
@@ -400,26 +400,31 @@ enc28j60_packet_write(struct enc28j60_ne
mutex_unlock(&priv->lock);
}
-/*
- * Wait until the PHY operation is complete.
- */
-static int wait_phy_ready(struct enc28j60_net *priv)
+static unsigned long msec20_to_jiffies;
+
+static int poll_ready(struct enc28j60_net *priv, u8 reg, u8 mask, u8 val)
{
- unsigned long timeout = jiffies + 20 * HZ / 1000;
- int ret = 1;
+ unsigned long timeout = jiffies + msec20_to_jiffies;
/* 20 msec timeout read */
- while (nolock_regb_read(priv, MISTAT) & MISTAT_BUSY) {
+ while ((nolock_regb_read(priv, reg) & mask) != val) {
if (time_after(jiffies, timeout)) {
if (netif_msg_drv(priv))
- printk(KERN_DEBUG DRV_NAME
- ": PHY ready timeout!\n");
- ret = 0;
- break;
+ dev_dbg(&priv->spi->dev,
+ "reg %02x ready timeout!\n", reg);
+ return -ETIMEDOUT;
}
cpu_relax();
}
- return ret;
+ return 0;
+}
+
+/*
+ * Wait until the PHY operation is complete.
+ */
+static int wait_phy_ready(struct enc28j60_net *priv)
+{
+ return poll_ready(priv, MISTAT, MISTAT_BUSY, 0) ? 0 : 1;
}
/*
@@ -594,6 +599,32 @@ static void nolock_txfifo_init(struct en
nolock_regw_write(priv, ETXNDL, end);
}
+/*
+ * Low power mode shrinks power consumption about 100x, so we'd like
+ * the chip to be in that mode whenever it's inactive. (However, we
+ * can't stay in lowpower mode during suspend with WOL active.)
+ */
+static void enc28j60_lowpower(struct enc28j60_net *priv, bool is_low)
+{
+ if (netif_msg_drv(priv))
+ dev_dbg(&priv->spi->dev, "%s power...\n",
+ is_low ? "low" : "high");
+
+ mutex_lock(&priv->lock);
+ if (is_low) {
+ nolock_reg_bfclr(priv, ECON1, ECON1_RXEN);
+ poll_ready(priv, ESTAT, ESTAT_RXBUSY, 0);
+ poll_ready(priv, ECON1, ECON1_TXRTS, 0);
+ /* ECON2_VRPS was set during initialization */
+ nolock_reg_bfset(priv, ECON2, ECON2_PWRSV);
+ } else {
+ nolock_reg_bfclr(priv, ECON2, ECON2_PWRSV);
+ poll_ready(priv, ESTAT, ESTAT_CLKRDY, ESTAT_CLKRDY);
+ /* caller sets ECON1_RXEN */
+ }
+ mutex_unlock(&priv->lock);
+}
+
static int enc28j60_hw_init(struct enc28j60_net *priv)
{
u8 reg;
@@ -612,8 +643,8 @@ static int enc28j60_hw_init(struct enc28
priv->tx_retry_count = 0;
priv->max_pk_counter = 0;
priv->rxfilter = RXFILTER_NORMAL;
- /* enable address auto increment */
- nolock_regb_write(priv, ECON2, ECON2_AUTOINC);
+ /* enable address auto increment and voltage regulator powersave */
+ nolock_regb_write(priv, ECON2, ECON2_AUTOINC | ECON2_VRPS);
nolock_rxfifo_init(priv, RXSTART_INIT, RXEND_INIT);
nolock_txfifo_init(priv, TXSTART_INIT, TXEND_INIT);
@@ -690,7 +721,7 @@ static int enc28j60_hw_init(struct enc28
static void enc28j60_hw_enable(struct enc28j60_net *priv)
{
- /* enable interrutps */
+ /* enable interrupts */
if (netif_msg_hw(priv))
printk(KERN_DEBUG DRV_NAME ": %s() enabling interrupts.\n",
__FUNCTION__);
@@ -726,15 +757,12 @@ enc28j60_setlink(struct net_device *ndev
int ret = 0;
if (!priv->hw_enable) {
- if (autoneg == AUTONEG_DISABLE && speed == SPEED_10) {
+ /* link is in low power mode now; duplex setting
+ * will take effect on next enc28j60_hw_init().
+ */
+ if (autoneg == AUTONEG_DISABLE && speed == SPEED_10)
priv->full_duplex = (duplex == DUPLEX_FULL);
- if (!enc28j60_hw_init(priv)) {
- if (netif_msg_drv(priv))
- dev_err(&ndev->dev,
- "hw_reset() failed\n");
- ret = -EINVAL;
- }
- } else {
+ else {
if (netif_msg_link(priv))
dev_warn(&ndev->dev,
"unsupported link setting\n");
@@ -1307,7 +1335,7 @@ static int enc28j60_net_open(struct net_
}
return -EADDRNOTAVAIL;
}
- /* Reset the hardware here */
+ /* Reset the hardware here (and take it out of low power mode) */
enc28j60_hw_disable(priv);
if (!enc28j60_hw_init(priv)) {
if (netif_msg_ifup(priv))
@@ -1337,6 +1365,7 @@ static int enc28j60_net_close(struct net
printk(KERN_DEBUG DRV_NAME ": %s() enter\n", __FUNCTION__);
enc28j60_hw_disable(priv);
+ enc28j60_lowpower(priv, true);
netif_stop_queue(dev);
return 0;
@@ -1537,6 +1566,8 @@ static int __devinit enc28j60_probe(stru
dev->watchdog_timeo = TX_TIMEOUT;
SET_ETHTOOL_OPS(dev, &enc28j60_ethtool_ops);
+ enc28j60_lowpower(priv, true);
+
ret = register_netdev(dev);
if (ret) {
if (netif_msg_probe(priv))
@@ -1582,6 +1613,8 @@ static struct spi_driver enc28j60_driver
static int __init enc28j60_init(void)
{
+ msec20_to_jiffies = msecs_to_jiffies(20);
+
return spi_register_driver(&enc28j60_driver);
}
^ permalink raw reply
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