* [PATCH 0/2] Clean up owner field in sock_lock_t
From: John Heffner @ 2007-09-11 18:01 UTC (permalink / raw)
To: davem; +Cc: netdev, John Heffner
I don't know why the owner field is a (struct sock_iocb *). I'm assuming
it's historical. Can someone check this out? Did I miss some alternate
usage?
These patches are against net-2.6.24.
^ permalink raw reply
* [PATCH 1/2] [NET] Cleanup: Use sock_owned_by_user() macro
From: John Heffner @ 2007-09-11 18:01 UTC (permalink / raw)
To: davem; +Cc: netdev, John Heffner
In-Reply-To: <11895336933187-git-send-email-jheffner@psc.edu>
Changes asserts in sunrpc to use sock_owned_by_user() macro instead of
referencing sock_lock.owner directly.
Signed-off-by: John Heffner <jheffner@psc.edu>
---
net/sunrpc/svcsock.c | 2 +-
net/sunrpc/xprtsock.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index ed17a50..3a95612 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -104,7 +104,7 @@ static struct lock_class_key svc_slock_key[2];
static inline void svc_reclassify_socket(struct socket *sock)
{
struct sock *sk = sock->sk;
- BUG_ON(sk->sk_lock.owner != NULL);
+ BUG_ON(sock_owned_by_user(sk));
switch (sk->sk_family) {
case AF_INET:
sock_lock_init_class_and_name(sk, "slock-AF_INET-NFSD",
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index 4ae7eed..282efd4 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -1186,7 +1186,7 @@ static struct lock_class_key xs_slock_key[2];
static inline void xs_reclassify_socket(struct socket *sock)
{
struct sock *sk = sock->sk;
- BUG_ON(sk->sk_lock.owner != NULL);
+ BUG_ON(sock_owned_by_user(sk));
switch (sk->sk_family) {
case AF_INET:
sock_lock_init_class_and_name(sk, "slock-AF_INET-NFS",
--
1.5.3.rc7.30.g947ad2
^ permalink raw reply related
* [PATCH 2/2] [NET] Change type of owner in sock_lock_t to int, rename
From: John Heffner @ 2007-09-11 18:01 UTC (permalink / raw)
To: davem; +Cc: netdev, John Heffner
In-Reply-To: <11895336943821-git-send-email-jheffner@psc.edu>
The type of owner in sock_lock_t is currently (struct sock_iocb *),
presumably for historical reasons. It is never used as this type, only
tested as NULL or set to (void *)1. For clarity, this changes it to type
int, and renames to owned, to avoid any possible type casting errors.
Signed-off-by: John Heffner <jheffner@psc.edu>
---
include/net/sock.h | 7 +++----
net/core/sock.c | 6 +++---
2 files changed, 6 insertions(+), 7 deletions(-)
diff --git a/include/net/sock.h b/include/net/sock.h
index 802c670..5ed9fa4 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -76,10 +76,9 @@
* between user contexts and software interrupt processing, whereas the
* mini-semaphore synchronizes multiple users amongst themselves.
*/
-struct sock_iocb;
typedef struct {
spinlock_t slock;
- struct sock_iocb *owner;
+ int owned;
wait_queue_head_t wq;
/*
* We express the mutex-alike socket_lock semantics
@@ -737,7 +736,7 @@ static inline int sk_stream_wmem_schedule(struct sock *sk, int size)
* Since ~2.3.5 it is also exclusive sleep lock serializing
* accesses from user process context.
*/
-#define sock_owned_by_user(sk) ((sk)->sk_lock.owner)
+#define sock_owned_by_user(sk) ((sk)->sk_lock.owned)
/*
* Macro so as to not evaluate some arguments when
@@ -748,7 +747,7 @@ static inline int sk_stream_wmem_schedule(struct sock *sk, int size)
*/
#define sock_lock_init_class_and_name(sk, sname, skey, name, key) \
do { \
- sk->sk_lock.owner = NULL; \
+ sk->sk_lock.owned = 0; \
init_waitqueue_head(&sk->sk_lock.wq); \
spin_lock_init(&(sk)->sk_lock.slock); \
debug_check_no_locks_freed((void *)&(sk)->sk_lock, \
diff --git a/net/core/sock.c b/net/core/sock.c
index cfed7d4..edbc562 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -1575,9 +1575,9 @@ void fastcall lock_sock_nested(struct sock *sk, int subclass)
{
might_sleep();
spin_lock_bh(&sk->sk_lock.slock);
- if (sk->sk_lock.owner)
+ if (sk->sk_lock.owned)
__lock_sock(sk);
- sk->sk_lock.owner = (void *)1;
+ sk->sk_lock.owned = 1;
spin_unlock(&sk->sk_lock.slock);
/*
* The sk_lock has mutex_lock() semantics here:
@@ -1598,7 +1598,7 @@ void fastcall release_sock(struct sock *sk)
spin_lock_bh(&sk->sk_lock.slock);
if (sk->sk_backlog.tail)
__release_sock(sk);
- sk->sk_lock.owner = NULL;
+ sk->sk_lock.owned = 0;
if (waitqueue_active(&sk->sk_lock.wq))
wake_up(&sk->sk_lock.wq);
spin_unlock_bh(&sk->sk_lock.slock);
--
1.5.3.rc7.30.g947ad2
^ permalink raw reply related
* [PATCH v2] Move the definition of pr_err() into kernel.h
From: Emil Medve @ 2007-09-11 18:13 UTC (permalink / raw)
To: linux-kernel, netdev, i2c, linux-omap-open-source; +Cc: Emil Medve
Other pr_*() macros are already defined in kernel.h, but pr_err() was defined
multiple times in several other places
Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
---
I'm writing a driver and I've been using the pr_*() macros from kernel.h and I
was surprised not to find there pr_err() but defined multiple times (in four
different files). I didn't want to define it yet one more time so I did this
cleanup
This patch is against Linus' tree v2.6.23-rc6 (0d4cbb5e7f60b2f1a4d8b7f6ea4cc264262c7a01)
linux-2.6> scripts/checkpatch.pl 0001-Move-the-definition-of-pr_err-into-kernel.h.patch
Your patch has no obvious style problems and is ready for submission.
drivers/i2c/chips/menelaus.c | 10 ++++------
drivers/net/spider_net.h | 3 ---
drivers/video/omap/lcd_h3.c | 6 ++----
drivers/video/omap/lcd_inn1610.c | 6 ++----
include/linux/kernel.h | 2 ++
5 files changed, 10 insertions(+), 17 deletions(-)
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c
index d9c92c5..66436ba 100644
--- a/drivers/i2c/chips/menelaus.c
+++ b/drivers/i2c/chips/menelaus.c
@@ -49,8 +49,6 @@
#define DRIVER_NAME "menelaus"
-#define pr_err(fmt, arg...) printk(KERN_ERR DRIVER_NAME ": ", ## arg);
-
#define MENELAUS_I2C_ADDRESS 0x72
#define MENELAUS_REV 0x01
@@ -155,7 +153,7 @@ static int menelaus_write_reg(int reg, u8 value)
int val = i2c_smbus_write_byte_data(the_menelaus->client, reg, value);
if (val < 0) {
- pr_err("write error");
+ pr_err(DRIVER_NAME ": write error");
return val;
}
@@ -167,7 +165,7 @@ static int menelaus_read_reg(int reg)
int val = i2c_smbus_read_byte_data(the_menelaus->client, reg);
if (val < 0)
- pr_err("read error");
+ pr_err(DRIVER_NAME ": read error");
return val;
}
@@ -1177,7 +1175,7 @@ static int menelaus_probe(struct i2c_client *client)
/* If a true probe check the device */
rev = menelaus_read_reg(MENELAUS_REV);
if (rev < 0) {
- pr_err("device not found");
+ pr_err(DRIVER_NAME ": device not found");
err = -ENODEV;
goto fail1;
}
@@ -1258,7 +1256,7 @@ static int __init menelaus_init(void)
res = i2c_add_driver(&menelaus_i2c_driver);
if (res < 0) {
- pr_err("driver registration failed\n");
+ pr_err(DRIVER_NAME ": driver registration failed\n");
return res;
}
diff --git a/drivers/net/spider_net.h b/drivers/net/spider_net.h
index dbbdb8c..c67b11d 100644
--- a/drivers/net/spider_net.h
+++ b/drivers/net/spider_net.h
@@ -493,7 +493,4 @@ struct spider_net_card {
struct spider_net_descr darray[0];
};
-#define pr_err(fmt,arg...) \
- printk(KERN_ERR fmt ,##arg)
-
#endif
diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/omap/lcd_h3.c
index 51807b4..c604d93 100644
--- a/drivers/video/omap/lcd_h3.c
+++ b/drivers/video/omap/lcd_h3.c
@@ -28,8 +28,6 @@
#define MODULE_NAME "omapfb-lcd_h3"
-#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
-
static int h3_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev)
{
return 0;
@@ -48,7 +46,7 @@ static int h3_panel_enable(struct lcd_panel *panel)
if (!r)
r = tps65010_set_gpio_out_value(GPIO2, HIGH);
if (r)
- pr_err("Unable to turn on LCD panel\n");
+ pr_err(MODULE_NAME ": Unable to turn on LCD panel\n");
return r;
}
@@ -62,7 +60,7 @@ static void h3_panel_disable(struct lcd_panel *panel)
if (!r)
tps65010_set_gpio_out_value(GPIO2, LOW);
if (r)
- pr_err("Unable to turn off LCD panel\n");
+ pr_err(MODULE_NAME ": Unable to turn off LCD panel\n");
}
static unsigned long h3_panel_get_caps(struct lcd_panel *panel)
diff --git a/drivers/video/omap/lcd_inn1610.c b/drivers/video/omap/lcd_inn1610.c
index 95604ca..5ef119c 100644
--- a/drivers/video/omap/lcd_inn1610.c
+++ b/drivers/video/omap/lcd_inn1610.c
@@ -27,20 +27,18 @@
#define MODULE_NAME "omapfb-lcd_h3"
-#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args)
-
static int innovator1610_panel_init(struct lcd_panel *panel,
struct omapfb_device *fbdev)
{
int r = 0;
if (omap_request_gpio(14)) {
- pr_err("can't request GPIO 14\n");
+ pr_err(MODULE_NAME ": can't request GPIO 14\n");
r = -1;
goto exit;
}
if (omap_request_gpio(15)) {
- pr_err("can't request GPIO 15\n");
+ pr_err(MODULE_NAME ": can't request GPIO 15\n");
omap_free_gpio(14);
r = -1;
goto exit;
diff --git a/include/linux/kernel.h b/include/linux/kernel.h
index f592df7..c51936a 100644
--- a/include/linux/kernel.h
+++ b/include/linux/kernel.h
@@ -242,6 +242,8 @@ static inline int __attribute__ ((format (printf, 1, 2))) pr_debug(const char *
#define pr_info(fmt,arg...) \
printk(KERN_INFO fmt,##arg)
+#define pr_err(fmt, arg...) \
+ printk(KERN_ERR fmt, ##arg)
/*
* Display an IP address in readable format.
--
1.5.3.GIT
^ permalink raw reply related
* [PATCH] include listenq max/backlog in tcp_info and related reports
From: Rick Jones @ 2007-09-11 18:31 UTC (permalink / raw)
To: netdev
Return some useful information such as the maximum listen backlog and
the current listen backlog in the tcp_info structure and have that
match what one can see in /proc/net/tcp and /proc/net/tcp6.
Signed-off-by: Rick Jones <rick.jones2@hp.com>
---
diff -r bdcdd0e1ee9d Documentation/networking/proc_net_tcp.txt
--- a/Documentation/networking/proc_net_tcp.txt Sat Sep 01 07:00:31 2007 +0000
+++ b/Documentation/networking/proc_net_tcp.txt Mon Sep 10 16:09:46 2007 -0700
@@ -20,8 +20,8 @@ up into 3 parts because of the length of
| | | | |--> number of unrecovered RTO timeouts
| | | |----------> number of jiffies until timer expires
| | |----------------> timer_active (see below)
- | |----------------------> receive-queue
- |-------------------------------> transmit-queue
+ | |----------------------> receive-queue or connection backlog
+ |-------------------------------> transmit-queue or connection limit
1000 0 54165785 4 cd1e6040 25 4 27 3 -1
| | | | | | | | | |--> slow start size threshold,
diff -r bdcdd0e1ee9d net/ipv4/tcp.c
--- a/net/ipv4/tcp.c Sat Sep 01 07:00:31 2007 +0000
+++ b/net/ipv4/tcp.c Mon Sep 10 16:09:46 2007 -0700
@@ -2030,8 +2030,14 @@ void tcp_get_info(struct sock *sk, struc
info->tcpi_snd_mss = tp->mss_cache;
info->tcpi_rcv_mss = icsk->icsk_ack.rcv_mss;
- info->tcpi_unacked = tp->packets_out;
- info->tcpi_sacked = tp->sacked_out;
+ if (sk->sk_state == TCP_LISTEN) {
+ info->tcpi_unacked = sk->sk_ack_backlog;
+ info->tcpi_sacked = sk->sk_max_ack_backlog;
+ }
+ else {
+ info->tcpi_unacked = tp->packets_out;
+ info->tcpi_sacked = tp->sacked_out;
+ }
info->tcpi_lost = tp->lost_out;
info->tcpi_retrans = tp->retrans_out;
info->tcpi_fackets = tp->fackets_out;
diff -r bdcdd0e1ee9d net/ipv4/tcp_ipv4.c
--- a/net/ipv4/tcp_ipv4.c Sat Sep 01 07:00:31 2007 +0000
+++ b/net/ipv4/tcp_ipv4.c Mon Sep 10 16:09:46 2007 -0700
@@ -2320,7 +2320,8 @@ static void get_tcp4_sock(struct sock *s
sprintf(tmpbuf, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
"%08X %5d %8d %lu %d %p %u %u %u %u %d",
i, src, srcp, dest, destp, sk->sk_state,
- tp->write_seq - tp->snd_una,
+ sk->sk_state == TCP_LISTEN ? sk->sk_max_ack_backlog :
+ (tp->write_seq - tp->snd_una),
sk->sk_state == TCP_LISTEN ? sk->sk_ack_backlog :
(tp->rcv_nxt - tp->copied_seq),
timer_active,
diff -r bdcdd0e1ee9d net/ipv6/tcp_ipv6.c
--- a/net/ipv6/tcp_ipv6.c Sat Sep 01 07:00:31 2007 +0000
+++ b/net/ipv6/tcp_ipv6.c Mon Sep 10 16:09:46 2007 -0700
@@ -2005,8 +2005,10 @@ static void get_tcp6_sock(struct seq_fil
dest->s6_addr32[0], dest->s6_addr32[1],
dest->s6_addr32[2], dest->s6_addr32[3], destp,
sp->sk_state,
- tp->write_seq-tp->snd_una,
- (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq),
+ (sp->sk_state == TCP_LISTEN) ? sp->sk_max_ack_backlog:
+ tp->write_seq-tp->snd_una,
+ (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog :
+ (tp->rcv_nxt - tp->copied_seq),
timer_active,
jiffies_to_clock_t(timer_expires - jiffies),
icsk->icsk_retransmits,
^ permalink raw reply
* [PATCH] include listenq max/backlog in tcp_info and related reports - correct version
From: Rick Jones @ 2007-09-11 18:31 UTC (permalink / raw)
To: netdev
Return some useful information such as the maximum listen backlog and the
current listen backlog in the tcp_info structure and have that match what
one can see in /proc/net/tcp, /proc/net/tcp6, and INET_DIAG_INFO.
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
Signed-off-by: Rick Jones <rick.jones2@hp.com>
---
diff -r bdcdd0e1ee9d Documentation/networking/proc_net_tcp.txt
--- a/Documentation/networking/proc_net_tcp.txt Sat Sep 01 07:00:31 2007 +0000
+++ b/Documentation/networking/proc_net_tcp.txt Tue Sep 11 10:38:23 2007 -0700
@@ -20,8 +20,8 @@ up into 3 parts because of the length of
| | | | |--> number of unrecovered RTO timeouts
| | | |----------> number of jiffies until timer expires
| | |----------------> timer_active (see below)
- | |----------------------> receive-queue
- |-------------------------------> transmit-queue
+ | |----------------------> receive-queue or connection backlog
+ |-------------------------------> transmit-queue or connection limit
1000 0 54165785 4 cd1e6040 25 4 27 3 -1
| | | | | | | | | |--> slow start size threshold,
diff -r bdcdd0e1ee9d net/ipv4/tcp.c
--- a/net/ipv4/tcp.c Sat Sep 01 07:00:31 2007 +0000
+++ b/net/ipv4/tcp.c Tue Sep 11 10:38:23 2007 -0700
@@ -2030,8 +2030,14 @@ void tcp_get_info(struct sock *sk, struc
info->tcpi_snd_mss = tp->mss_cache;
info->tcpi_rcv_mss = icsk->icsk_ack.rcv_mss;
- info->tcpi_unacked = tp->packets_out;
- info->tcpi_sacked = tp->sacked_out;
+ if (sk->sk_state == TCP_LISTEN) {
+ info->tcpi_unacked = sk->sk_ack_backlog;
+ info->tcpi_sacked = sk->sk_max_ack_backlog;
+ }
+ else {
+ info->tcpi_unacked = tp->packets_out;
+ info->tcpi_sacked = tp->sacked_out;
+ }
info->tcpi_lost = tp->lost_out;
info->tcpi_retrans = tp->retrans_out;
info->tcpi_fackets = tp->fackets_out;
diff -r bdcdd0e1ee9d net/ipv4/tcp_diag.c
--- a/net/ipv4/tcp_diag.c Sat Sep 01 07:00:31 2007 +0000
+++ b/net/ipv4/tcp_diag.c Tue Sep 11 10:38:23 2007 -0700
@@ -25,11 +25,14 @@ static void tcp_diag_get_info(struct soc
const struct tcp_sock *tp = tcp_sk(sk);
struct tcp_info *info = _info;
- if (sk->sk_state == TCP_LISTEN)
+ if (sk->sk_state == TCP_LISTEN) {
r->idiag_rqueue = sk->sk_ack_backlog;
- else
+ r->idiag_wqueue = sk->sk_max_ack_backlog;
+ }
+ else {
r->idiag_rqueue = tp->rcv_nxt - tp->copied_seq;
- r->idiag_wqueue = tp->write_seq - tp->snd_una;
+ r->idiag_wqueue = tp->write_seq - tp->snd_una;
+ }
if (info != NULL)
tcp_get_info(sk, info);
}
diff -r bdcdd0e1ee9d net/ipv4/tcp_ipv4.c
--- a/net/ipv4/tcp_ipv4.c Sat Sep 01 07:00:31 2007 +0000
+++ b/net/ipv4/tcp_ipv4.c Tue Sep 11 10:38:23 2007 -0700
@@ -2320,7 +2320,8 @@ static void get_tcp4_sock(struct sock *s
sprintf(tmpbuf, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
"%08X %5d %8d %lu %d %p %u %u %u %u %d",
i, src, srcp, dest, destp, sk->sk_state,
- tp->write_seq - tp->snd_una,
+ sk->sk_state == TCP_LISTEN ? sk->sk_max_ack_backlog :
+ (tp->write_seq - tp->snd_una),
sk->sk_state == TCP_LISTEN ? sk->sk_ack_backlog :
(tp->rcv_nxt - tp->copied_seq),
timer_active,
diff -r bdcdd0e1ee9d net/ipv6/tcp_ipv6.c
--- a/net/ipv6/tcp_ipv6.c Sat Sep 01 07:00:31 2007 +0000
+++ b/net/ipv6/tcp_ipv6.c Tue Sep 11 10:38:23 2007 -0700
@@ -2005,8 +2005,10 @@ static void get_tcp6_sock(struct seq_fil
dest->s6_addr32[0], dest->s6_addr32[1],
dest->s6_addr32[2], dest->s6_addr32[3], destp,
sp->sk_state,
- tp->write_seq-tp->snd_una,
- (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq),
+ (sp->sk_state == TCP_LISTEN) ? sp->sk_max_ack_backlog:
+ tp->write_seq-tp->snd_una,
+ (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog :
+ (tp->rcv_nxt - tp->copied_seq),
timer_active,
jiffies_to_clock_t(timer_expires - jiffies),
icsk->icsk_retransmits,
^ permalink raw reply
* Re: [PATCH] include listenq max/backlog in tcp_info and related reports
From: Rick Jones @ 2007-09-11 18:36 UTC (permalink / raw)
To: Rick Jones; +Cc: netdev
In-Reply-To: <200709111831.LAA06892@tardy.cup.hp.com>
please ignore - I resent the original patch by mistake...grrr.
rick jones
^ permalink raw reply
* Re: [PATCH] Document non-semantics of atomic_read() and atomic_set()
From: Christoph Lameter @ 2007-09-11 19:35 UTC (permalink / raw)
To: Chris Snook
Cc: Linus Torvalds, Denys Vlasenko, Kyle Moffett, Arjan van de Ven,
Nick Piggin, Satyam Sharma, Herbert Xu, Paul Mackerras,
Ilpo Jarvinen, Paul E. McKenney, Stefan Richter,
Linux Kernel Mailing List, linux-arch, Netdev, Andrew Morton, ak,
heiko.carstens, David Miller, schwidefsky, wensong, horms, wjiang,
cfriesen, zlynx, rpjday, jesper.juhl, segher
In-Reply-To: <20070910231944.GA3484@shell.boston.redhat.com>
Acked-by: Christoph Lameter <clameter@sgi.com>
^ permalink raw reply
* RE: [PATCH v2] Move the definition of pr_err() into kernel.h
From: Waskiewicz Jr, Peter P @ 2007-09-11 19:48 UTC (permalink / raw)
To: Emil Medve, linux-kernel, netdev, i2c, linux-omap-open-source
In-Reply-To: <11895344211267-git-send-email-Emilian.Medve@Freescale.com>
> Other pr_*() macros are already defined in kernel.h, but
> pr_err() was defined multiple times in several other places
>
> Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
> ---
>
> I'm writing a driver and I've been using the pr_*() macros
> from kernel.h and I was surprised not to find there pr_err()
> but defined multiple times (in four different files). I
> didn't want to define it yet one more time so I did this cleanup
>
> This patch is against Linus' tree v2.6.23-rc6
> (0d4cbb5e7f60b2f1a4d8b7f6ea4cc264262c7a01)
>
> linux-2.6> scripts/checkpatch.pl
> 0001-Move-the-definition-of-pr_err-into-kernel.h.patch
> Your patch has no obvious style problems and is ready for submission.
Almost. :-)
>
> drivers/i2c/chips/menelaus.c | 10 ++++------
> drivers/net/spider_net.h | 3 ---
> drivers/video/omap/lcd_h3.c | 6 ++----
> drivers/video/omap/lcd_inn1610.c | 6 ++----
> include/linux/kernel.h | 2 ++
> 5 files changed, 10 insertions(+), 17 deletions(-)
>
> diff --git a/drivers/i2c/chips/menelaus.c
> b/drivers/i2c/chips/menelaus.c index d9c92c5..66436ba 100644
> --- a/drivers/i2c/chips/menelaus.c
> +++ b/drivers/i2c/chips/menelaus.c
> @@ -49,8 +49,6 @@
>
> #define DRIVER_NAME "menelaus"
>
> -#define pr_err(fmt, arg...) printk(KERN_ERR DRIVER_NAME ":
> ", ## arg);
> -
Unnecessary whitespace removal.
> #define MENELAUS_I2C_ADDRESS 0x72
>
> #define MENELAUS_REV 0x01
> @@ -155,7 +153,7 @@ static int menelaus_write_reg(int reg, u8 value)
> int val =
> i2c_smbus_write_byte_data(the_menelaus->client, reg, value);
>
> if (val < 0) {
> - pr_err("write error");
> + pr_err(DRIVER_NAME ": write error");
> return val;
> }
>
> @@ -167,7 +165,7 @@ static int menelaus_read_reg(int reg)
> int val = i2c_smbus_read_byte_data(the_menelaus->client, reg);
>
> if (val < 0)
> - pr_err("read error");
> + pr_err(DRIVER_NAME ": read error");
>
> return val;
> }
> @@ -1177,7 +1175,7 @@ static int menelaus_probe(struct
> i2c_client *client)
> /* If a true probe check the device */
> rev = menelaus_read_reg(MENELAUS_REV);
> if (rev < 0) {
> - pr_err("device not found");
> + pr_err(DRIVER_NAME ": device not found");
> err = -ENODEV;
> goto fail1;
> }
> @@ -1258,7 +1256,7 @@ static int __init menelaus_init(void)
>
> res = i2c_add_driver(&menelaus_i2c_driver);
> if (res < 0) {
> - pr_err("driver registration failed\n");
> + pr_err(DRIVER_NAME ": driver registration failed\n");
> return res;
> }
>
> diff --git a/drivers/net/spider_net.h
> b/drivers/net/spider_net.h index dbbdb8c..c67b11d 100644
> --- a/drivers/net/spider_net.h
> +++ b/drivers/net/spider_net.h
> @@ -493,7 +493,4 @@ struct spider_net_card {
> struct spider_net_descr darray[0];
> };
>
> -#define pr_err(fmt,arg...) \
> - printk(KERN_ERR fmt ,##arg)
> -
Unnecessary whitespace removal.
> #endif
> diff --git a/drivers/video/omap/lcd_h3.c
> b/drivers/video/omap/lcd_h3.c index 51807b4..c604d93 100644
> --- a/drivers/video/omap/lcd_h3.c
> +++ b/drivers/video/omap/lcd_h3.c
> @@ -28,8 +28,6 @@
>
> #define MODULE_NAME "omapfb-lcd_h3"
>
> -#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ":
> " fmt, ## args)
> -
Unnecessary whitespace removal.
> static int h3_panel_init(struct lcd_panel *panel, struct
> omapfb_device *fbdev) {
> return 0;
> @@ -48,7 +46,7 @@ static int h3_panel_enable(struct lcd_panel *panel)
> if (!r)
> r = tps65010_set_gpio_out_value(GPIO2, HIGH);
> if (r)
> - pr_err("Unable to turn on LCD panel\n");
> + pr_err(MODULE_NAME ": Unable to turn on LCD panel\n");
>
> return r;
> }
> @@ -62,7 +60,7 @@ static void h3_panel_disable(struct
> lcd_panel *panel)
> if (!r)
> tps65010_set_gpio_out_value(GPIO2, LOW);
> if (r)
> - pr_err("Unable to turn off LCD panel\n");
> + pr_err(MODULE_NAME ": Unable to turn off LCD panel\n");
> }
>
> static unsigned long h3_panel_get_caps(struct lcd_panel
> *panel) diff --git a/drivers/video/omap/lcd_inn1610.c
> b/drivers/video/omap/lcd_inn1610.c
> index 95604ca..5ef119c 100644
> --- a/drivers/video/omap/lcd_inn1610.c
> +++ b/drivers/video/omap/lcd_inn1610.c
> @@ -27,20 +27,18 @@
>
> #define MODULE_NAME "omapfb-lcd_h3"
>
> -#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ":
> " fmt, ## args)
> -
Unnecessary whitespace removal.
> static int innovator1610_panel_init(struct lcd_panel *panel,
> struct omapfb_device *fbdev)
> {
> int r = 0;
>
> if (omap_request_gpio(14)) {
> - pr_err("can't request GPIO 14\n");
> + pr_err(MODULE_NAME ": can't request GPIO 14\n");
> r = -1;
> goto exit;
> }
> if (omap_request_gpio(15)) {
> - pr_err("can't request GPIO 15\n");
> + pr_err(MODULE_NAME ": can't request GPIO 15\n");
> omap_free_gpio(14);
> r = -1;
> goto exit;
> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> index f592df7..c51936a 100644
> --- a/include/linux/kernel.h
> +++ b/include/linux/kernel.h
> @@ -242,6 +242,8 @@ static inline int __attribute__ ((format
> (printf, 1, 2))) pr_debug(const char *
>
> #define pr_info(fmt,arg...) \
> printk(KERN_INFO fmt,##arg)
> +#define pr_err(fmt, arg...) \
> + printk(KERN_ERR fmt, ##arg)
>
> /*
> * Display an IP address in readable format.
> --
> 1.5.3.GIT
Cheers,
-PJ Waskiewicz
Intel Corp.
peter.p.waskiewicz.jr@intel.com
^ permalink raw reply
* RE: [PATCH v2] Move the definition of pr_err() into kernel.h
From: Medve Emilian-EMMEDVE1 @ 2007-09-11 19:56 UTC (permalink / raw)
To: linux-kernel, netdev, i2c, linux-omap-open-source
In-Reply-To: <D5C1322C3E673F459512FB59E0DDC32903925779@orsmsx414.amr.corp.intel.com>
> -----Original Message-----
> From: Waskiewicz Jr, Peter P [mailto:peter.p.waskiewicz.jr@intel.com]
> Sent: Tuesday, September 11, 2007 2:48 PM
> To: Medve Emilian-EMMEDVE1; linux-kernel@vger.kernel.org;
> netdev@vger.kernel.org; i2c@lm-sensors.org;
> linux-omap-open-source@linux.omap.com
> Subject: RE: [PATCH v2] Move the definition of pr_err() into kernel.h
>
> > Other pr_*() macros are already defined in kernel.h, but
> > pr_err() was defined multiple times in several other places
> >
> > Signed-off-by: Emil Medve <Emilian.Medve@Freescale.com>
> > ---
> >
> > I'm writing a driver and I've been using the pr_*() macros
> > from kernel.h and I was surprised not to find there pr_err()
> > but defined multiple times (in four different files). I
> > didn't want to define it yet one more time so I did this cleanup
> >
> > This patch is against Linus' tree v2.6.23-rc6
> > (0d4cbb5e7f60b2f1a4d8b7f6ea4cc264262c7a01)
> >
> > linux-2.6> scripts/checkpatch.pl
> > 0001-Move-the-definition-of-pr_err-into-kernel.h.patch
> > Your patch has no obvious style problems and is ready for
> submission.
>
> Almost. :-)
>
> >
> > drivers/i2c/chips/menelaus.c | 10 ++++------
> > drivers/net/spider_net.h | 3 ---
> > drivers/video/omap/lcd_h3.c | 6 ++----
> > drivers/video/omap/lcd_inn1610.c | 6 ++----
> > include/linux/kernel.h | 2 ++
> > 5 files changed, 10 insertions(+), 17 deletions(-)
> >
> > diff --git a/drivers/i2c/chips/menelaus.c
> > b/drivers/i2c/chips/menelaus.c index d9c92c5..66436ba 100644
> > --- a/drivers/i2c/chips/menelaus.c
> > +++ b/drivers/i2c/chips/menelaus.c
> > @@ -49,8 +49,6 @@
> >
> > #define DRIVER_NAME "menelaus"
> >
> > -#define pr_err(fmt, arg...) printk(KERN_ERR DRIVER_NAME ":
> > ", ## arg);
> > -
>
> Unnecessary whitespace removal.
You mean the empty line after the macro definition? If I leave it then
there will be two empty lines in the final file: the one you don't want
me to remove and the one before the macro definition.
>
> > #define MENELAUS_I2C_ADDRESS 0x72
> >
> > #define MENELAUS_REV 0x01
> > @@ -155,7 +153,7 @@ static int menelaus_write_reg(int reg, u8 value)
> > int val =
> > i2c_smbus_write_byte_data(the_menelaus->client, reg, value);
> >
> > if (val < 0) {
> > - pr_err("write error");
> > + pr_err(DRIVER_NAME ": write error");
> > return val;
> > }
> >
> > @@ -167,7 +165,7 @@ static int menelaus_read_reg(int reg)
> > int val = i2c_smbus_read_byte_data(the_menelaus->client, reg);
> >
> > if (val < 0)
> > - pr_err("read error");
> > + pr_err(DRIVER_NAME ": read error");
> >
> > return val;
> > }
> > @@ -1177,7 +1175,7 @@ static int menelaus_probe(struct
> > i2c_client *client)
> > /* If a true probe check the device */
> > rev = menelaus_read_reg(MENELAUS_REV);
> > if (rev < 0) {
> > - pr_err("device not found");
> > + pr_err(DRIVER_NAME ": device not found");
> > err = -ENODEV;
> > goto fail1;
> > }
> > @@ -1258,7 +1256,7 @@ static int __init menelaus_init(void)
> >
> > res = i2c_add_driver(&menelaus_i2c_driver);
> > if (res < 0) {
> > - pr_err("driver registration failed\n");
> > + pr_err(DRIVER_NAME ": driver registration failed\n");
> > return res;
> > }
> >
> > diff --git a/drivers/net/spider_net.h
> > b/drivers/net/spider_net.h index dbbdb8c..c67b11d 100644
> > --- a/drivers/net/spider_net.h
> > +++ b/drivers/net/spider_net.h
> > @@ -493,7 +493,4 @@ struct spider_net_card {
> > struct spider_net_descr darray[0];
> > };
> >
> > -#define pr_err(fmt,arg...) \
> > - printk(KERN_ERR fmt ,##arg)
> > -
>
> Unnecessary whitespace removal.
>
> > #endif
> > diff --git a/drivers/video/omap/lcd_h3.c
> > b/drivers/video/omap/lcd_h3.c index 51807b4..c604d93 100644
> > --- a/drivers/video/omap/lcd_h3.c
> > +++ b/drivers/video/omap/lcd_h3.c
> > @@ -28,8 +28,6 @@
> >
> > #define MODULE_NAME "omapfb-lcd_h3"
> >
> > -#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ":
> > " fmt, ## args)
> > -
>
> Unnecessary whitespace removal.
>
> > static int h3_panel_init(struct lcd_panel *panel, struct
> > omapfb_device *fbdev) {
> > return 0;
> > @@ -48,7 +46,7 @@ static int h3_panel_enable(struct
> lcd_panel *panel)
> > if (!r)
> > r = tps65010_set_gpio_out_value(GPIO2, HIGH);
> > if (r)
> > - pr_err("Unable to turn on LCD panel\n");
> > + pr_err(MODULE_NAME ": Unable to turn on LCD panel\n");
> >
> > return r;
> > }
> > @@ -62,7 +60,7 @@ static void h3_panel_disable(struct
> > lcd_panel *panel)
> > if (!r)
> > tps65010_set_gpio_out_value(GPIO2, LOW);
> > if (r)
> > - pr_err("Unable to turn off LCD panel\n");
> > + pr_err(MODULE_NAME ": Unable to turn off LCD panel\n");
> > }
> >
> > static unsigned long h3_panel_get_caps(struct lcd_panel
> > *panel) diff --git a/drivers/video/omap/lcd_inn1610.c
> > b/drivers/video/omap/lcd_inn1610.c
> > index 95604ca..5ef119c 100644
> > --- a/drivers/video/omap/lcd_inn1610.c
> > +++ b/drivers/video/omap/lcd_inn1610.c
> > @@ -27,20 +27,18 @@
> >
> > #define MODULE_NAME "omapfb-lcd_h3"
> >
> > -#define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ":
> > " fmt, ## args)
> > -
>
> Unnecessary whitespace removal.
>
> > static int innovator1610_panel_init(struct lcd_panel *panel,
> > struct omapfb_device *fbdev)
> > {
> > int r = 0;
> >
> > if (omap_request_gpio(14)) {
> > - pr_err("can't request GPIO 14\n");
> > + pr_err(MODULE_NAME ": can't request GPIO 14\n");
> > r = -1;
> > goto exit;
> > }
> > if (omap_request_gpio(15)) {
> > - pr_err("can't request GPIO 15\n");
> > + pr_err(MODULE_NAME ": can't request GPIO 15\n");
> > omap_free_gpio(14);
> > r = -1;
> > goto exit;
> > diff --git a/include/linux/kernel.h b/include/linux/kernel.h
> > index f592df7..c51936a 100644
> > --- a/include/linux/kernel.h
> > +++ b/include/linux/kernel.h
> > @@ -242,6 +242,8 @@ static inline int __attribute__ ((format
> > (printf, 1, 2))) pr_debug(const char *
> >
> > #define pr_info(fmt,arg...) \
> > printk(KERN_INFO fmt,##arg)
> > +#define pr_err(fmt, arg...) \
> > + printk(KERN_ERR fmt, ##arg)
> >
> > /*
> > * Display an IP address in readable format.
> > --
> > 1.5.3.GIT
>
> Cheers,
>
> -PJ Waskiewicz
> Intel Corp.
> peter.p.waskiewicz.jr@intel.com
Thanks,
Emil.
^ permalink raw reply
* Re: [PATCH v2] Move the definition of pr_err() into kernel.h
From: Felipe Balbi @ 2007-09-11 19:56 UTC (permalink / raw)
To: Waskiewicz Jr, Peter P
Cc: Emil Medve, linux-kernel, netdev, i2c, linux-omap-open-source
In-Reply-To: <D5C1322C3E673F459512FB59E0DDC32903925779@orsmsx414.amr.corp.intel.com>
Hi,
On 9/11/07, Waskiewicz Jr, Peter P <peter.p.waskiewicz.jr@intel.com> wrote:
<snip>
> > -#define pr_err(fmt, arg...) printk(KERN_ERR DRIVER_NAME ":
> > ", ## arg);
> > -
>
> Unnecessary whitespace removal.
Actually... I prefer removing the extra blank-line... it's easier to
read and keeps on blank-line only to separate other
defines/code-portion
Same to all the others
<snip><snip><snip><snip><snip>
--
Best Regards,
Felipe Balbi
felipebalbi@users.sourceforge.net
^ permalink raw reply
* Re: [PATCH 3/3 v2] rfkill: Add rfkill documentation
From: Randy Dunlap @ 2007-09-11 19:59 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: davem, Dmitry Torokhov, netdev, Inaky Perez-Gonzalez
In-Reply-To: <200709111901.02137.IvDoorn@gmail.com>
On Tue, 11 Sep 2007 19:01:01 +0200 Ivo van Doorn wrote:
Almost done. See below.
> Documentation/rfkill.txt | 89 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 89 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/rfkill.txt
>
> diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt
> new file mode 100644
> index 0000000..0f35134
> --- /dev/null
> +++ b/Documentation/rfkill.txt
> @@ -0,0 +1,89 @@
+===============================================================================
> +1: Implementation details
> +
> +The rfkill switch subsystem offers support for keys often found on laptops
> +to enable wireless devices like WiFi and Bluetooth.
> +
> +This is done by providing the user 3 possibilities:
> + 1 - The rfkill system handles all events, userspace is not aware of events;
> + 2 - The rfkill system handles all events, userspace is informed about the event;
> + 3 - The rfkill system does not handle events, userspace handles all events;
In the above 3 lines,
change "events," to "events;"
and then end each line with a period (".").
> +The buttons to enable and disable the wireless radios are important in
> +situations where the user is for example using his laptop on a location where
> +wireless radios _must_ be disabled (e.g. airplanes).
> +Because of this requirement, userspace support for the keys should not be
> +made mandatory. Because userspace might want to perform some additional smarter
> +tasks when the key is pressed, rfkill still provides userspace the possibility
> +to take over the task to handle the key events.
> +
> +The system inside the kernel has been split into 2 separate sections:
> + 1 - RFKILL
> + 2 - RFKILL_INPUT
> +
> +The first option enables rfkill support and will make sure userspace will
> +be notified of any events through the input device. It also creates several
> +sysfs entries which can be used by userspace. See section "Userspace support".
> +
> +The second option provides an rfkill input handler. This handler will
> +listen to all rfkill key events and will toggle the radio accordingly.
> +With this option enabled userspace could either do nothing or simply
> +perform monitoring tasks.
> +
> +====================================
> +2: Driver support
...
> +====================================
> +3: Userspace support
> +
> +For each key an input device will be created which will send out the correct
> +key event when the rfkill key has been pressed.
> +
> +The following sysfs entries will be created:
> +
> + name: Name assigned by driver to this key (interface or driver name).
> + type: Name of the key type ("wlan", "bluetooth", etc).
> + state: Current state of the key. 1: On, 0: Off.
> + claim: 1: Userspace handles events, 0: Kernel handles events
> +
> +Both the "state" and "claim" entries are also writable. For the "state" entry
> +this means that when 1 or 0 is written all radios, not yet in the requested
> +state, will be will be toggled accordingly.
> +For the "claim" entry writing 1 to it means that the kernel no longer handles
> +handle key events even though RFKILL_INPUT input was enabled. When "claim" has
Drop "handle" above.
> +been set to 0, userspace should make sure that it listens for the input events
> +or check the sysfs "state" entry regularly to correctly perform the required
> +tasks when the rkfill key is pressed.
Thanks.
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply
* [PATCH 2/2] [IPROUTE2] ss: parse bare integers are port numbers rather than IP addresses
From: John Heffner @ 2007-09-11 20:02 UTC (permalink / raw)
To: shemminger; +Cc: netdev, John Heffner
In-Reply-To: <11895409553082-git-send-email-jheffner@psc.edu>
Signed-off-by: John Heffner <jheffner@psc.edu>
---
misc/ss.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/misc/ss.c b/misc/ss.c
index 5d14f13..d617f6d 100644
--- a/misc/ss.c
+++ b/misc/ss.c
@@ -953,6 +953,10 @@ void *parse_hostcond(char *addr)
memset(&a, 0, sizeof(a));
a.port = -1;
+ /* Special case: integer by itself is considered a port number */
+ if (!get_integer(&a.port, addr, 0))
+ goto out;
+
if (fam == AF_UNIX || strncmp(addr, "unix:", 5) == 0) {
char *p;
a.addr.family = AF_UNIX;
--
1.5.3.rc4.29.g74276-dirty
^ permalink raw reply related
* [PATCH 1/2] [IPROUTE2] Add missing LIBUTIL for dependencies.
From: John Heffner @ 2007-09-11 20:02 UTC (permalink / raw)
To: shemminger; +Cc: netdev, John Heffner
Signed-off-by: John Heffner <jheffner@psc.edu>
---
Makefile | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Makefile b/Makefile
index af0d5e4..7e4605c 100644
--- a/Makefile
+++ b/Makefile
@@ -29,7 +29,8 @@ LDLIBS += -L../lib -lnetlink -lutil
SUBDIRS=lib ip tc misc netem genl
-LIBNETLINK=../lib/libnetlink.a ../lib/libutil.a
+LIBUTIL=../lib/libutil.a
+LIBNETLINK=../lib/libnetlink.a $(LIBUTIL)
all: Config
@set -e; \
--
1.5.3.rc4.29.g74276-dirty
^ permalink raw reply related
* [PATCH 3/3 v3] rfkill: Add rfkill documentation
From: Ivo van Doorn @ 2007-09-11 20:20 UTC (permalink / raw)
To: davem; +Cc: Dmitry Torokhov, netdev, Inaky Perez-Gonzalez, Randy Dunlap
In-Reply-To: <200709111901.02137.IvDoorn@gmail.com>
Add a documentation file which contains
a short description about rfkill with some
notes about drivers and the userspace interface.
Changes since v1 and v2:
- Spellchecking
Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
Acked-by: Dmitry Torokhov <dtor@mail.ru>
---
Only patch 3 was updated, patches 1 and 2 remain the same.
Documentation/rfkill.txt | 89 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 89 insertions(+), 0 deletions(-)
create mode 100644 Documentation/rfkill.txt
diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt
new file mode 100644
index 0000000..a83ff23
--- /dev/null
+++ b/Documentation/rfkill.txt
@@ -0,0 +1,89 @@
+rfkill - RF switch subsystem support
+====================================
+
+1 Implementation details
+2 Driver support
+3 Userspace support
+
+===============================================================================
+1: Implementation details
+
+The rfkill switch subsystem offers support for keys often found on laptops
+to enable wireless devices like WiFi and Bluetooth.
+
+This is done by providing the user 3 possibilities:
+ 1 - The rfkill system handles all events; userspace is not aware of events.
+ 2 - The rfkill system handles all events; userspace is informed about the events.
+ 3 - The rfkill system does not handle events; userspace handles all events.
+
+The buttons to enable and disable the wireless radios are important in
+situations where the user is for example using his laptop on a location where
+wireless radios _must_ be disabled (e.g. airplanes).
+Because of this requirement, userspace support for the keys should not be
+made mandatory. Because userspace might want to perform some additional smarter
+tasks when the key is pressed, rfkill still provides userspace the possibility
+to take over the task to handle the key events.
+
+The system inside the kernel has been split into 2 separate sections:
+ 1 - RFKILL
+ 2 - RFKILL_INPUT
+
+The first option enables rfkill support and will make sure userspace will
+be notified of any events through the input device. It also creates several
+sysfs entries which can be used by userspace. See section "Userspace support".
+
+The second option provides an rfkill input handler. This handler will
+listen to all rfkill key events and will toggle the radio accordingly.
+With this option enabled userspace could either do nothing or simply
+perform monitoring tasks.
+
+====================================
+2: Driver support
+
+To build a driver with rfkill subsystem support, the driver should
+depend on the Kconfig symbol RFKILL; it should _not_ depend on
+RKFILL_INPUT.
+
+Unless key events trigger an interrupt to which the driver listens, polling
+will be required to determine the key state changes. For this the input
+layer providers the input-polldev handler.
+
+A driver should implement a few steps to correctly make use of the
+rfkill subsystem. First for non-polling drivers:
+
+ - rfkill_allocate()
+ - input_allocate_device()
+ - rfkill_register()
+ - input_register_device()
+
+For polling drivers:
+
+ - rfkill_allocate()
+ - input_allocate_polled_device()
+ - rfkill_register()
+ - input_register_polled_device()
+
+When a key event has been detected, the correct event should be
+sent over the input device which has been registered by the driver.
+
+====================================
+3: Userspace support
+
+For each key an input device will be created which will send out the correct
+key event when the rfkill key has been pressed.
+
+The following sysfs entries will be created:
+
+ name: Name assigned by driver to this key (interface or driver name).
+ type: Name of the key type ("wlan", "bluetooth", etc).
+ state: Current state of the key. 1: On, 0: Off.
+ claim: 1: Userspace handles events, 0: Kernel handles events
+
+Both the "state" and "claim" entries are also writable. For the "state" entry
+this means that when 1 or 0 is written all radios, not yet in the requested
+state, will be will be toggled accordingly.
+For the "claim" entry writing 1 to it means that the kernel no longer handles
+key events even though RFKILL_INPUT input was enabled. When "claim" has been
+set to 0, userspace should make sure that it listens for the input events or
+check the sysfs "state" entry regularly to correctly perform the required
+tasks when the rkfill key is pressed.
--
1.5.3
^ permalink raw reply related
* Re: [PATCH 3/3 v3] rfkill: Add rfkill documentation
From: Randy Dunlap @ 2007-09-11 20:29 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: davem, Dmitry Torokhov, netdev, Inaky Perez-Gonzalez
In-Reply-To: <200709112220.45382.IvDoorn@gmail.com>
On Tue, 11 Sep 2007 22:20:45 +0200 Ivo van Doorn wrote:
> Add a documentation file which contains
> a short description about rfkill with some
> notes about drivers and the userspace interface.
>
> Changes since v1 and v2:
> - Spellchecking
>
> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
> Acked-by: Dmitry Torokhov <dtor@mail.ru>
Thanks.
Acked-by: Randy Dunlap <randy.dunlap@oracle.com>
> ---
>
> Only patch 3 was updated, patches 1 and 2 remain the same.
>
> Documentation/rfkill.txt | 89 ++++++++++++++++++++++++++++++++++++++++++++++
> 1 files changed, 89 insertions(+), 0 deletions(-)
> create mode 100644 Documentation/rfkill.txt
>
> diff --git a/Documentation/rfkill.txt b/Documentation/rfkill.txt
> new file mode 100644
> index 0000000..a83ff23
> --- /dev/null
> +++ b/Documentation/rfkill.txt
> @@ -0,0 +1,89 @@
> +rfkill - RF switch subsystem support
> +====================================
> +
> +1 Implementation details
> +2 Driver support
> +3 Userspace support
> +
> +===============================================================================
> +1: Implementation details
> +
> +The rfkill switch subsystem offers support for keys often found on laptops
> +to enable wireless devices like WiFi and Bluetooth.
> +
> +This is done by providing the user 3 possibilities:
> + 1 - The rfkill system handles all events; userspace is not aware of events.
> + 2 - The rfkill system handles all events; userspace is informed about the events.
> + 3 - The rfkill system does not handle events; userspace handles all events.
> +
> +The buttons to enable and disable the wireless radios are important in
> +situations where the user is for example using his laptop on a location where
> +wireless radios _must_ be disabled (e.g. airplanes).
> +Because of this requirement, userspace support for the keys should not be
> +made mandatory. Because userspace might want to perform some additional smarter
> +tasks when the key is pressed, rfkill still provides userspace the possibility
> +to take over the task to handle the key events.
> +
> +The system inside the kernel has been split into 2 separate sections:
> + 1 - RFKILL
> + 2 - RFKILL_INPUT
> +
> +The first option enables rfkill support and will make sure userspace will
> +be notified of any events through the input device. It also creates several
> +sysfs entries which can be used by userspace. See section "Userspace support".
> +
> +The second option provides an rfkill input handler. This handler will
> +listen to all rfkill key events and will toggle the radio accordingly.
> +With this option enabled userspace could either do nothing or simply
> +perform monitoring tasks.
> +
> +====================================
> +2: Driver support
> +
> +To build a driver with rfkill subsystem support, the driver should
> +depend on the Kconfig symbol RFKILL; it should _not_ depend on
> +RKFILL_INPUT.
> +
> +Unless key events trigger an interrupt to which the driver listens, polling
> +will be required to determine the key state changes. For this the input
> +layer providers the input-polldev handler.
> +
> +A driver should implement a few steps to correctly make use of the
> +rfkill subsystem. First for non-polling drivers:
> +
> + - rfkill_allocate()
> + - input_allocate_device()
> + - rfkill_register()
> + - input_register_device()
> +
> +For polling drivers:
> +
> + - rfkill_allocate()
> + - input_allocate_polled_device()
> + - rfkill_register()
> + - input_register_polled_device()
> +
> +When a key event has been detected, the correct event should be
> +sent over the input device which has been registered by the driver.
> +
> +====================================
> +3: Userspace support
> +
> +For each key an input device will be created which will send out the correct
> +key event when the rfkill key has been pressed.
> +
> +The following sysfs entries will be created:
> +
> + name: Name assigned by driver to this key (interface or driver name).
> + type: Name of the key type ("wlan", "bluetooth", etc).
> + state: Current state of the key. 1: On, 0: Off.
> + claim: 1: Userspace handles events, 0: Kernel handles events
> +
> +Both the "state" and "claim" entries are also writable. For the "state" entry
> +this means that when 1 or 0 is written all radios, not yet in the requested
> +state, will be will be toggled accordingly.
> +For the "claim" entry writing 1 to it means that the kernel no longer handles
> +key events even though RFKILL_INPUT input was enabled. When "claim" has been
> +set to 0, userspace should make sure that it listens for the input events or
> +check the sysfs "state" entry regularly to correctly perform the required
> +tasks when the rkfill key is pressed.
> --
> 1.5.3
>
> -
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply
* Re: [PATCH] include listenq max/backlog in tcp_info and related reports
From: Eric Dumazet @ 2007-09-11 20:33 UTC (permalink / raw)
To: Rick Jones; +Cc: netdev
In-Reply-To: <46E6E014.8070603@hp.com>
Rick Jones a écrit :
> please ignore - I resent the original patch by mistake...grrr.
>
> rick jones
Yes ;)
By the way, make sure your "Signed-off-by: Rick Jones <rick.jones2@hp.com>" is
the first signoff :
You are the main author of this patch, I only reviewed it and added a
contribution.
Eric
^ permalink raw reply
* Re: [PATCH] Add IP1000A Driver
From: Francois Romieu @ 2007-09-11 20:32 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: Jesse Huang, jeff, akpm, netdev
In-Reply-To: <20070911164144.2853bcff@oldman>
Stephen Hemminger <shemminger@linux-foundation.org> :
[...]
> > + struct {
> > + u32 field;
> > + unsigned int len;
> > + } p[] = {
> > + { GMII_PREAMBLE, 32 }, /* Preamble */
> > + { GMII_ST, 2 }, /* ST */
> > + { GMII_READ, 2 }, /* OP */
> > + { phy_id, 5 }, /* PHYAD */
> > + { phy_reg, 5 }, /* REGAD */
> > + { 0x0000, 2 }, /* TA */
> > + { 0x0000, 16 }, /* DATA */
> > + { 0x0000, 1 } /* IDLE */
> > + };
>
> This could be declared static const, since it doesn't change.
phy_id and phy_reg do change. It can be worked around but I see
no really nice solution. Any suggestion ?
--
Ueimor
^ permalink raw reply
* Re: [PATCH] include listenq max/backlog in tcp_info and related reports
From: Rick Jones @ 2007-09-11 20:43 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev
In-Reply-To: <46E6FB87.6090303@cosmosbay.com>
> By the way, make sure your "Signed-off-by: Rick Jones
> <rick.jones2@hp.com>" is the first signoff :
>
> You are the main author of this patch, I only reviewed it and added a
> contribution.
I just went alphabetically - I take it there is further meaning assigned
to the first person listed? Should I send it again then?
rick jones
^ permalink raw reply
* Re: [PATCH] Fix e100 on systems that have cache incoherent DMA
From: David Acker @ 2007-09-11 20:54 UTC (permalink / raw)
To: Jeff Garzik
Cc: Kok, Auke, John Ronciak, Jesse Brandeburg, Jeff Kirsher,
Milton Miller, netdev, e1000-devel, Scott Feldman
In-Reply-To: <46E1DDC5.8040202@pobox.com>
Jeff Garzik wrote:
> David Acker wrote:
>> Let me know if there is any other information I can provide you. I
>> will look through the code to see what could be going on with your
>> machine. I will also look into reproducing these results with a newer
>> kernel. This may be tricky since compulab's patches are pretty stale
>> and don't always apply easily.
>
>
> pktgen outputs for the various cases modified/unmodified[/others?] would
> be nice, if you have a spot of time.
>
> Jeff
I am not familiar with pktgen but I seem to have it working for a simple test.
I edited the 1-1 example from ftp://robur.slu.se/pub/Linux/net-development/pktgen-testing/examples/ . The results with
and without the patch are below. Let me know if you want any other tests run. I obtained a PCI to miniPCI adapter that
will let me test my miniPCI based e100s on my main dev box. I will work on reproducing Intel's results tomorrow as time
permits. I am also still trying to get time to work on a recent kernel merge. Not a lot changed in the 100 since
2.6.18.4 except a flip from readX/writeX to ioreadX/iowriteX.
-Ack
cm-debian:/tmp# ./pktgen.conf-1-1
Removing all devices
Adding eth0
Setting max_before_softirq 10000
Configuring /proc/net/pktgen/eth0
Running... ctrl^C to stop
Done
Here are the results on 2.6.18.4 with the patch I submitted on my embedded system.
cm-debian:/tmp# cat /proc/net/pktgen/eth0
Params: count 10000000 min_pkt_size: 60 max_pkt_size: 60
frags: 0 delay: 0 clone_skb: 1000000 ifname: eth0
flows: 0 flowlen: 0
dst_min: 192.168.1.40 dst_max:
src_min: src_max:
src_mac: 00:09:30:FF:F2:F6 dst_mac: 00:19:B9:0B:45:8E
udp_src_min: 9 udp_src_max: 9 udp_dst_min: 9 udp_dst_max: 9
src_mac_count: 0 dst_mac_count: 0
Flags:
Current:
pkts-sofar: 10000000 errors: 0
started: 14852031282115us stopped: 14852181463422us idle: 918us
seq_num: 10000011 cur_dst_mac_offset: 0 cur_src_mac_offset: 0
cur_saddr: 0x2901a8c0 cur_daddr: 0x2801a8c0
cur_udp_dst: 9 cur_udp_src: 9
flows: 0
Result: OK: 150181307(c150180389+d918) usec, 10000000 (60byte,0frags)
66586pps 31Mb/sec (31961280bps) errors: 0
and here are the results without the patch:
cm-debian:/tmp# cat /proc/net/pktgen/eth0
Params: count 10000000 min_pkt_size: 60 max_pkt_size: 60
frags: 0 delay: 0 clone_skb: 1000000 ifname: eth0
flows: 0 flowlen: 0
dst_min: 192.168.1.40 dst_max:
src_min: src_max:
src_mac: 00:09:30:FF:F2:F6 dst_mac: 00:19:B9:0B:45:8E
udp_src_min: 9 udp_src_max: 9 udp_dst_min: 9 udp_dst_max: 9
src_mac_count: 0 dst_mac_count: 0
Flags:
Current:
pkts-sofar: 10000000 errors: 0
started: 14864204332576us stopped: 14864355451225us idle: 1431us
seq_num: 10000011 cur_dst_mac_offset: 0 cur_src_mac_offset: 0
cur_saddr: 0x2901a8c0 cur_daddr: 0x2801a8c0
cur_udp_dst: 9 cur_udp_src: 9
flows: 0
Result: OK: 151118649(c151117218+d1431) usec, 10000000 (60byte,0frags)
66173pps 31Mb/sec (31763040bps) errors: 0
^ permalink raw reply
* [PATCH netdev-2.6/ALL] DIV_ROUND_UP/roundup cleanup (under drivers/net/)
From: Ilpo Järvinen @ 2007-09-11 21:29 UTC (permalink / raw)
To: Jeff Garzik, Netdev
Cc: Jay Cliburn, Eugene Surovegin, Roland Dreier, Ramkrishna Vepa,
Rastapur Santosh, Sivakumar Subramani, Sreenivasa Honnur,
Ion Badulescu, Jeremy Fitzhardinge
[-- Attachment #1: Type: TEXT/PLAIN, Size: 10236 bytes --]
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
drivers/net/arcnet/rfc1201.c | 3 ++-
drivers/net/atl1/atl1_main.c | 17 +++++++----------
drivers/net/gianfar_ethtool.c | 2 +-
drivers/net/ibm_emac/ibm_emac_mal.h | 3 ++-
drivers/net/mlx4/alloc.c | 3 ++-
drivers/net/mlx4/icm.c | 3 ++-
drivers/net/s2io.c | 11 ++++-------
drivers/net/sb1250-mac.c | 2 +-
drivers/net/starfire.c | 6 +++---
drivers/net/wan/sbni.c | 2 +-
drivers/net/xen-netfront.c | 2 +-
11 files changed, 26 insertions(+), 28 deletions(-)
diff --git a/drivers/net/arcnet/rfc1201.c b/drivers/net/arcnet/rfc1201.c
index 460a095..126ee5b 100644
--- a/drivers/net/arcnet/rfc1201.c
+++ b/drivers/net/arcnet/rfc1201.c
@@ -23,6 +23,7 @@
*
* **********************
*/
+#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/if_arp.h>
@@ -493,7 +494,7 @@ static int prepare_tx(struct net_device *dev, struct archdr *pkt, int length,
out->length = length - RFC1201_HDR_SIZE;
out->dataleft = lp->outgoing.length;
- out->numsegs = (out->dataleft + maxsegsize - 1) / maxsegsize;
+ out->numsegs = DIV_ROUND_UP(out->dataleft, maxsegsize);
out->segnum = 0;
BUGMSG(D_DURING, "rfc1201 prep_tx: ready for %d-segment split "
diff --git a/drivers/net/atl1/atl1_main.c b/drivers/net/atl1/atl1_main.c
index c8deefa..b198f70 100644
--- a/drivers/net/atl1/atl1_main.c
+++ b/drivers/net/atl1/atl1_main.c
@@ -51,6 +51,7 @@
*/
#include <linux/types.h>
+#include <linux/kernel.h>
#include <linux/netdevice.h>
#include <linux/pci.h>
#include <linux/spinlock.h>
@@ -1132,8 +1133,7 @@ static void atl1_update_rfd_index(struct atl1_adapter *adapter,
{
u16 num_buf;
- num_buf = (rrd->xsz.xsum_sz.pkt_size + adapter->rx_buffer_len - 1) /
- adapter->rx_buffer_len;
+ num_buf = DIV_ROUND_UP(rrd->xsz.xsum_sz.pkt_size, adapter->rx_buffer_len);
if (rrd->num_buf == num_buf)
/* clean alloc flag for bad rrd */
atl1_clean_alloc_flag(adapter, rrd, num_buf);
@@ -1537,8 +1537,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
if (first_buf_len > proto_hdr_len) {
len12 = first_buf_len - proto_hdr_len;
- m = (len12 + ATL1_MAX_TX_BUF_LEN - 1) /
- ATL1_MAX_TX_BUF_LEN;
+ m = DIV_ROUND_UP(len12, ATL1_MAX_TX_BUF_LEN);
for (i = 0; i < m; i++) {
buffer_info =
&tpd_ring->buffer_info[tpd_next_to_use];
@@ -1578,7 +1577,7 @@ static void atl1_tx_map(struct atl1_adapter *adapter, struct sk_buff *skb,
frag = &skb_shinfo(skb)->frags[f];
lenf = frag->size;
- m = (lenf + ATL1_MAX_TX_BUF_LEN - 1) / ATL1_MAX_TX_BUF_LEN;
+ m = DIV_ROUND_UP(lenf, ATL1_MAX_TX_BUF_LEN);
for (i = 0; i < m; i++) {
buffer_info = &tpd_ring->buffer_info[tpd_next_to_use];
if (unlikely(buffer_info->skb))
@@ -1681,8 +1680,7 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
for (f = 0; f < nr_frags; f++) {
frag_size = skb_shinfo(skb)->frags[f].size;
if (frag_size)
- count += (frag_size + ATL1_MAX_TX_BUF_LEN - 1) /
- ATL1_MAX_TX_BUF_LEN;
+ count += DIV_ROUND_UP(frag_size, ATL1_MAX_TX_BUF_LEN);
}
/* mss will be nonzero if we're doing segment offload (TSO/GSO) */
@@ -1697,9 +1695,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
}
/* need additional TPD ? */
if (proto_hdr_len != len)
- count += (len - proto_hdr_len +
- ATL1_MAX_TX_BUF_LEN - 1) /
- ATL1_MAX_TX_BUF_LEN;
+ count += DIV_ROUND_UP(len - proto_hdr_len,
+ ATL1_MAX_TX_BUF_LEN);
}
}
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c
index 2470903..8352754 100644
--- a/drivers/net/gianfar_ethtool.c
+++ b/drivers/net/gianfar_ethtool.c
@@ -245,7 +245,7 @@ static unsigned int gfar_usecs2ticks(struct gfar_private *priv, unsigned int use
/* Make sure we return a number greater than 0
* if usecs > 0 */
- return ((usecs * 1000 + count - 1) / count);
+ return DIV_ROUND_UP(usecs * 1000, count);
}
/* Convert ethernet clock ticks to microseconds */
diff --git a/drivers/net/ibm_emac/ibm_emac_mal.h b/drivers/net/ibm_emac/ibm_emac_mal.h
index 64bc338..6bac886 100644
--- a/drivers/net/ibm_emac/ibm_emac_mal.h
+++ b/drivers/net/ibm_emac/ibm_emac_mal.h
@@ -20,6 +20,7 @@
#define __IBM_EMAC_MAL_H_
#include <linux/init.h>
+#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/netdevice.h>
@@ -143,7 +144,7 @@ static inline int mal_rx_size(int len)
static inline int mal_tx_chunks(int len)
{
- return (len + MAL_MAX_TX_SIZE - 1) / MAL_MAX_TX_SIZE;
+ return DIV_ROUND_UP(len, MAL_MAX_TX_SIZE);
}
#define MAL_CHAN_MASK(n) (0x80000000 >> (n))
diff --git a/drivers/net/mlx4/alloc.c b/drivers/net/mlx4/alloc.c
index f8d63d3..ea51b41 100644
--- a/drivers/net/mlx4/alloc.c
+++ b/drivers/net/mlx4/alloc.c
@@ -31,6 +31,7 @@
*/
#include <linux/errno.h>
+#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/bitmap.h>
#include <linux/dma-mapping.h>
@@ -132,7 +133,7 @@ int mlx4_buf_alloc(struct mlx4_dev *dev, int size, int max_direct,
} else {
int i;
- buf->nbufs = (size + PAGE_SIZE - 1) / PAGE_SIZE;
+ buf->nbufs = DIV_ROUND_UP(size, PAGE_SIZE);
buf->npages = buf->nbufs;
buf->page_shift = PAGE_SHIFT;
buf->u.page_list = kzalloc(buf->nbufs * sizeof *buf->u.page_list,
diff --git a/drivers/net/mlx4/icm.c b/drivers/net/mlx4/icm.c
index b7a4aa8..a99cca6 100644
--- a/drivers/net/mlx4/icm.c
+++ b/drivers/net/mlx4/icm.c
@@ -32,6 +32,7 @@
*/
#include <linux/init.h>
+#include <linux/kernel.h>
#include <linux/errno.h>
#include <linux/mm.h>
@@ -317,7 +318,7 @@ int mlx4_init_icm_table(struct mlx4_dev *dev, struct mlx4_icm_table *table,
int i;
obj_per_chunk = MLX4_TABLE_CHUNK_SIZE / obj_size;
- num_icm = (nobj + obj_per_chunk - 1) / obj_per_chunk;
+ num_icm = DIV_ROUND_UP(nobj, obj_per_chunk);
table->icm = kcalloc(num_icm, sizeof *table->icm, GFP_KERNEL);
if (!table->icm)
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index 3d47793..ddd0f12 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -484,9 +484,6 @@ static struct pci_driver s2io_driver = {
.err_handler = &s2io_err_handler,
};
-/* A simplifier macro used both by init and free shared_mem Fns(). */
-#define TXD_MEM_PAGE_CNT(len, per_each) ((len+per_each - 1) / per_each)
-
/**
* init_shared_mem - Allocation and Initialization of Memory
* @nic: Device private variable.
@@ -543,8 +540,8 @@ static int init_shared_mem(struct s2io_nic *nic)
memset(mac_control->fifos[i].list_info, 0, list_holder_size);
}
for (i = 0; i < config->tx_fifo_num; i++) {
- int page_num = TXD_MEM_PAGE_CNT(config->tx_cfg[i].fifo_len,
- lst_per_page);
+ int page_num = DIV_ROUND_UP(config->tx_cfg[i].fifo_len,
+ lst_per_page);
mac_control->fifos[i].tx_curr_put_info.offset = 0;
mac_control->fifos[i].tx_curr_put_info.fifo_len =
config->tx_cfg[i].fifo_len - 1;
@@ -813,8 +810,8 @@ static void free_shared_mem(struct s2io_nic *nic)
for (i = 0; i < config->tx_fifo_num; i++) {
ufo_size += config->tx_cfg[i].fifo_len;
- page_num = TXD_MEM_PAGE_CNT(config->tx_cfg[i].fifo_len,
- lst_per_page);
+ page_num = DIV_ROUND_UP(config->tx_cfg[i].fifo_len,
+ lst_per_page);
for (j = 0; j < page_num; j++) {
int mem_blks = (j * lst_per_page);
if (!mac_control->fifos[i].list_info)
diff --git a/drivers/net/sb1250-mac.c b/drivers/net/sb1250-mac.c
index fb7ed67..75e93a0 100644
--- a/drivers/net/sb1250-mac.c
+++ b/drivers/net/sb1250-mac.c
@@ -162,7 +162,7 @@ typedef enum { sbmac_state_uninit, sbmac_state_off, sbmac_state_on,
(d)->sbdma_dscrtable : (d)->f+1)
-#define NUMCACHEBLKS(x) (((x)+SMP_CACHE_BYTES-1)/SMP_CACHE_BYTES)
+#define NUMCACHEBLKS(x) DIV_ROUND_UP((x), SMP_CACHE_BYTES)
#define SBMAC_MAX_TXDESCR 256
#define SBMAC_MAX_RXDESCR 256
diff --git a/drivers/net/starfire.c b/drivers/net/starfire.c
index 8b64786..645b634 100644
--- a/drivers/net/starfire.c
+++ b/drivers/net/starfire.c
@@ -966,9 +966,9 @@ static int netdev_open(struct net_device *dev)
/* Allocate the various queues. */
if (np->queue_mem == 0) {
- tx_done_q_size = ((sizeof(struct tx_done_desc) * DONE_Q_SIZE + QUEUE_ALIGN - 1) / QUEUE_ALIGN) * QUEUE_ALIGN;
- rx_done_q_size = ((sizeof(rx_done_desc) * DONE_Q_SIZE + QUEUE_ALIGN - 1) / QUEUE_ALIGN) * QUEUE_ALIGN;
- tx_ring_size = ((sizeof(starfire_tx_desc) * TX_RING_SIZE + QUEUE_ALIGN - 1) / QUEUE_ALIGN) * QUEUE_ALIGN;
+ tx_done_q_size = roundup(sizeof(struct tx_done_desc) * DONE_Q_SIZE, QUEUE_ALIGN);
+ rx_done_q_size = roundup(sizeof(rx_done_desc) * DONE_Q_SIZE, QUEUE_ALIGN);
+ tx_ring_size = roundup(sizeof(starfire_tx_desc) * TX_RING_SIZE, QUEUE_ALIGN);
rx_ring_size = sizeof(struct starfire_rx_desc) * RX_RING_SIZE;
np->queue_mem_size = tx_done_q_size + rx_done_q_size + tx_ring_size + rx_ring_size;
np->queue_mem = pci_alloc_consistent(np->pci_dev, np->queue_mem_size, &np->queue_mem_dma);
diff --git a/drivers/net/wan/sbni.c b/drivers/net/wan/sbni.c
index 1cc18e7..ba240a5 100644
--- a/drivers/net/wan/sbni.c
+++ b/drivers/net/wan/sbni.c
@@ -857,7 +857,7 @@ prepare_to_send( struct sk_buff *skb, struct net_device *dev )
len = SBNI_MIN_LEN;
nl->tx_buf_p = skb;
- nl->tx_frameno = (len + nl->maxframe - 1) / nl->maxframe;
+ nl->tx_frameno = DIV_ROUND_UP(len, nl->maxframe);
nl->framelen = len < nl->maxframe ? len : nl->maxframe;
outb( inb( dev->base_addr + CSR0 ) | TR_REQ, dev->base_addr + CSR0 );
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index 17d3636..fe4bf52 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -456,7 +456,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
unsigned int offset = offset_in_page(data);
unsigned int len = skb_headlen(skb);
- frags += (offset + len + PAGE_SIZE - 1) / PAGE_SIZE;
+ frags += DIV_ROUND_UP(offset + len, PAGE_SIZE);
if (unlikely(frags > MAX_SKB_FRAGS + 1)) {
printk(KERN_ALERT "xennet: skb rides the rocket: %d frags\n",
frags);
--
1.5.0.6
^ permalink raw reply related
* Re: sk98lin for 2.6.23-rc1
From: Willy Tarreau @ 2007-09-11 22:37 UTC (permalink / raw)
To: Adrian Bunk
Cc: Bill Davidsen, Stephen Hemminger, Kyle Rose, James Corey,
Rob Sims, linux-kernel, Jeff Garzik, netdev
In-Reply-To: <20070911150357.GN3563@stusta.de>
On Tue, Sep 11, 2007 at 05:03:57PM +0200, Adrian Bunk wrote:
> On Tue, Sep 11, 2007 at 10:29:47AM -0400, Bill Davidsen wrote:
> > So if you want people to try a new driver, I think it really has to have
> > some benefits to the users, in terms of performance, reliability, or
> > features. "Cleaner design" doesn't motivate, and it does raise the question
> > of why the old driver wasn't just cleaned up. I've been doing software for
> > decades, I appreciate why, but users in general just want to use their
> > system. Which raises the question of why to delete drivers which work for
> > many or even most users?
>
> As I already explained, there is a long term advantage for all users if
> there is only one driver in the kernel.
Not only that. You have to place the switch in its context with history.
Stephen, please correct me if I'm wrong, but sk98lin has been randomly
working for a very long time. Not 100% the driver's fault, because it
has had to workaround a lot of chips bugs. The fact that this driver
supports *all* chips in the family makes it harder to identify whether
problems are caused by the hardware or by the driver because it is
bloated with tons of if/else.
I've personally encountered random data corruption on the receive path
with PCI-E hardware with sk98lin, as well as random TX stops. Sometimes
it would require one terabyte of data, sometimes just a few hundreds
megs. On other hardware (skge now), UDP would simply stop being sent
and some TCP traffic was necessary to restart UDP! One guy at Marvell
once asked me for more information, but it was not easy to provide
much more, given the randomness of the problems!
Stephen has done an excellent (and thankless) job at restarting from
scratch, and the idea to separate the two chips was a good one IMHO.
The problem is that he might have thought that most of the bugs were
in the driver, while most of them are in the hardware, and this requires
a lot of workarounds, which do not always work the same for everybody
(I remember having tried to disable flow control with sk98lin because
it helped with sky2).
In parallel, sk98lin has improved on the vendor's site. v8 exhibited
all the problems I explained above, but v10 has fixed a lot of them,
making the new sk98lin more reliable. In parallel, sky2 and skge had
got wider acceptance and testing. The nastiest hardware bugs will
slowly surface, a good deal of driver bugs have been detected too
(and that's expected from any new driver).
It is possible that after 2 or 3 patches, a lot of the remaining
problems will suddenly vanish. But it's also possible that the driver
will still not work for 1% of people for 1 or 2 years because of some
obscure hardware combinations which trigger some obscure hardware bugs.
> Therefore all users should
> switch away from obsolete drivers to the replacement drivers, and the
> obsolete driver will be removed at some point in time. The only question
> is how to do it.
Desktop users genreally have no problem experimenting with multiple kernels
or drivers. They can report feedback too, but generally, they're not very
good at downloading alternative drivers and patching their kernel with those.
Server users cannot experiment for a long time. After 2 or 3 losses of
service, they *have* to provide a definitive solution. For some of them
when sky2 fails, it may very well be to switch over to sk98lin. Downloading
from the vendor's site and patching is not a problem for those users, but
it causes them the trouble of updating the kernel for security fixes, so
the old driver must be shipped with the kernel.
However, I remember something which might constitute a solution. In 2.4,
there's a small bug in the kbuild process on alpha. One question is always
asked during make oldconfig. Its saved value is ignored because of the way
it is computed. I don't know if we could do this with 2.6 kbuild. It would
then be nice to always set sk98lin to unset if it was set to "Y" or "M",
so that at each build, the user has to explicitly state he wants it. It's
annoying enough to give the other one a try once in a while, without causing
too much trouble to people who really have no other choice right now.
What we need with this driver is people being fed up with it, not them
being unable to use it as a last resort. Also, given that it has improved
over the last years (probably due to competition pressure from sky2/skge),
users will even less understand why there is such incentive to remove it.
Another trick for obsolete drivers would be to simply remove them from
the usual build system, but have them being available for explicit build.
Eg: make modules will not build them, but make obsolete-modules would do.
> > Testing a new kernel is no longer a drop in a boot
> > operation if modprobe.conf must be edited to get the network up, and the
> > typical user isn't going to write that shell script to try one or the other
> > driver.
>
> The typical user will let his distribution handle this.
>
> And MODULE_ALIAS can also handle this.
No system config should be edited to switch back to the alternative,
otherwise it remains in its working state.
> > Honestly, new drivers which offer little benefit to most users are the
> > exception rather than the rule, so this may a corner case I would like to
> > see sk98lin back in the kernel, for a while I can build my own kernels and
> > patch it in, but until other drivers are drop-in, I probably won't change.
>
> That a new driver offers benefits that cause most users to switch isn't
> realistic.
Desktop users are curious and have plenty of time to kill. Server users
are frightened and lazy. So I think that annoying the user slightly is
a good solution (eg: make obsolete-modules).
> You mention e100 as an example - well, I'm using this driver in my
> computer, but I doubt anything would be worse for me if I'd use the
> obsolete eepro100 driver instead since I'm not using any of the fancy
> e100 features you mentioned as advantages.
After having been happy with eepro100 for years, I discovered many problems
with its VLAN support in 2.4 (MTU, ...) for which e100 was a solution. It
was a good reason to switch. But the old e100 driver took ages to load (half
of the machine boot time), which was not satisfying. So having a new driver
load faster is another good reason to switch.
> There is a long term advantage for all users if there is only one driver
> in the kernel. Therefore all users should switch away from obsolete
> drivers to the replacement drivers, and the obsolete driver will be
> removed at some point in time. The only question is how to do it.
Hmmm we already read this paragraph above :-)
> > Separate but related: why keep skge and sky2? Are we going through this
> > again in a year? Is the benefit worth the effort?
> >...
>
> skge and sky2 support distinct hardware.
... and as such are both smaller than sk98lin which supports both.
Cheers,
Willy
^ permalink raw reply
* [PATCH]: xfrm audit calls
From: Joy Latten @ 2007-09-12 0:03 UTC (permalink / raw)
To: netdev; +Cc: davem, linux-audit
This patch modifies the current ipsec audit layer
by breaking it up into purpose driven audit calls.
So far, the only audit calls made are when add/delete
an SA/policy. It had been discussed to give each
key manager it's own calls to do this, but I found
there to be much redundnacy since they did the exact
same things, except for how they got auid and sid, so I
combined them. The below audit calls can be made by any
key manager. Hopefully, this is ok.
I compiled and tested with CONFIG_AUDITSYSCALLS on and off.
Regards,
Joy Latten
Signed-off-by: Joy Latten <latten@austin.ibm.com>
diff -urpN linux-2.6.22/include/linux/audit.h linux-2.6.22-rc6/include/linux/audit.h
--- linux-2.6.22/include/linux/audit.h 2007-09-11 13:59:49.000000000 -0500
+++ linux-2.6.22-rc6/include/linux/audit.h 2007-09-11 14:10:57.000000000 -0500
@@ -108,10 +108,11 @@
#define AUDIT_MAC_CIPSOV4_DEL 1408 /* NetLabel: del CIPSOv4 DOI entry */
#define AUDIT_MAC_MAP_ADD 1409 /* NetLabel: add LSM domain mapping */
#define AUDIT_MAC_MAP_DEL 1410 /* NetLabel: del LSM domain mapping */
-#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Add a XFRM state */
-#define AUDIT_MAC_IPSEC_DELSA 1412 /* Delete a XFRM state */
-#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Add a XFRM policy */
-#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Delete a XFRM policy */
+#define AUDIT_MAC_IPSEC_ADDSA 1411 /* Not used */
+#define AUDIT_MAC_IPSEC_DELSA 1412 /* Not used */
+#define AUDIT_MAC_IPSEC_ADDSPD 1413 /* Not used */
+#define AUDIT_MAC_IPSEC_DELSPD 1414 /* Not used */
+#define AUDIT_MAC_IPSEC_EVENT 1415 /* Audit an IPSec event */
#define AUDIT_FIRST_KERN_ANOM_MSG 1700
#define AUDIT_LAST_KERN_ANOM_MSG 1799
diff -urpN linux-2.6.22/include/net/xfrm.h linux-2.6.22-rc6/include/net/xfrm.h
--- linux-2.6.22/include/net/xfrm.h 2007-09-11 13:59:49.000000000 -0500
+++ linux-2.6.22-rc6/include/net/xfrm.h 2007-09-11 14:10:57.000000000 -0500
@@ -12,6 +12,7 @@
#include <linux/ipsec.h>
#include <linux/in6.h>
#include <linux/mutex.h>
+#include <linux/audit.h>
#include <net/sock.h>
#include <net/dst.h>
@@ -421,15 +422,46 @@ extern unsigned int xfrm_policy_count[XF
/* Audit Information */
struct xfrm_audit
{
- uid_t loginuid;
+ u32 loginuid;
u32 secid;
};
#ifdef CONFIG_AUDITSYSCALL
-extern void xfrm_audit_log(uid_t auid, u32 secid, int type, int result,
- struct xfrm_policy *xp, struct xfrm_state *x);
+static inline struct audit_buffer *xfrm_audit_start(u32 auid, u32 sid)
+{
+ struct audit_buffer *audit_buf = NULL;
+ char *secctx;
+ u32 secctx_len;
+
+ audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC,
+ AUDIT_MAC_IPSEC_EVENT);
+ if (audit_buf == NULL)
+ return NULL;
+
+ audit_log_format(audit_buf, "auid=%u", auid);
+
+ if (sid != 0 &&
+ security_secid_to_secctx(sid, &secctx, &secctx_len) == 0) {
+ audit_log_format(audit_buf, " subj=%s", secctx);
+ security_release_secctx(secctx, secctx_len);
+ } else
+ audit_log_task_context(audit_buf);
+ return audit_buf;
+}
+
+extern void xfrm_audit_policy_add(struct xfrm_policy *xp, int result,
+ u32 auid, u32 sid);
+extern void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result,
+ u32 auid, u32 sid);
+extern void xfrm_audit_state_add(struct xfrm_state *x, int result,
+ u32 auid, u32 sid);
+extern void xfrm_audit_state_delete(struct xfrm_state *x, int result,
+ u32 auid, u32 sid);
#else
-#define xfrm_audit_log(a,s,t,r,p,x) do { ; } while (0)
+#define xfrm_audit_policy_add(x, r, a, s) do { ; } while (0)
+#define xfrm_audit_policy_delete(x, r, a, s) do { ; } while (0)
+#define xfrm_audit_state_add(x, r, a, s) do { ; } while (0)
+#define xfrm_audit_state_delete(x, r, a, s) do { ; } while (0)
#endif /* CONFIG_AUDITSYSCALL */
static inline void xfrm_pol_hold(struct xfrm_policy *policy)
diff -urpN linux-2.6.22/net/key/af_key.c linux-2.6.22-rc6/net/key/af_key.c
--- linux-2.6.22/net/key/af_key.c 2007-09-11 13:59:52.000000000 -0500
+++ linux-2.6.22-rc6/net/key/af_key.c 2007-09-11 14:10:58.000000000 -0500
@@ -27,7 +27,6 @@
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <net/xfrm.h>
-#include <linux/audit.h>
#include <net/sock.h>
@@ -1461,8 +1460,8 @@ static int pfkey_add(struct sock *sk, st
else
err = xfrm_state_update(x);
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_ADDSA, err ? 0 : 1, NULL, x);
+ xfrm_audit_state_add(x, err ? 0 : 1,
+ audit_get_loginuid(current->audit_context), 0);
if (err < 0) {
x->km.state = XFRM_STATE_DEAD;
@@ -1515,8 +1514,8 @@ static int pfkey_delete(struct sock *sk,
c.event = XFRM_MSG_DELSA;
km_state_notify(x, &c);
out:
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
+ xfrm_audit_state_delete(x, err ? 0 : 1,
+ audit_get_loginuid(current->audit_context), 0);
xfrm_state_put(x);
return err;
@@ -2268,8 +2267,8 @@ static int pfkey_spdadd(struct sock *sk,
err = xfrm_policy_insert(pol->sadb_x_policy_dir-1, xp,
hdr->sadb_msg_type != SADB_X_SPDUPDATE);
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_ADDSPD, err ? 0 : 1, xp, NULL);
+ xfrm_audit_policy_add(xp, err ? 0 : 1,
+ audit_get_loginuid(current->audit_context), 0);
if (err)
goto out;
@@ -2352,8 +2351,8 @@ static int pfkey_spddelete(struct sock *
if (xp == NULL)
return -ENOENT;
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+ xfrm_audit_policy_delete(xp, err ? 0 : 1,
+ audit_get_loginuid(current->audit_context), 0);
if (err)
goto out;
@@ -2613,8 +2612,8 @@ static int pfkey_spdget(struct sock *sk,
return -ENOENT;
if (delete) {
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+ xfrm_audit_policy_delete(xp, err ? 0 : 1,
+ audit_get_loginuid(current->audit_context), 0);
if (err)
goto out;
diff -urpN linux-2.6.22/net/xfrm/xfrm_policy.c linux-2.6.22-rc6/net/xfrm/xfrm_policy.c
--- linux-2.6.22/net/xfrm/xfrm_policy.c 2007-09-11 13:59:52.000000000 -0500
+++ linux-2.6.22-rc6/net/xfrm/xfrm_policy.c 2007-09-11 14:13:05.000000000 -0500
@@ -23,7 +23,6 @@
#include <linux/netfilter.h>
#include <linux/module.h>
#include <linux/cache.h>
-#include <linux/audit.h>
#include <net/xfrm.h>
#include <net/ip.h>
@@ -850,10 +849,9 @@ xfrm_policy_flush_secctx_check(u8 type,
continue;
err = security_xfrm_policy_delete(pol);
if (err) {
- xfrm_audit_log(audit_info->loginuid,
- audit_info->secid,
- AUDIT_MAC_IPSEC_DELSPD, 0,
- pol, NULL);
+ xfrm_audit_policy_delete(pol, 0,
+ audit_info->loginuid,
+ audit_info->secid);
return err;
}
}
@@ -865,10 +863,9 @@ xfrm_policy_flush_secctx_check(u8 type,
continue;
err = security_xfrm_policy_delete(pol);
if (err) {
- xfrm_audit_log(audit_info->loginuid,
- audit_info->secid,
- AUDIT_MAC_IPSEC_DELSPD,
- 0, pol, NULL);
+ xfrm_audit_policy_delete(pol, 0,
+ audit_info->loginuid,
+ audit_info->secid);
return err;
}
}
@@ -909,8 +906,8 @@ int xfrm_policy_flush(u8 type, struct xf
hlist_del(&pol->byidx);
write_unlock_bh(&xfrm_policy_lock);
- xfrm_audit_log(audit_info->loginuid, audit_info->secid,
- AUDIT_MAC_IPSEC_DELSPD, 1, pol, NULL);
+ xfrm_audit_policy_delete(pol, 1, audit_info->loginuid,
+ audit_info->secid);
xfrm_policy_kill(pol);
killed++;
@@ -930,11 +927,9 @@ int xfrm_policy_flush(u8 type, struct xf
hlist_del(&pol->byidx);
write_unlock_bh(&xfrm_policy_lock);
- xfrm_audit_log(audit_info->loginuid,
- audit_info->secid,
- AUDIT_MAC_IPSEC_DELSPD, 1,
- pol, NULL);
-
+ xfrm_audit_policy_delete(pol, 1,
+ audit_info->loginuid,
+ audit_info->secid);
xfrm_policy_kill(pol);
killed++;
@@ -2150,123 +2145,6 @@ int xfrm_bundle_ok(struct xfrm_policy *p
EXPORT_SYMBOL(xfrm_bundle_ok);
-#ifdef CONFIG_AUDITSYSCALL
-/* Audit addition and deletion of SAs and ipsec policy */
-
-void xfrm_audit_log(uid_t auid, u32 sid, int type, int result,
- struct xfrm_policy *xp, struct xfrm_state *x)
-{
-
- char *secctx;
- u32 secctx_len;
- struct xfrm_sec_ctx *sctx = NULL;
- struct audit_buffer *audit_buf;
- int family;
- extern int audit_enabled;
-
- if (audit_enabled == 0)
- return;
-
- BUG_ON((type == AUDIT_MAC_IPSEC_ADDSA ||
- type == AUDIT_MAC_IPSEC_DELSA) && !x);
- BUG_ON((type == AUDIT_MAC_IPSEC_ADDSPD ||
- type == AUDIT_MAC_IPSEC_DELSPD) && !xp);
-
- audit_buf = audit_log_start(current->audit_context, GFP_ATOMIC, type);
- if (audit_buf == NULL)
- return;
-
- switch(type) {
- case AUDIT_MAC_IPSEC_ADDSA:
- audit_log_format(audit_buf, "SAD add: auid=%u", auid);
- break;
- case AUDIT_MAC_IPSEC_DELSA:
- audit_log_format(audit_buf, "SAD delete: auid=%u", auid);
- break;
- case AUDIT_MAC_IPSEC_ADDSPD:
- audit_log_format(audit_buf, "SPD add: auid=%u", auid);
- break;
- case AUDIT_MAC_IPSEC_DELSPD:
- audit_log_format(audit_buf, "SPD delete: auid=%u", auid);
- break;
- default:
- return;
- }
-
- if (sid != 0 &&
- security_secid_to_secctx(sid, &secctx, &secctx_len) == 0) {
- audit_log_format(audit_buf, " subj=%s", secctx);
- security_release_secctx(secctx, secctx_len);
- } else
- audit_log_task_context(audit_buf);
-
- if (xp) {
- family = xp->selector.family;
- if (xp->security)
- sctx = xp->security;
- } else {
- family = x->props.family;
- if (x->security)
- sctx = x->security;
- }
-
- if (sctx)
- audit_log_format(audit_buf,
- " sec_alg=%u sec_doi=%u sec_obj=%s",
- sctx->ctx_alg, sctx->ctx_doi, sctx->ctx_str);
-
- switch(family) {
- case AF_INET:
- {
- struct in_addr saddr, daddr;
- if (xp) {
- saddr.s_addr = xp->selector.saddr.a4;
- daddr.s_addr = xp->selector.daddr.a4;
- } else {
- saddr.s_addr = x->props.saddr.a4;
- daddr.s_addr = x->id.daddr.a4;
- }
- audit_log_format(audit_buf,
- " src=%u.%u.%u.%u dst=%u.%u.%u.%u",
- NIPQUAD(saddr), NIPQUAD(daddr));
- }
- break;
- case AF_INET6:
- {
- struct in6_addr saddr6, daddr6;
- if (xp) {
- memcpy(&saddr6, xp->selector.saddr.a6,
- sizeof(struct in6_addr));
- memcpy(&daddr6, xp->selector.daddr.a6,
- sizeof(struct in6_addr));
- } else {
- memcpy(&saddr6, x->props.saddr.a6,
- sizeof(struct in6_addr));
- memcpy(&daddr6, x->id.daddr.a6,
- sizeof(struct in6_addr));
- }
- audit_log_format(audit_buf,
- " src=" NIP6_FMT " dst=" NIP6_FMT,
- NIP6(saddr6), NIP6(daddr6));
- }
- break;
- }
-
- if (x)
- audit_log_format(audit_buf, " spi=%lu(0x%lx) protocol=%s",
- (unsigned long)ntohl(x->id.spi),
- (unsigned long)ntohl(x->id.spi),
- x->id.proto == IPPROTO_AH ? "AH" :
- (x->id.proto == IPPROTO_ESP ?
- "ESP" : "IPCOMP"));
-
- audit_log_format(audit_buf, " res=%u", result);
- audit_log_end(audit_buf);
-}
-
-EXPORT_SYMBOL(xfrm_audit_log);
-#endif /* CONFIG_AUDITSYSCALL */
-
int xfrm_policy_register_afinfo(struct xfrm_policy_afinfo *afinfo)
{
int err = 0;
@@ -2412,6 +2290,70 @@ void __init xfrm_init(void)
xfrm_input_init();
}
+#ifdef CONFIG_AUDITSYSCALL
+static inline void xfrm_audit_common_policyinfo(struct xfrm_policy *xp,
+ struct audit_buffer *audit_buf)
+{
+ if (xp->security)
+ audit_log_format(audit_buf, " sec_alg=%u sec_doi=%u sec_obj=%s",
+ xp->security->ctx_alg, xp->security->ctx_doi,
+ xp->security->ctx_str);
+
+ switch(xp->selector.family) {
+ case AF_INET:
+ audit_log_format(audit_buf, " src=%u.%u.%u.%u dst=%u.%u.%u.%u",
+ NIPQUAD(xp->selector.saddr.a4),
+ NIPQUAD(xp->selector.daddr.a4));
+ break;
+ case AF_INET6:
+ {
+ struct in6_addr saddr6, daddr6;
+
+ memcpy(&saddr6, xp->selector.saddr.a6,
+ sizeof(struct in6_addr));
+ memcpy(&daddr6, xp->selector.daddr.a6,
+ sizeof(struct in6_addr));
+ audit_log_format(audit_buf,
+ " src=" NIP6_FMT " dst=" NIP6_FMT,
+ NIP6(saddr6), NIP6(daddr6));
+ }
+ break;
+ }
+}
+
+void
+xfrm_audit_policy_add(struct xfrm_policy *xp, int result, u32 auid, u32 sid)
+{
+ struct audit_buffer *audit_buf;
+ extern int audit_enabled;
+
+ if (audit_enabled == 0)
+ return;
+ audit_buf = xfrm_audit_start(sid, auid);
+ if (audit_buf == NULL)
+ return;
+ audit_log_format(audit_buf, " op=SPD-add res=%u", result);
+ xfrm_audit_common_policyinfo(xp, audit_buf);
+ audit_log_end(audit_buf);
+}
+
+void
+xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, u32 auid, u32 sid)
+{
+ struct audit_buffer *audit_buf;
+ extern int audit_enabled;
+
+ if (audit_enabled == 0)
+ return;
+ audit_buf = xfrm_audit_start(sid, auid);
+ if (audit_buf == NULL)
+ return;
+ audit_log_format(audit_buf, " op=SPD-delete res=%u", result);
+ xfrm_audit_common_policyinfo(xp, audit_buf);
+ audit_log_end(audit_buf);
+}
+#endif
+
#ifdef CONFIG_XFRM_MIGRATE
static int xfrm_migrate_selector_match(struct xfrm_selector *sel_cmp,
struct xfrm_selector *sel_tgt)
diff -urpN linux-2.6.22/net/xfrm/xfrm_state.c linux-2.6.22-rc6/net/xfrm/xfrm_state.c
--- linux-2.6.22/net/xfrm/xfrm_state.c 2007-09-11 13:59:52.000000000 -0500
+++ linux-2.6.22-rc6/net/xfrm/xfrm_state.c 2007-09-11 14:12:37.000000000 -0500
@@ -19,7 +19,6 @@
#include <linux/ipsec.h>
#include <linux/module.h>
#include <linux/cache.h>
-#include <linux/audit.h>
#include <asm/uaccess.h>
#include "xfrm_hash.h"
@@ -301,8 +300,8 @@ expired:
if (!err && x->id.spi)
km_state_expired(x, 1, 0);
- xfrm_audit_log(audit_get_loginuid(current->audit_context), 0,
- AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
+ xfrm_audit_state_delete(x, err ? 0 : 1,
+ audit_get_loginuid(current->audit_context), 0);
out:
spin_unlock(&x->lock);
@@ -403,11 +402,9 @@ xfrm_state_flush_secctx_check(u8 proto,
hlist_for_each_entry(x, entry, xfrm_state_bydst+i, bydst) {
if (xfrm_id_proto_match(x->id.proto, proto) &&
(err = security_xfrm_state_delete(x)) != 0) {
- xfrm_audit_log(audit_info->loginuid,
- audit_info->secid,
- AUDIT_MAC_IPSEC_DELSA,
- 0, NULL, x);
-
+ xfrm_audit_state_delete(x, 0,
+ audit_info->loginuid,
+ audit_info->secid);
return err;
}
}
@@ -443,10 +440,9 @@ restart:
spin_unlock_bh(&xfrm_state_lock);
err = xfrm_state_delete(x);
- xfrm_audit_log(audit_info->loginuid,
- audit_info->secid,
- AUDIT_MAC_IPSEC_DELSA,
- err ? 0 : 1, NULL, x);
+ xfrm_audit_state_delete(x, err ? 0 : 1,
+ audit_info->loginuid,
+ audit_info->secid);
xfrm_state_put(x);
spin_lock_bh(&xfrm_state_lock);
@@ -1821,3 +1817,70 @@ void __init xfrm_state_init(void)
INIT_WORK(&xfrm_state_gc_work, xfrm_state_gc_task);
}
+#ifdef CONFIG_AUDITSYSCALL
+static inline void xfrm_audit_common_stateinfo(struct xfrm_state *x,
+ struct audit_buffer *audit_buf)
+{
+ if (x->security)
+ audit_log_format(audit_buf, " sec_alg=%u sec_doi=%u sec_obj=%s",
+ x->security->ctx_alg, x->security->ctx_doi,
+ x->security->ctx_str);
+
+ switch(x->props.family) {
+ case AF_INET:
+ audit_log_format(audit_buf, " src=%u.%u.%u.%u dst=%u.%u.%u.%u",
+ NIPQUAD(x->props.saddr.a4),
+ NIPQUAD(x->id.daddr.a4));
+ break;
+ case AF_INET6:
+ {
+ struct in6_addr saddr6, daddr6;
+
+ memcpy(&saddr6, x->props.saddr.a6,
+ sizeof(struct in6_addr));
+ memcpy(&daddr6, x->id.daddr.a6,
+ sizeof(struct in6_addr));
+ audit_log_format(audit_buf,
+ " src=" NIP6_FMT " dst=" NIP6_FMT,
+ NIP6(saddr6), NIP6(daddr6));
+ }
+ break;
+ }
+}
+
+void
+xfrm_audit_state_add(struct xfrm_state *x, int result, u32 auid, u32 sid)
+{
+ struct audit_buffer *audit_buf;
+ extern int audit_enabled;
+
+ if (audit_enabled == 0)
+ return;
+ audit_buf = xfrm_audit_start(sid, auid);
+ if (audit_buf == NULL)
+ return;
+ audit_log_format(audit_buf, " op=SAD-add res=%u",result);
+ xfrm_audit_common_stateinfo(x, audit_buf);
+ audit_log_format(audit_buf, " spi=%lu(0x%lx)",
+ (unsigned long)x->id.spi, (unsigned long)x->id.spi);
+ audit_log_end(audit_buf);
+}
+
+void
+xfrm_audit_state_delete(struct xfrm_state *x, int result, u32 auid, u32 sid)
+{
+ struct audit_buffer *audit_buf;
+ extern int audit_enabled;
+
+ if (audit_enabled == 0)
+ return;
+ audit_buf = xfrm_audit_start(sid, auid);
+ if (audit_buf == NULL)
+ return;
+ audit_log_format(audit_buf, " op=SAD-delete res=%u",result);
+ xfrm_audit_common_stateinfo(x, audit_buf);
+ audit_log_format(audit_buf, " spi=%lu(0x%lx)",
+ (unsigned long)x->id.spi, (unsigned long)x->id.spi);
+ audit_log_end(audit_buf);
+}
+#endif /* CONFIG_AUDITSYSCALL */
diff -urpN linux-2.6.22/net/xfrm/xfrm_user.c linux-2.6.22-rc6/net/xfrm/xfrm_user.c
--- linux-2.6.22/net/xfrm/xfrm_user.c 2007-09-11 13:59:52.000000000 -0500
+++ linux-2.6.22-rc6/net/xfrm/xfrm_user.c 2007-09-11 14:10:58.000000000 -0500
@@ -31,7 +31,6 @@
#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
#include <linux/in6.h>
#endif
-#include <linux/audit.h>
static int verify_one_alg(struct rtattr **xfrma, enum xfrm_attr_type_t type)
{
@@ -462,8 +461,8 @@ static int xfrm_add_sa(struct sk_buff *s
else
err = xfrm_state_update(x);
- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_ADDSA, err ? 0 : 1, NULL, x);
+ xfrm_audit_state_add(x, err ? 0 : 1, NETLINK_CB(skb).loginuid,
+ NETLINK_CB(skb).sid);
if (err < 0) {
x->km.state = XFRM_STATE_DEAD;
@@ -545,8 +544,8 @@ static int xfrm_del_sa(struct sk_buff *s
km_state_notify(x, &c);
out:
- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSA, err ? 0 : 1, NULL, x);
+ xfrm_audit_state_delete(x, err ? 0 : 1, NETLINK_CB(skb).loginuid,
+ NETLINK_CB(skb).sid);
xfrm_state_put(x);
return err;
}
@@ -1155,8 +1154,8 @@ static int xfrm_add_policy(struct sk_buf
* a type XFRM_MSG_UPDPOLICY - JHS */
excl = nlh->nlmsg_type == XFRM_MSG_NEWPOLICY;
err = xfrm_policy_insert(p->dir, xp, excl);
- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+ xfrm_audit_policy_add(xp, err ? 0 : 1, NETLINK_CB(skb).loginuid,
+ NETLINK_CB(skb).sid);
if (err) {
security_xfrm_policy_free(xp);
@@ -1401,8 +1400,9 @@ static int xfrm_get_policy(struct sk_buf
MSG_DONTWAIT);
}
} else {
- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSPD, err ? 0 : 1, xp, NULL);
+ xfrm_audit_policy_delete(xp, err ? 0 : 1,
+ NETLINK_CB(skb).loginuid,
+ NETLINK_CB(skb).sid);
if (err != 0)
goto out;
@@ -1650,8 +1650,8 @@ static int xfrm_add_pol_expire(struct sk
err = 0;
if (up->hard) {
xfrm_policy_delete(xp, p->dir);
- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSPD, 1, xp, NULL);
+ xfrm_audit_policy_delete(xp, 1, NETLINK_CB(skb).loginuid,
+ NETLINK_CB(skb).sid);
} else {
// reset the timers here?
@@ -1686,8 +1686,8 @@ static int xfrm_add_sa_expire(struct sk_
if (ue->hard) {
__xfrm_state_delete(x);
- xfrm_audit_log(NETLINK_CB(skb).loginuid, NETLINK_CB(skb).sid,
- AUDIT_MAC_IPSEC_DELSA, 1, NULL, x);
+ xfrm_audit_state_delete(x, 1, NETLINK_CB(skb).loginuid,
+ NETLINK_CB(skb).sid);
}
err = 0;
out:
^ permalink raw reply
* [PATCH] include listenq max/backlog in tcp_info and related reports - correct version/signorder
From: Rick Jones @ 2007-09-12 0:38 UTC (permalink / raw)
To: netdev
Return some useful information such as the maximum listen backlog and the
current listen backlog in the tcp_info structure and have that match what
one can see in /proc/net/tcp, /proc/net/tcp6, and INET_DIAG_INFO.
Signed-off-by: Rick Jones <rick.jones2@hp.com>
Signed-off-by: Eric Dumazet <dada1@cosmosbay.com>
---
diff -r bdcdd0e1ee9d Documentation/networking/proc_net_tcp.txt
--- a/Documentation/networking/proc_net_tcp.txt Sat Sep 01 07:00:31 2007 +0000
+++ b/Documentation/networking/proc_net_tcp.txt Tue Sep 11 10:38:23 2007 -0700
@@ -20,8 +20,8 @@ up into 3 parts because of the length of
| | | | |--> number of unrecovered RTO timeouts
| | | |----------> number of jiffies until timer expires
| | |----------------> timer_active (see below)
- | |----------------------> receive-queue
- |-------------------------------> transmit-queue
+ | |----------------------> receive-queue or connection backlog
+ |-------------------------------> transmit-queue or connection limit
1000 0 54165785 4 cd1e6040 25 4 27 3 -1
| | | | | | | | | |--> slow start size threshold,
diff -r bdcdd0e1ee9d net/ipv4/tcp.c
--- a/net/ipv4/tcp.c Sat Sep 01 07:00:31 2007 +0000
+++ b/net/ipv4/tcp.c Tue Sep 11 10:38:23 2007 -0700
@@ -2030,8 +2030,14 @@ void tcp_get_info(struct sock *sk, struc
info->tcpi_snd_mss = tp->mss_cache;
info->tcpi_rcv_mss = icsk->icsk_ack.rcv_mss;
- info->tcpi_unacked = tp->packets_out;
- info->tcpi_sacked = tp->sacked_out;
+ if (sk->sk_state == TCP_LISTEN) {
+ info->tcpi_unacked = sk->sk_ack_backlog;
+ info->tcpi_sacked = sk->sk_max_ack_backlog;
+ }
+ else {
+ info->tcpi_unacked = tp->packets_out;
+ info->tcpi_sacked = tp->sacked_out;
+ }
info->tcpi_lost = tp->lost_out;
info->tcpi_retrans = tp->retrans_out;
info->tcpi_fackets = tp->fackets_out;
diff -r bdcdd0e1ee9d net/ipv4/tcp_diag.c
--- a/net/ipv4/tcp_diag.c Sat Sep 01 07:00:31 2007 +0000
+++ b/net/ipv4/tcp_diag.c Tue Sep 11 10:38:23 2007 -0700
@@ -25,11 +25,14 @@ static void tcp_diag_get_info(struct soc
const struct tcp_sock *tp = tcp_sk(sk);
struct tcp_info *info = _info;
- if (sk->sk_state == TCP_LISTEN)
+ if (sk->sk_state == TCP_LISTEN) {
r->idiag_rqueue = sk->sk_ack_backlog;
- else
+ r->idiag_wqueue = sk->sk_max_ack_backlog;
+ }
+ else {
r->idiag_rqueue = tp->rcv_nxt - tp->copied_seq;
- r->idiag_wqueue = tp->write_seq - tp->snd_una;
+ r->idiag_wqueue = tp->write_seq - tp->snd_una;
+ }
if (info != NULL)
tcp_get_info(sk, info);
}
diff -r bdcdd0e1ee9d net/ipv4/tcp_ipv4.c
--- a/net/ipv4/tcp_ipv4.c Sat Sep 01 07:00:31 2007 +0000
+++ b/net/ipv4/tcp_ipv4.c Tue Sep 11 10:38:23 2007 -0700
@@ -2320,7 +2320,8 @@ static void get_tcp4_sock(struct sock *s
sprintf(tmpbuf, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
"%08X %5d %8d %lu %d %p %u %u %u %u %d",
i, src, srcp, dest, destp, sk->sk_state,
- tp->write_seq - tp->snd_una,
+ sk->sk_state == TCP_LISTEN ? sk->sk_max_ack_backlog :
+ (tp->write_seq - tp->snd_una),
sk->sk_state == TCP_LISTEN ? sk->sk_ack_backlog :
(tp->rcv_nxt - tp->copied_seq),
timer_active,
diff -r bdcdd0e1ee9d net/ipv6/tcp_ipv6.c
--- a/net/ipv6/tcp_ipv6.c Sat Sep 01 07:00:31 2007 +0000
+++ b/net/ipv6/tcp_ipv6.c Tue Sep 11 10:38:23 2007 -0700
@@ -2005,8 +2005,10 @@ static void get_tcp6_sock(struct seq_fil
dest->s6_addr32[0], dest->s6_addr32[1],
dest->s6_addr32[2], dest->s6_addr32[3], destp,
sp->sk_state,
- tp->write_seq-tp->snd_una,
- (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog : (tp->rcv_nxt - tp->copied_seq),
+ (sp->sk_state == TCP_LISTEN) ? sp->sk_max_ack_backlog:
+ tp->write_seq-tp->snd_una,
+ (sp->sk_state == TCP_LISTEN) ? sp->sk_ack_backlog :
+ (tp->rcv_nxt - tp->copied_seq),
timer_active,
jiffies_to_clock_t(timer_expires - jiffies),
icsk->icsk_retransmits,
^ permalink raw reply
* Re: [RFC 2/3] rfkill: Add support for ultrawideband
From: Inaky Perez-Gonzalez @ 2007-09-12 1:07 UTC (permalink / raw)
To: Ivo van Doorn; +Cc: Dmitry Torokhov, netdev, linux-wireless
In-Reply-To: <200709081711.50344.IvDoorn@gmail.com>
On Saturday 08 September 2007, Ivo van Doorn wrote:
> This patch will add support for UWB keys to rfkill,
> support for this has been requested by Inaky.
>
> Signed-off-by: Ivo van Doorn <IvDoorn@gmail.com>
> CC: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Thanks so much
Acked-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
^ 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