* Re: linux-next: manual merge of the security-testing tree with the net tree
From: James Morris @ 2011-01-09 22:48 UTC (permalink / raw)
To: Casey Schaufler
Cc: Stephen Rothwell, linux-next, linux-kernel, David Miller, netdev
In-Reply-To: <4D2666D0.9060802@schaufler-ca.com>
On Thu, 6 Jan 2011, Casey Schaufler wrote:
> On 1/6/2011 4:44 PM, Stephen Rothwell wrote:
> > Hi James,
> >
> > Today's linux-next merge of the security-testing tree got a conflict in
> > security/smack/smack_lsm.c between commit
> > 3610cda53f247e176bcbb7a7cca64bc53b12acdb ("af_unix: Avoid socket->sk NULL
> > OOPS in stream connect security hooks") from the net tree and commit
> > b4e0d5f0791bd6dd12a1c1edea0340969c7c1f90 ("Smack: UDS revision") from the
> > security-testing tree.
> >
> > I fixed it up (I think - see below) and can carry the fix as necessary.
>
> The change looks like it addresses the change in interface. Thank you.
Thanks, applied.
--
James Morris
<jmorris@namei.org>
^ permalink raw reply
* Re: [PATCH] Cleanup include/net/tcp.h include-files and coding-style
From: Christoph Paasch @ 2011-01-09 22:39 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: davem, netdev, linux-kernel
In-Reply-To: <20110109223033.GA9485@p183.telecom.by>
On Sunday, January 09, 2011 wrote Alexey Dobriyan:
> DMA stuff "dereferenced" in tcp_prequeue_init().
Well, as far as I can see, tcp_prequeue_init only accesses the ucopy-fields of
tcp_sock, which are defined in linux/tcp.h.
BTW: shouldn't linux/tcp.h include linux/dmaengine.h ? It has a reference to
"struct dma_pinned_list"
Christoph
--
Christoph Paasch
PhD Student
IP Networking Lab --- http://inl.info.ucl.ac.be
MultiPath TCP in the Linux Kernel --- http://inl.info.ucl.ac.be/mptcp
Université Catholique de Louvain
www.rollerbulls.be
--
^ permalink raw reply
* Re: [PATCH] Cleanup include/net/tcp.h include-files and coding-style
From: Christoph Paasch @ 2011-01-09 22:33 UTC (permalink / raw)
To: Ben Hutchings; +Cc: Randy Dunlap, davem, netdev, linux-kernel
In-Reply-To: <1294610141.2823.31.camel@localhost>
On Sunday, January 09, 2011 wrote Ben Hutchings:
> The cost of repeated inclusion is minimal. GCC's preprocessor
> recognises when the entire content of a file is conditional on #ifndef
> FOO and will not even open it again if FOO is defined.
Thanks, I did not knew about that.
> If a file directly references definitions that are supposed to be
> provided by a certain header, changing it to rely on indirect inclusion
> of that header generally does *not* aid maintenance.
But then, to be coherent, we would need to add the following includes (and I'm
even not 100% sure if it's all we need):
linux/percpu_counter.h (needed for percpu_counter_sum_positive)
linux/mm_types.h (needed for struct page)
linux/aio.h (needed for struct kiocb)
net/inet_sock.h (needed for struct ip_options)
linux/pipe_fs_i.h (needed for struct pipe_inode_info)
linux/poll.h (needed for struct poll_table_struct)
linux/compiler.h (needed for __percpu)
IMO there should be a clear rule for the inclusion of files.
Personally I think it's best to include as few files as possible. Because I
think, that this reduces the risk of including a file, whose structs/functions
aren't even referenced (it's easier to manually check if one include out of 10
is useless, than checking it for 50).
But ok, there may be other stronger reasons for the opposite.
What are the reasons for including these files?
Regards,
Christoph
--
Christoph Paasch
PhD Student
IP Networking Lab --- http://inl.info.ucl.ac.be
MultiPath TCP in the Linux Kernel --- http://inl.info.ucl.ac.be/mptcp
Université Catholique de Louvain
www.rollerbulls.be
--
^ permalink raw reply
* Re: panic in tg3 driver
From: Stephen Clark @ 2011-01-09 22:30 UTC (permalink / raw)
To: Linux Kernel Network Developers; +Cc: Michael Chan, Matt Carlson
In-Reply-To: <4D2334B5.1060408@earthlink.net>
On 01/04/2011 09:54 AM, Stephen Clark wrote:
> Hello,
>
>
> The hardware is an Acrosser AR-M0898B micro box.
> lspci
> 00:00.0 Host bridge: VIA Technologies, Inc. CN700/VN800/P4M800CE/Pro
> Host Bridge
> 00:00.1 Host bridge: VIA Technologies, Inc. CN700/VN800/P4M800CE/Pro
> Host Bridge
> 00:00.2 Host bridge: VIA Technologies, Inc. CN700/VN800/P4M800CE/Pro
> Host Bridge
> 00:00.3 Host bridge: VIA Technologies, Inc. PT890 Host Bridge
> 00:00.4 Host bridge: VIA Technologies, Inc. CN700/VN800/P4M800CE/Pro
> Host Bridge
> 00:00.7 Host bridge: VIA Technologies, Inc. CN700/VN800/P4M800CE/Pro
> Host Bridge
> 00:01.0 PCI bridge: VIA Technologies, Inc. VT8237/VX700 PCI Bridge
> 00:0f.0 IDE interface: VIA Technologies, Inc. VT8251 Serial ATA
> Controller (rev
> 20)
> 00:0f.1 IDE interface: VIA Technologies, Inc.
> VT82C586A/B/VT82C686/A/B/VT823x/A/
> C PIPC Bus Master IDE (rev 07)
> 00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1
> Controller
> (rev 91)
> 00:10.1 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1
> Controller
> (rev 91)
> 00:10.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1
> Controller
> (rev 91)
> 00:10.3 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1
> Controller
> (rev 91)
> 00:10.4 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 90)
> 00:11.0 ISA bridge: VIA Technologies, Inc. VT8251 PCI to ISA Bridge
> 00:11.7 Host bridge: VIA Technologies, Inc. VT8251 Ultra VLINK Controller
> 00:13.0 Host bridge: VIA Technologies, Inc. VT8251 Host Bridge
> 00:13.1 PCI bridge: VIA Technologies, Inc. VT8251 PCI to PCI Bridge
> 02:08.0 Ethernet controller: Broadcom Corporation BCM4401 100Base-T
> (rev 02)
> 02:09.0 Ethernet controller: Broadcom Corporation BCM4401 100Base-T
> (rev 02)
> 80:00.0 PCI bridge: VIA Technologies, Inc. VT8251 PCIE Root Port
> 80:00.1 PCI bridge: VIA Technologies, Inc. VT8251 PCIE Root Port
> 81:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5906M
> Fast Ethernet
> PCI Express (rev 02)
> 82:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5906M
> Fast Ethernet
> PCI Express (rev 02)
>
> Kernel 2.6.36-2.el5.elrepo on an i686
>
> When I try to ifconfig either of the BCM5906M ports the system panics.
>
> Ideas, fixes ?
>
> [root@Z1010 ~]# modprobe tg3
> [root@Z1010 ~]# ifconfig eth2 2.2.2.2/24
> ------------[ cut here ]------------
> kernel BUG at drivers/net/tg3.c:4365!
> invalid opcode: 0000 [#1] PREEMPT SMP
> last sysfs file: /sys/class/net/eth3/address
> Modules linked in: tg3 xt_tcpudp ipt_LOG xt_limit xt_state
> iptable_mangle af_ke]
>
> Pid: 20303, comm: kworker/0:2 Not tainted 2.6.36-2.el5.elrepo #1
> CN700-8251/
> EIP: 0060:[<e1c62f19>] EFLAGS: 00010202 CPU: 0
> EIP is at tg3_tx_recover+0x1e/0x53 [tg3]
> EAX: deece4c0 EBX: dfa9c000 ECX: deece4c0 EDX: ffffffff
> ESI: deece4c0 EDI: deece500 EBP: c1801f38 ESP: c1801f30
> DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
> Process kworker/0:2 (pid: 20303, ti=c1801000 task=df0105d0
> task.ti=dee62000)
> Stack:
> dfa9c000 00000000 c1801f6c e1c630be c1801f6c deece4c0 00000840 00000000
> <0> df251cc0 00000005 00000000 df979800 deece500 deece4c0 00000040
> c1801f94
> <0> e1c661e5 00000000 00000040 c1801f88 e09df1d2 00000000 deece500
> dfab4000
> Call Trace:
> [<e1c630be>] ? tg3_tx+0x157/0x1a2 [tg3]
> [<e1c661e5>] ? tg3_poll_work+0x2b/0x10b [tg3]
> [<e09df1d2>] ? ssb_write32+0x11/0x14 [b44]
> [<e1c662f9>] ? tg3_poll+0x34/0x9a [tg3]
> [<c0674058>] ? net_rx_action+0x7e/0x11c
> [<c04409c9>] ? __do_softirq+0x85/0x10c
> [<c0440944>] ? __do_softirq+0x0/0x10c
> <IRQ>
> [<c04404ef>] ? _local_bh_enable_ip+0x68/0x87
> [<c044051b>] ? local_bh_enable_ip+0xd/0xf
> [<c046593b>] ? __raw_spin_unlock_bh+0x1c/0x1e
> [<c06fa4f2>] ? _raw_spin_unlock_bh+0xd/0xf
> [<e1c6281f>] ? spin_unlock_bh+0xd/0xf [tg3]
> [<e1c62cbe>] ? tg3_full_unlock+0x10/0x12 [tg3]
> [<e1c664c7>] ? tg3_reset_task+0xd7/0xe3 [tg3]
> [<c044ec37>] ? process_one_work+0x10b/0x1bc
> [<e1c663f0>] ? tg3_reset_task+0x0/0xe3 [tg3]
> [<c044fd41>] ? worker_thread+0x77/0xf9
> [<c0453048>] ? kthread+0x60/0x65
> [<c044fcca>] ? worker_thread+0x0/0xf9
> [<c0452fe8>] ? kthread+0x0/0x65
> [<c040337e>] ? kernel_thread_helper+0x6/0x10
> Code: f0 e8 88 ff ff ff 8d 65 f8 5b 5e 5d c3 55 89 e5 56 53 0f 1f 44
> 00 00 f6 8
> EIP: [<e1c62f19>] tg3_tx_recover+0x1e/0x53 [tg3] SS:ESP 0068:c1801f30
> ---[ end trace 82381e9b93e397ad ]---
> Kernel panic - not syncing: Fatal exception in interrupt
> Pid: 20303, comm: kworker/0:2 Tainted: G D
> 2.6.36-2.el5.elrepo #1
> Call Trace:
> [<c043b3cd>] panic+0x62/0x15d
> [<c06fb7d1>] oops_end+0x99/0xa8
> [<e1c62f19>] ? tg3_tx_recover+0x1e/0x53 [tg3]
> [<c0405a62>] die+0x58/0x5e
>
> Thanks,
> Steve
>
Additonal info I compiled the latest kernel 2.6.37-rc8+ and still have the problem.
Also boot with noapic I see this in the dmesg log and interrupts are increasing
like crazy:
tg3.c:v3.115 (October 14, 2010)
tg3 0000:81:00.0: PCI INT A -> Link[LNKA] -> GSI 10 (level, low) -> IRQ 10
tg3 0000:81:00.0: setting latency timer to 64
tg3 0000:81:00.0: PCI: Disallowing DAC for device
tg3 0000:81:00.0: eth2: Tigon3 [partno(BCM95906) rev c002] (PCI Express) MAC add
ress 00:02:b6:36:d1:39
tg3 0000:81:00.0: eth2: attached PHY is 5906 (10/100Base-TX Ethernet) (WireSpeed
[0])
tg3 0000:81:00.0: eth2: RXcsums[1] LinkChgREG[0] MIirq[0] ASF[0] TSOcap[1]
tg3 0000:81:00.0: eth2: dma_rwctrl[76180000] dma_mask[32-bit]
tg3 0000:82:00.0: PCI INT A -> Link[LNKA] -> GSI 10 (level, low) -> IRQ 10
tg3 0000:82:00.0: setting latency timer to 64
tg3 0000:82:00.0: PCI: Disallowing DAC for device
tg3 0000:82:00.0: eth3: Tigon3 [partno(BCM95906) rev c002] (PCI Express) MAC add
ress 00:02:b6:36:d1:3a
tg3 0000:82:00.0: eth3: attached PHY is 5906 (10/100Base-TX Ethernet) (WireSpeed
[0])
tg3 0000:82:00.0: eth3: RXcsums[1] LinkChgREG[0] MIirq[0] ASF[0] TSOcap[1]
tg3 0000:82:00.0: eth3: dma_rwctrl[76180000] dma_mask[32-bit]
tg3 0000:81:00.0: irq 40 for MSI/MSI-X
tg3 0000:81:00.0: eth2: No interrupt was generated using MSI. Switching to INTx
mode. Please report this failure to the PCI maintainer and include system chipse
t information
ADDRCONF(NETDEV_UP): eth2: link is not ready
[root@Z1010 ~]# cat /proc/interrupts
CPU0
0: 162 XT-PIC-XT-PIC timer
1: 2 XT-PIC-XT-PIC i8042
2: 0 XT-PIC-XT-PIC cascade
3: 1 XT-PIC-XT-PIC
4: 4863 XT-PIC-XT-PIC serial
6: 2 XT-PIC-XT-PIC floppy
7: 5 XT-PIC-XT-PIC ehci_hcd:usb1, uhci_hcd:usb3
8: 0 XT-PIC-XT-PIC rtc0
9: 0 XT-PIC-XT-PIC acpi
10: 2334234 XT-PIC-XT-PIC uhci_hcd:usb2, eth0, eth2
[root@Z1010 ~]# cat /proc/interrupts |grep eth2
10: 18388914 XT-PIC-XT-PIC uhci_hcd:usb2, eth0, eth2
[root@Z1010 ~]# cat /proc/interrupts |grep eth2
10: 18901627 XT-PIC-XT-PIC uhci_hcd:usb2, eth0, eth2
--
"They that give up essential liberty to obtain temporary safety,
deserve neither liberty nor safety." (Ben Franklin)
"The course of history shows that as a government grows, liberty
decreases." (Thomas Jefferson)
^ permalink raw reply
* Re: [PATCH] Cleanup include/net/tcp.h include-files and coding-style
From: Alexey Dobriyan @ 2011-01-09 22:30 UTC (permalink / raw)
To: Christoph Paasch; +Cc: davem, netdev, linux-kernel
In-Reply-To: <1294606534-28522-1-git-send-email-christoph.paasch@uclouvain.be>
On Sun, Jan 09, 2011 at 09:55:34PM +0100, Christoph Paasch wrote:
> This patch reviews the include-files of net/tcp.h
> Several #include where redundant. Some where not directly needed by
> net/tcp.h
>
> Files, including net/tcp.h where also including some the *.h-files that
> net/tcp.h is already including. Thus, in these files the inclusion of
> the *.h file is unnecessary.
>
> Redundant includes in net/tcp.h:
>
> linux/list.h --- included by linux/textsearch.h which is included by
> linux/skbuff.h
> linux/slab.h --- included by linux/crypto.h
> linux/cache.h --- included by linux/skbuff.h
> linux/skbuff.h --- included by net/sock.h
> linux/kref.h --- included by linux/kobject.h, which is included by
> linux/device.h, which is included by
> linux/dmaengine.h, which is included by
> linux/skbuff.h
> net/inet_connection_sock.h --- included by net/inet_hashtables.h
> net/checksum.h --- included by net/sock.h
> net/request_sock.h --- included by net/inet_connection_sock.h
> net/sock.h --- included by net/request_sock.h
> net/snmp.h --- included by net/ip.h
> net/dst.h --- included by net/sock.h
> linux/seq_file.h --- included by net/neighbour.h, which is included by
> net/dst.h
>
> Include-files not directly needed by net/tcp.h:
>
> linux/percpu.h
> linux/dmaengine.h
DMA stuff "dereferenced" in tcp_prequeue_init().
> net/tcp_states.h
> net/inet_ecn.h
NAK
Where is the logic?
include/net/tcp.h _does_ use kref, so it needs kref.h
include/net/tcp.h _does_ use list_head, so it needs list.h
and so on.
^ permalink raw reply
* Re: [PATCH] Cleanup include/net/tcp.h include-files and coding-style
From: Ben Hutchings @ 2011-01-09 21:55 UTC (permalink / raw)
To: christoph.paasch; +Cc: Randy Dunlap, davem, netdev, linux-kernel
In-Reply-To: <201101092232.19171.christoph.paasch@uclouvain.be>
On Sun, 2011-01-09 at 22:32 +0100, Christoph Paasch wrote:
> Hello,
>
> On Sunday, January 09, 2011 wrote Randy Dunlap:
> > On Sun, 9 Jan 2011 21:55:34 +0100 Christoph Paasch wrote:
> > If there is something in net/tcp.h that uses data or functions from
> > <linux/list.h>, then <linux/list.h> should be #included in net/tcp.h,
> > whether some other file pulls it in indirectly or not.
> >
> > etc. etc. etc.
> Why?
>
> IMHO I think that it increases compile-time.
> Ok, here in that case it only increases it slightly (probably it isn't even
> measurable).
The cost of repeated inclusion is minimal. GCC's preprocessor
recognises when the entire content of a file is conditional on #ifndef
FOO and will not even open it again if FOO is defined.
> But, if *all* the files would be more strict in including, I'm
> sure that it would make a difference.
> The less files you include, the faster the compilation will be.
>
> In net/tcp.h there were even 4 unnecessary included files.
>
> And, then we would also need to include:
> net/net_namespace.h (for struct net)
>
> Also, I think that it makes the code more readable and also easier to
> maintain. The more files we include, the bigger the chance is that we will end
> up with plenty of files unnecessarily included, and thus the compile-time will
> explode.
If a file directly references definitions that are supposed to be
provided by a certain header, changing it to rely on indirect inclusion
of that header generally does *not* aid maintenance.
(There are some cases where you should rely on indirect inclusion, such
as where <linux/foo.h> includes <asm/foo.h>.)
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
* [PATCH][RFC] Allow to use adler32 for SCTP
From: Holger Hans Peter Freyther @ 2011-01-09 21:36 UTC (permalink / raw)
To: netdev
[-- Attachment #1: Type: text/plain, Size: 782 bytes --]
Hi,
with OpenBSC I have to connect to some equipment that is configured to use
adler32 as the checksum. I wonder if something a long the lines of this patch
is acceptable? It adds a module parameter that globally allows to use adler32
and then there is a sockopt to enable adler32 on a per process basis. For the
receive path I have to decode both checksums.
I could probably just use the code to disable checksums for rx but I will need
to generate them on tx to make the other equipment accept these.
regards
holger
PS: While adding my field to struct sctp_sock I saw that there are quite some
holes (on both ia32,x86_64) in the struct and that one can save 16byte by
re-ordering. I am not sure how to and if to benchmark such a change. Does it
make sense to re-order those?
[-- Attachment #2: 0001-sctp-Allow-to-use-adler32-as-checksum-for-old-equipm.patch --]
[-- Type: text/x-patch, Size: 11572 bytes --]
>From bc332df3e078e4ddac93415a4e11de018604537a Mon Sep 17 00:00:00 2001
From: Holger Hans Peter Freyther <zecke@selfish.org>
Date: Sun, 9 Jan 2011 21:18:04 +0100
Subject: [PATCH] sctp: Allow to use adler32 as checksum for old equipment
Make it possible to use adler32 for outgoing packets. For
incoming packets add an option to determine the crc32 and
adler32. Discard the packet if the socket was not using the
adler32 checksum.
Signed-off-by: Holger Hans Peter Freyther <zecke@selfish.org>
---
include/net/sctp/checksum.h | 35 ++++++++++++++++++++++++++++++++
include/net/sctp/structs.h | 6 +++++
include/net/sctp/user.h | 1 +
net/sctp/input.c | 46 +++++++++++++++++++++++++++++++++++++++---
net/sctp/output.c | 17 +++++++++++++--
net/sctp/protocol.c | 3 ++
net/sctp/socket.c | 23 +++++++++++++++++++++
7 files changed, 124 insertions(+), 7 deletions(-)
diff --git a/include/net/sctp/checksum.h b/include/net/sctp/checksum.h
index befc8d2..9111f52 100644
--- a/include/net/sctp/checksum.h
+++ b/include/net/sctp/checksum.h
@@ -1,6 +1,7 @@
/* SCTP kernel reference Implementation
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001-2003 International Business Machines, Corp.
+ * Copyright (c) 2011 Holger Hans Peter Freyther
*
* This file is part of the SCTP kernel reference Implementation
*
@@ -34,6 +35,7 @@
* Dinakaran Joseph
* Jon Grimm <jgrimm@us.ibm.com>
* Sridhar Samudrala <sri@us.ibm.com>
+ * Holger Hans Peter Freyther <holger@freyther.de>
*
* Rewritten to use libcrc32c by:
* Vlad Yasevich <vladislav.yasevich@hp.com>
@@ -45,6 +47,7 @@
#include <linux/types.h>
#include <net/sctp/sctp.h>
#include <linux/crc32c.h>
+#include <linux/zutil.h>
static inline __u32 sctp_crc32c(__u32 crc, u8 *buffer, u16 length)
{
@@ -81,3 +84,35 @@ static inline __le32 sctp_end_cksum(__be32 crc32)
{
return cpu_to_le32(~crc32);
}
+
+static inline __u32 sctp_start_cksum_adler(__u8 *buffer, __u16 length)
+{
+ __u32 adler = 1;
+ __u8 zero[sizeof(__u32)] = {0};
+
+ /* Optimize this routine to be SCTP specific, knowing how
+ * to skip the checksum field of the SCTP header.
+ */
+
+ /* Calculate adler32 up to the checksum. */
+ adler = zlib_adler32(adler, buffer,
+ sizeof(struct sctphdr) -sizeof(__u32));
+
+ /* Skip checksum field of the header. */
+ adler = zlib_adler32(adler, zero, sizeof(__u32));
+
+ /* Calculate the rest of the adler32. */
+ adler = zlib_adler32(adler, &buffer[sizeof(struct sctphdr)],
+ length - sizeof(struct sctphdr));
+ return adler;
+}
+
+static inline __u32 sctp_update_cksum_adler(__u8 *buffer, __u16 len, __u32 a32)
+{
+ return zlib_adler32(a32, buffer, len);
+}
+
+static inline __u32 sctp_end_cksum_adler(__u32 a32)
+{
+ return htonl(a32);
+}
diff --git a/include/net/sctp/structs.h b/include/net/sctp/structs.h
index cc9185c..d44eb7a 100644
--- a/include/net/sctp/structs.h
+++ b/include/net/sctp/structs.h
@@ -236,6 +236,9 @@ extern struct sctp_globals {
* bits is an indicator of when to send and window update SACK.
*/
int rwnd_update_shift;
+
+ /* Allow Adler32 as Checksum fallback */
+ int allow_adler32;
} sctp_globals;
#define sctp_rto_initial (sctp_globals.rto_initial)
@@ -271,6 +274,7 @@ extern struct sctp_globals {
#define sctp_auth_enable (sctp_globals.auth_enable)
#define sctp_checksum_disable (sctp_globals.checksum_disable)
#define sctp_rwnd_upd_shift (sctp_globals.rwnd_update_shift)
+#define sctp_allow_adler32_csum (sctp_globals.allow_adler32)
/* SCTP Socket type: UDP or TCP style. */
typedef enum {
@@ -338,6 +342,8 @@ struct sctp_sock {
__u32 adaptation_ind;
__u32 pd_point;
+ __u8 cksum_adler;
+
atomic_t pd_mode;
/* Receive to here while partial delivery is in effect. */
struct sk_buff_head pd_lobby;
diff --git a/include/net/sctp/user.h b/include/net/sctp/user.h
index 2b2769c..427da93 100644
--- a/include/net/sctp/user.h
+++ b/include/net/sctp/user.h
@@ -103,6 +103,7 @@ typedef __s32 sctp_assoc_t;
#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local addresss. */
#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */
#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */
+#define SCTP_COMPAT_ADLER_CRC 112 /* User ADLER32 for the checksum. */
/*
* 5.2.1 SCTP Initiation Structure (SCTP_INIT)
diff --git a/net/sctp/input.c b/net/sctp/input.c
index ea21924..471e048 100644
--- a/net/sctp/input.c
+++ b/net/sctp/input.c
@@ -5,6 +5,7 @@
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
* Copyright (c) 2001 La Monte H.P. Yarroll
+ * Copyright (c) 2011 Holger Hans Peter Freyther
*
* This file is part of the SCTP kernel implementation
*
@@ -43,6 +44,7 @@
* Daisy Chang <daisyc@us.ibm.com>
* Sridhar Samudrala <sri@us.ibm.com>
* Ardelle Fan <ardelle.fan@intel.com>
+ * Holger Hans Peter Freyther <holger@freyther.de>
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
@@ -80,7 +82,7 @@ static int sctp_add_backlog(struct sock *sk, struct sk_buff *skb);
/* Calculate the SCTP checksum of an SCTP packet. */
-static inline int sctp_rcv_checksum(struct sk_buff *skb)
+static inline int sctp_rcv_checksum_crc32(struct sk_buff *skb)
{
struct sctphdr *sh = sctp_hdr(skb);
__le32 cmp = sh->checksum;
@@ -102,6 +104,24 @@ static inline int sctp_rcv_checksum(struct sk_buff *skb)
return 0;
}
+static inline int sctp_rcv_checksum_adler32(struct sk_buff *skb)
+{
+ struct sk_buff *list = skb_shinfo(skb)->frag_list;
+ struct sctphdr *sh = sctp_hdr(skb);
+ __u32 cmp = ntohl(sh->checksum);
+ __u32 val = sctp_start_cksum_adler((__u8 *)sh, skb_headlen(skb));
+
+ for (; list; list = list->next)
+ val = sctp_update_cksum_adler((__u8 *)list->data,
+ skb_headlen(list), val);
+
+ val = sctp_end_cksum_adler(val);
+
+ if (val != cmp)
+ return -1;
+ return 0;
+}
+
struct sctp_input_cb {
union {
struct inet_skb_parm h4;
@@ -129,6 +149,8 @@ int sctp_rcv(struct sk_buff *skb)
union sctp_addr dest;
int family;
struct sctp_af *af;
+ int crc32_valid = 0, adler_valid = 0;
+
if (skb->pkt_type!=PACKET_HOST)
goto discard_it;
@@ -144,9 +166,15 @@ int sctp_rcv(struct sk_buff *skb)
__skb_pull(skb, skb_transport_offset(skb));
if (skb->len < sizeof(struct sctphdr))
goto discard_it;
- if (!sctp_checksum_disable && !skb_csum_unnecessary(skb) &&
- sctp_rcv_checksum(skb) < 0)
- goto discard_it;
+
+ /* Check up to two checksums for each packet */
+ if (!sctp_checksum_disable && !skb_csum_unnecessary(skb)) {
+ crc32_valid = sctp_rcv_checksum_crc32(skb) >= 0;
+ if (!crc32_valid && sctp_allow_adler32_csum)
+ adler_valid = sctp_rcv_checksum_adler32(skb) >= 0;
+ if (!crc32_valid && !adler_valid)
+ goto discard_it;
+ }
skb_pull(skb, sizeof(struct sctphdr));
@@ -188,6 +216,16 @@ int sctp_rcv(struct sk_buff *skb)
sk = rcvr->sk;
/*
+ * We have the sctp_sock* now and can see if adler32
+ * fallback is implemented. If not we will have to stop
+ * processing the packet now.
+ */
+ if (!crc32_valid && !sctp_sk(sk)->cksum_adler)
+ goto discard_release;
+ else if (!adler_valid && sctp_sk(sk)->cksum_adler)
+ goto discard_release;
+
+ /*
* If a frame arrives on an interface and the receiving socket is
* bound to another interface, via SO_BINDTODEVICE, treat it as OOTB
*/
diff --git a/net/sctp/output.c b/net/sctp/output.c
index 60600d3..02b2f26 100644
--- a/net/sctp/output.c
+++ b/net/sctp/output.c
@@ -2,6 +2,7 @@
* (C) Copyright IBM Corp. 2001, 2004
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
+ * Copyright (c) 2011 Holger Hans Peter Freyther
*
* This file is part of the SCTP kernel implementation
*
@@ -36,6 +37,7 @@
* Karl Knutson <karl@athena.chicago.il.us>
* Jon Grimm <jgrimm@austin.ibm.com>
* Sridhar Samudrala <sri@us.ibm.com>
+ * Holger Freyther <holger@freyther.de>
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
@@ -502,12 +504,21 @@ int sctp_packet_transmit(struct sctp_packet *packet)
*/
if (!sctp_checksum_disable &&
!(dst->dev->features & (NETIF_F_NO_CSUM | NETIF_F_SCTP_CSUM))) {
- __u32 crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len);
-
/* 3) Put the resultant value into the checksum field in the
* common header, and leave the rest of the bits unchanged.
*/
- sh->checksum = sctp_end_cksum(crc32);
+ __u32 crc32;
+
+ if (sctp_sk(sk)->cksum_adler && sctp_allow_adler32_csum) {
+ crc32 = sctp_start_cksum_adler((__u8 *)sh,
+ cksum_buf_len);
+ crc32 = sctp_end_cksum_adler(crc32);
+ } else {
+ crc32 = sctp_start_cksum((__u8 *)sh, cksum_buf_len);
+ crc32 = sctp_end_cksum(crc32);
+ }
+
+ sh->checksum = crc32;
} else {
if (dst->dev->features & NETIF_F_SCTP_CSUM) {
/* no need to seed psuedo checksum for SCTP */
diff --git a/net/sctp/protocol.c b/net/sctp/protocol.c
index e58f947..f078ef6 100644
--- a/net/sctp/protocol.c
+++ b/net/sctp/protocol.c
@@ -1397,4 +1397,7 @@ MODULE_AUTHOR("Linux Kernel SCTP developers <lksctp-developers@lists.sourceforge
MODULE_DESCRIPTION("Support for the SCTP protocol (RFC2960)");
module_param_named(no_checksums, sctp_checksum_disable, bool, 0644);
MODULE_PARM_DESC(no_checksums, "Disable checksums computing and verification");
+module_param_named(adler_checksums, sctp_allow_adler32_csum, bool, 0644);
+MODULE_PARM_DESC(adler_checksums,
+ "Allow to use adler32 checksums for historic reasons.");
MODULE_LICENSE("GPL");
diff --git a/net/sctp/socket.c b/net/sctp/socket.c
index a09b0dd..e47e39e 100644
--- a/net/sctp/socket.c
+++ b/net/sctp/socket.c
@@ -5,6 +5,7 @@
* Copyright (c) 2001-2003 Intel Corp.
* Copyright (c) 2001-2002 Nokia, Inc.
* Copyright (c) 2001 La Monte H.P. Yarroll
+ * Copyright (c) 2011 Holger Hans Peter Freyther
*
* This file is part of the SCTP kernel implementation
*
@@ -52,6 +53,7 @@
* Ryan Layer <rmlayer@us.ibm.com>
* Anup Pemmaiah <pemmaiah@cc.usu.edu>
* Kevin Gao <kevin.gao@intel.com>
+ * Holger Freyther <holger@freyther.de>
*
* Any bugs reported given to us we will try to fix... any fixes shared will
* be incorporated into the next SCTP release.
@@ -3343,6 +3345,23 @@ static int sctp_setsockopt_del_key(struct sock *sk,
}
+static int sctp_setsockopt_adler_crc(struct sock *sk,
+ char __user *optval,
+ int optlen)
+{
+ int val;
+
+ if (optlen < sizeof(int))
+ return -EINVAL;
+ if (get_user(val, (int __user *)optval))
+ return -EFAULT;
+ if (!sctp_allow_adler32_csum)
+ return -EACCES;
+
+ sctp_sk(sk)->cksum_adler = 1;
+ return 0;
+}
+
/* API 6.2 setsockopt(), getsockopt()
*
@@ -3490,6 +3509,9 @@ SCTP_STATIC int sctp_setsockopt(struct sock *sk, int level, int optname,
case SCTP_AUTH_DELETE_KEY:
retval = sctp_setsockopt_del_key(sk, optval, optlen);
break;
+ case SCTP_COMPAT_ADLER_CRC:
+ retval = sctp_setsockopt_adler_crc(sk, optval, optlen);
+ break;
default:
retval = -ENOPROTOOPT;
break;
@@ -6490,6 +6512,7 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
pp = sctp_sk(oldsk)->bind_hash;
sk_add_bind_node(newsk, &pp->owner);
sctp_sk(newsk)->bind_hash = pp;
+ sctp_sk(newsk)->cksum_adler = sctp_sk(oldsk)->cksum_adler;
inet_sk(newsk)->inet_num = inet_sk(oldsk)->inet_num;
sctp_spin_unlock(&head->lock);
sctp_local_bh_enable();
--
1.7.3.4
^ permalink raw reply related
* [PATCH v2] Madge Ambassador ATM Adapter driver: Always release_firmware() in ucode_init() and don't leak memory.
From: Jesper Juhl @ 2011-01-09 21:32 UTC (permalink / raw)
To: chas williams - CONTRACTOR; +Cc: linux-atm-general, netdev, linux-kernel
In-Reply-To: <20110107100239.28032e5d@thirdoffive.cmf.nrl.navy.mil>
On Fri, 7 Jan 2011, chas williams - CONTRACTOR wrote:
> instead of duplicating the same section again and again, could you
> write something like:
>
> errmsg = "no start record";
> goto fail;
>
> ...
>
> errmsg = "record to long"
> goto fail;
>
> .... whatever ...
>
> return 0;
>
> fail:
> release_firmware(fw)
> PRINTK(KERN_ERR, "Bad microcode data (%s)\n", errmsg);
> return -EINVAL;
> }
>
Sure, we can do that instead.
Failure to call release_firmware() will result in memory leak in
drivers/atm/ambassador.c::ucode_init().
This patch makes sure we always call release_firmware() when needed,
thus removing the leak(s).
Yes, I know checkpatch complains about this patch, but it was either that
or completely mess up the existing style, so I opted to use the existing
style and live with the checkpatch related flak.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
---
ambassador.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
compile tested only.
diff --git a/drivers/atm/ambassador.c b/drivers/atm/ambassador.c
index ffe9b65..9f47e86 100644
--- a/drivers/atm/ambassador.c
+++ b/drivers/atm/ambassador.c
@@ -1926,8 +1926,9 @@ static int __devinit ucode_init (loader_block * lb, amb_dev * dev) {
const struct firmware *fw;
unsigned long start_address;
const struct ihex_binrec *rec;
+ const char *errmsg = 0;
int res;
-
+
res = request_ihex_firmware(&fw, "atmsar11.fw", &dev->pci_dev->dev);
if (res) {
PRINTK (KERN_ERR, "Cannot load microcode data");
@@ -1937,8 +1938,8 @@ static int __devinit ucode_init (loader_block * lb, amb_dev * dev) {
/* First record contains just the start address */
rec = (const struct ihex_binrec *)fw->data;
if (be16_to_cpu(rec->len) != sizeof(__be32) || be32_to_cpu(rec->addr)) {
- PRINTK (KERN_ERR, "Bad microcode data (no start record)");
- return -EINVAL;
+ errmsg = "no start record";
+ goto fail;
}
start_address = be32_to_cpup((__be32 *)rec->data);
@@ -1950,12 +1951,12 @@ static int __devinit ucode_init (loader_block * lb, amb_dev * dev) {
PRINTD (DBG_LOAD, "starting region (%x, %u)", be32_to_cpu(rec->addr),
be16_to_cpu(rec->len));
if (be16_to_cpu(rec->len) > 4 * MAX_TRANSFER_DATA) {
- PRINTK (KERN_ERR, "Bad microcode data (record too long)");
- return -EINVAL;
+ errmsg = "record too long";
+ goto fail;
}
if (be16_to_cpu(rec->len) & 3) {
- PRINTK (KERN_ERR, "Bad microcode data (odd number of bytes)");
- return -EINVAL;
+ errmsg = "odd number of bytes";
+ goto fail;
}
res = loader_write(lb, dev, rec);
if (res)
@@ -1970,6 +1971,10 @@ static int __devinit ucode_init (loader_block * lb, amb_dev * dev) {
res = loader_start(lb, dev, start_address);
return res;
+fail:
+ release_firmware(fw);
+ PRINTK(KERN_ERR, "Bad microcode data (%s)", errmsg);
+ return -EINVAL;
}
/********** give adapter parameters **********/
--
Jesper Juhl <jj@chaosbits.net> http://www.chaosbits.net/
Don't top-post http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please.
^ permalink raw reply related
* Re: [PATCH] Cleanup include/net/tcp.h include-files and coding-style
From: Christoph Paasch @ 2011-01-09 21:32 UTC (permalink / raw)
To: Randy Dunlap; +Cc: davem, netdev, linux-kernel
In-Reply-To: <20110109130608.5c7bb4b0.rdunlap@xenotime.net>
Hello,
On Sunday, January 09, 2011 wrote Randy Dunlap:
> On Sun, 9 Jan 2011 21:55:34 +0100 Christoph Paasch wrote:
> If there is something in net/tcp.h that uses data or functions from
> <linux/list.h>, then <linux/list.h> should be #included in net/tcp.h,
> whether some other file pulls it in indirectly or not.
>
> etc. etc. etc.
Why?
IMHO I think that it increases compile-time.
Ok, here in that case it only increases it slightly (probably it isn't even
measurable). But, if *all* the files would be more strict in including, I'm
sure that it would make a difference.
The less files you include, the faster the compilation will be.
In net/tcp.h there were even 4 unnecessary included files.
And, then we would also need to include:
net/net_namespace.h (for struct net)
Also, I think that it makes the code more readable and also easier to
maintain. The more files we include, the bigger the chance is that we will end
up with plenty of files unnecessarily included, and thus the compile-time will
explode.
Regards,
Christoph
--
Christoph Paasch
PhD Student
IP Networking Lab --- http://inl.info.ucl.ac.be
MultiPath TCP in the Linux Kernel --- http://inl.info.ucl.ac.be/mptcp
Université Catholique de Louvain
www.rollerbulls.be
--
^ permalink raw reply
* Re: [PATCH] netfilter: fix race in conntrack between dump_table and destroy
From: Pablo Neira Ayuso @ 2011-01-09 21:32 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Eric Dumazet, Patrick McHardy, Paul E. McKenney, netdev,
netfilter-devel
In-Reply-To: <20101126135101.4e4b97cc@nehalam>
On 26/11/10 22:51, Stephen Hemminger wrote:
> The netlink interface to dump the connection tracking table has a race
> when entries are deleted at the same time. A customer reported a crash
> and the backtrace showed thatctnetlink_dump_table was running while a
> conntrack entry wasbeing destroyed.
> (see https://bugzilla.vyatta.com/show_bug.cgi?id=6402).
>
> According to RCU documentation, when using hlist_nulls the reader
> must handle the case of seeing a deleted entry and not proceed
> further down the linked list. The old code would continue
> which caused the scan to walk into the free list.
>
> This patch uses locking (rather than RCU) for this operation which
> is guaranteed safe, and no longer requires getting reference while
> doing dump operation.
I have put this in my tree:
http://1984.lsi.us.es/git/?p=net-2.6/.git;a=summary
I'll pass it to David for -stable inclusion.
^ permalink raw reply
* Re: [PATCH v4 net-next-2.6] netfilter: x_tables: dont block BH while reading counters
From: Pablo Neira Ayuso @ 2011-01-09 21:31 UTC (permalink / raw)
To: Eric Dumazet
Cc: Patrick McHardy, David Miller, Jesper Dangaard Brouer,
netfilter-devel, netdev, Stephen Hemminger
In-Reply-To: <1294505112.2709.534.camel@edumazet-laptop>
On 08/01/11 17:45, Eric Dumazet wrote:
> David,
>
> I am resending this patch, sent 3 weeks ago, Patrick gave no answer.
>
> I believe it should be included in linux-2.6.38 and stable kernels.
>
> Some people found they had to change NIC RX ring sizes in order not
> missing frames (from 1024 to 2048), while root cause of the problem was
> this.
>
> Quoting Jesper : "I can now hit the system with a pktgen at 128 bytes,
> and see no drops/overruns while running iptables. (This packet load at
> 128bytes is 822 kpps and 840Mbit/s) (iptables ruleset is the big chains:
> 20929 rules: 81239)."
I have enqueued this patch to me tree.
http://1984.lsi.us.es/git/?p=net-2.6/.git;a=summary
I'll pass it to davem for -stable submission.
^ permalink raw reply
* Re: [PATCH V8 02/13] ntp: add ADJ_SETOFFSET mode bit
From: Kuwahara,T. @ 2011-01-09 21:07 UTC (permalink / raw)
To: Richard Cochran
Cc: linux-kernel-u79uwXL29TY76Z2rM5mHXA,
linux-api-u79uwXL29TY76Z2rM5mHXA, netdev-u79uwXL29TY76Z2rM5mHXA,
Alan Cox, Arnd Bergmann, Christoph Lameter, David Miller,
John Stultz, Krzysztof Halasa, Peter Zijlstra, Rodolfo Giometti,
Thomas Gleixner
In-Reply-To: <20110108175028.GA22308-7KxsofuKt4IfAd9E5cN8NEzG7cXyKsk/@public.gmane.org>
On Sun, Jan 9, 2011 at 2:50 AM, Richard Cochran
<richardcochran-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> we want to be able to jump the clock arbitrarily.
Another problem remains: How do you deal with leap seconds? I mean,
given that 1 minute is not always 60 seconds, then what time was it
XXXXX seconds ago? Maybe some kind of lookup table is necessary, but
in such case, isn't it a better choice just to use the
clock_settime/settimeofday syscall?
^ permalink raw reply
* Re: [PATCH] Cleanup include/net/tcp.h include-files and coding-style
From: Randy Dunlap @ 2011-01-09 21:06 UTC (permalink / raw)
To: Christoph Paasch; +Cc: davem, netdev, linux-kernel
In-Reply-To: <1294606534-28522-1-git-send-email-christoph.paasch@uclouvain.be>
On Sun, 9 Jan 2011 21:55:34 +0100 Christoph Paasch wrote:
> This patch reviews the include-files of net/tcp.h
> Several #include where redundant. Some where not directly needed by
> net/tcp.h
>
> Files, including net/tcp.h where also including some the *.h-files that
> net/tcp.h is already including. Thus, in these files the inclusion of
> the *.h file is unnecessary.
>
> Redundant includes in net/tcp.h:
>
> linux/list.h --- included by linux/textsearch.h which is included by
> linux/skbuff.h
If there is something in net/tcp.h that uses data or functions from <linux/list.h>,
then <linux/list.h> should be #included in net/tcp.h, whether some other file
pulls it in indirectly or not.
etc. etc. etc.
> linux/slab.h --- included by linux/crypto.h
> linux/cache.h --- included by linux/skbuff.h
> linux/skbuff.h --- included by net/sock.h
> linux/kref.h --- included by linux/kobject.h, which is included by
> linux/device.h, which is included by
> linux/dmaengine.h, which is included by
> linux/skbuff.h
> net/inet_connection_sock.h --- included by net/inet_hashtables.h
> net/checksum.h --- included by net/sock.h
> net/request_sock.h --- included by net/inet_connection_sock.h
> net/sock.h --- included by net/request_sock.h
> net/snmp.h --- included by net/ip.h
> net/dst.h --- included by net/sock.h
> linux/seq_file.h --- included by net/neighbour.h, which is included by
> net/dst.h
>
> Include-files not directly needed by net/tcp.h:
>
> linux/percpu.h
> linux/dmaengine.h
> net/tcp_states.h
> net/inet_ecn.h
---
~Randy
*** Remember to use Documentation/SubmitChecklist when testing your code ***
^ permalink raw reply
* [PATCH] Cleanup include/net/tcp.h include-files and coding-style
From: Christoph Paasch @ 2011-01-09 20:55 UTC (permalink / raw)
To: davem; +Cc: netdev, linux-kernel, Christoph Paasch
This patch reviews the include-files of net/tcp.h
Several #include where redundant. Some where not directly needed by
net/tcp.h
Files, including net/tcp.h where also including some the *.h-files that
net/tcp.h is already including. Thus, in these files the inclusion of
the *.h file is unnecessary.
Redundant includes in net/tcp.h:
linux/list.h --- included by linux/textsearch.h which is included by
linux/skbuff.h
linux/slab.h --- included by linux/crypto.h
linux/cache.h --- included by linux/skbuff.h
linux/skbuff.h --- included by net/sock.h
linux/kref.h --- included by linux/kobject.h, which is included by
linux/device.h, which is included by
linux/dmaengine.h, which is included by
linux/skbuff.h
net/inet_connection_sock.h --- included by net/inet_hashtables.h
net/checksum.h --- included by net/sock.h
net/request_sock.h --- included by net/inet_connection_sock.h
net/sock.h --- included by net/request_sock.h
net/snmp.h --- included by net/ip.h
net/dst.h --- included by net/sock.h
linux/seq_file.h --- included by net/neighbour.h, which is included by
net/dst.h
Include-files not directly needed by net/tcp.h:
linux/percpu.h
linux/dmaengine.h
net/tcp_states.h
net/inet_ecn.h
Signed-off-by: Christoph Paasch <christoph.paasch@uclouvain.be>
---
drivers/block/drbd/drbd_int.h | 4 ---
drivers/dma/ioat/dma.h | 1 -
drivers/dma/iovlock.c | 1 -
drivers/infiniband/core/cma.c | 1 -
drivers/infiniband/hw/nes/nes_cm.c | 4 ---
drivers/infiniband/hw/nes/nes_nic.c | 2 -
drivers/net/benet/be.h | 2 -
drivers/net/bna/bnad.h | 1 -
drivers/net/bnx2.c | 5 ----
drivers/net/bnx2x/bnx2x_main.c | 4 ---
drivers/net/cnic.c | 3 --
drivers/net/cxgb3/cxgb3_defs.h | 1 -
drivers/net/cxgb4/sge.c | 1 -
drivers/net/cxgb4vf/sge.c | 1 -
drivers/net/myri10ge/myri10ge.c | 5 ----
drivers/net/pch_gbe/pch_gbe.h | 1 -
drivers/net/s2io.c | 3 --
drivers/net/slhc.c | 5 ----
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 1 -
drivers/scsi/cxgbi/libcxgbi.c | 3 --
drivers/scsi/iscsi_tcp.c | 2 -
drivers/scsi/libiscsi.c | 1 -
drivers/scsi/libiscsi_tcp.c | 3 --
drivers/scsi/qla4xxx/ql4_def.h | 2 -
drivers/scsi/scsi_transport_iscsi.c | 1 -
fs/dlm/lowcomms.c | 2 -
fs/ocfs2/cluster/tcp.c | 2 -
include/linux/inet_lro.h | 1 -
include/net/netfilter/nf_tproxy_core.h | 3 --
include/net/tcp.h | 40 ++++++++------------------------
net/ceph/messenger.c | 1 -
net/core/netpoll.c | 1 -
net/core/sock.c | 6 ----
net/dccp/dccp.h | 2 -
net/dccp/ipv6.c | 1 +
net/ipv4/af_inet.c | 6 ----
net/ipv4/arp.c | 5 ----
net/ipv4/cipso_ipv4.c | 3 --
net/ipv4/fib_frontend.c | 5 ----
net/ipv4/fib_hash.c | 4 ---
net/ipv4/fib_rules.c | 2 -
net/ipv4/fib_semantics.c | 4 ---
net/ipv4/fib_trie.c | 5 ----
net/ipv4/icmp.c | 6 ----
net/ipv4/inet_diag.c | 5 ----
net/ipv4/inet_lro.c | 2 +
net/ipv4/ip_forward.c | 6 ----
net/ipv4/ip_input.c | 1 -
net/ipv4/netfilter/ipt_LOG.c | 1 -
net/ipv4/netfilter/ipt_REJECT.c | 4 ---
net/ipv4/netfilter/nf_nat_core.c | 3 --
net/ipv4/netfilter/nf_nat_h323.c | 1 -
net/ipv4/netfilter/nf_nat_helper.c | 3 --
net/ipv4/proc.c | 2 -
net/ipv4/route.c | 5 ----
net/ipv4/syncookies.c | 3 --
net/ipv4/sysctl_net_ipv4.c | 3 --
net/ipv4/tcp.c | 6 ----
net/ipv4/tcp_cong.c | 1 -
net/ipv4/tcp_diag.c | 2 -
net/ipv4/tcp_illinois.c | 1 -
net/ipv4/tcp_input.c | 3 +-
net/ipv4/tcp_ipv4.c | 5 ----
net/ipv4/tcp_minisocks.c | 1 -
net/ipv4/tcp_output.c | 1 +
net/ipv4/tcp_probe.c | 2 -
net/ipv4/tcp_vegas.c | 1 -
net/ipv4/tcp_veno.c | 1 -
net/ipv4/tcp_westwood.c | 1 -
net/ipv4/tcp_yeah.c | 1 -
net/ipv6/addrconf.c | 5 ----
net/ipv6/af_inet6.c | 2 -
net/ipv6/ipv6_sockglue.c | 3 --
net/ipv6/netfilter/ip6t_LOG.c | 1 -
net/ipv6/netfilter/ip6t_REJECT.c | 1 -
net/ipv6/proc.c | 3 --
net/ipv6/route.c | 4 ---
net/ipv6/syncookies.c | 2 -
net/ipv6/tcp_ipv6.c | 4 ---
net/netfilter/ipvs/ip_vs_app.c | 3 --
net/netfilter/ipvs/ip_vs_core.c | 3 --
net/netfilter/ipvs/ip_vs_ftp.c | 1 -
net/netfilter/ipvs/ip_vs_proto.c | 1 -
net/netfilter/ipvs/ip_vs_proto_tcp.c | 2 -
net/netfilter/ipvs/ip_vs_xmit.c | 3 --
net/netfilter/nf_conntrack_ftp.c | 2 -
net/netfilter/nf_conntrack_proto_tcp.c | 2 -
net/netfilter/xt_TCPMSS.c | 3 --
net/netfilter/xt_TCPOPTSTRIP.c | 2 -
net/netfilter/xt_osf.c | 5 ----
net/netfilter/xt_socket.c | 2 -
net/netfilter/xt_tcpmss.c | 1 -
net/netfilter/xt_tcpudp.c | 1 -
net/rds/tcp.c | 1 -
net/rds/tcp_recv.c | 1 -
net/sched/act_csum.c | 3 --
net/sched/act_nat.c | 3 --
net/sunrpc/svcsock.c | 6 ----
net/sunrpc/xprtsock.c | 4 ---
security/selinux/hooks.c | 3 --
100 files changed, 15 insertions(+), 284 deletions(-)
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index 1ea1a34..e947b2d 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -29,13 +29,9 @@
#include <linux/compiler.h>
#include <linux/types.h>
#include <linux/version.h>
-#include <linux/list.h>
#include <linux/sched.h>
#include <linux/bitops.h>
-#include <linux/slab.h>
-#include <linux/crypto.h>
#include <linux/ratelimit.h>
-#include <linux/tcp.h>
#include <linux/mutex.h>
#include <linux/major.h>
#include <linux/blkdev.h>
diff --git a/drivers/dma/ioat/dma.h b/drivers/dma/ioat/dma.h
index 5216c8a..ea07750 100644
--- a/drivers/dma/ioat/dma.h
+++ b/drivers/dma/ioat/dma.h
@@ -26,7 +26,6 @@
#include "registers.h"
#include <linux/init.h>
#include <linux/dmapool.h>
-#include <linux/cache.h>
#include <linux/pci_ids.h>
#include <net/tcp.h>
diff --git a/drivers/dma/iovlock.c b/drivers/dma/iovlock.c
index bb48a57..c0a272c 100644
--- a/drivers/dma/iovlock.c
+++ b/drivers/dma/iovlock.c
@@ -27,7 +27,6 @@
#include <linux/dmaengine.h>
#include <linux/pagemap.h>
-#include <linux/slab.h>
#include <net/tcp.h> /* for memcpy_toiovec */
#include <asm/io.h>
#include <asm/uaccess.h>
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 6884da2..7475b09 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -40,7 +40,6 @@
#include <linux/random.h>
#include <linux/idr.h>
#include <linux/inetdevice.h>
-#include <linux/slab.h>
#include <net/tcp.h>
#include <net/ipv6.h>
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 25ad0f9..2518bf2 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -35,9 +35,7 @@
#define TCPOPT_TIMESTAMP 8
#include <asm/atomic.h>
-#include <linux/skbuff.h>
#include <linux/ip.h>
-#include <linux/tcp.h>
#include <linux/init.h>
#include <linux/if_arp.h>
#include <linux/if_vlan.h>
@@ -50,10 +48,8 @@
#include <linux/etherdevice.h>
#include <linux/netdevice.h>
#include <linux/random.h>
-#include <linux/list.h>
#include <linux/threads.h>
#include <linux/highmem.h>
-#include <linux/slab.h>
#include <net/arp.h>
#include <net/neighbour.h>
#include <net/route.h>
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index 3892e2c..8d2a43b 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -36,11 +36,9 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/ip.h>
-#include <linux/tcp.h>
#include <linux/if_arp.h>
#include <linux/if_vlan.h>
#include <linux/ethtool.h>
-#include <linux/slab.h>
#include <net/tcp.h>
#include <net/inet_common.h>
diff --git a/drivers/net/benet/be.h b/drivers/net/benet/be.h
index d64313b..f0df37c 100644
--- a/drivers/net/benet/be.h
+++ b/drivers/net/benet/be.h
@@ -23,13 +23,11 @@
#include <linux/version.h>
#include <linux/delay.h>
#include <net/tcp.h>
-#include <net/ip.h>
#include <net/ipv6.h>
#include <linux/if_vlan.h>
#include <linux/workqueue.h>
#include <linux/interrupt.h>
#include <linux/firmware.h>
-#include <linux/slab.h>
#include "be_hw.h"
diff --git a/drivers/net/bna/bnad.h b/drivers/net/bna/bnad.h
index ebc3a90..30fdc90 100644
--- a/drivers/net/bna/bnad.h
+++ b/drivers/net/bna/bnad.h
@@ -29,7 +29,6 @@
#include <asm/checksum.h>
#include <net/ip6_checksum.h>
-#include <net/ip.h>
#include <net/tcp.h>
#include "bna.h"
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 062600b..51625b9 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -18,14 +18,12 @@
#include <linux/timer.h>
#include <linux/errno.h>
#include <linux/ioport.h>
-#include <linux/slab.h>
#include <linux/vmalloc.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
#include <linux/dma-mapping.h>
#include <linux/bitops.h>
#include <asm/io.h>
@@ -37,13 +35,10 @@
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/if_vlan.h>
-#include <net/ip.h>
#include <net/tcp.h>
-#include <net/checksum.h>
#include <linux/workqueue.h>
#include <linux/crc32.h>
#include <linux/prefetch.h>
-#include <linux/cache.h>
#include <linux/firmware.h>
#include <linux/log2.h>
#include <linux/aer.h>
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index 9709b85..5d87318 100644
--- a/drivers/net/bnx2x/bnx2x_main.c
+++ b/drivers/net/bnx2x/bnx2x_main.c
@@ -22,13 +22,11 @@
#include <linux/timer.h>
#include <linux/errno.h>
#include <linux/ioport.h>
-#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
-#include <linux/skbuff.h>
#include <linux/dma-mapping.h>
#include <linux/bitops.h>
#include <linux/irq.h>
@@ -38,9 +36,7 @@
#include <linux/ethtool.h>
#include <linux/mii.h>
#include <linux/if_vlan.h>
-#include <net/ip.h>
#include <net/tcp.h>
-#include <net/checksum.h>
#include <net/ip6_checksum.h>
#include <linux/workqueue.h>
#include <linux/crc32.h>
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 6dff321..3f47a8a 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -16,8 +16,6 @@
#include <linux/kernel.h>
#include <linux/errno.h>
-#include <linux/list.h>
-#include <linux/slab.h>
#include <linux/pci.h>
#include <linux/init.h>
#include <linux/netdevice.h>
@@ -30,7 +28,6 @@
#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
#define BCM_VLAN 1
#endif
-#include <net/ip.h>
#include <net/tcp.h>
#include <net/route.h>
#include <net/ipv6.h>
diff --git a/drivers/net/cxgb3/cxgb3_defs.h b/drivers/net/cxgb3/cxgb3_defs.h
index 920d918..fd1c520 100644
--- a/drivers/net/cxgb3/cxgb3_defs.h
+++ b/drivers/net/cxgb3/cxgb3_defs.h
@@ -32,7 +32,6 @@
#ifndef _CHELSIO_DEFS_H
#define _CHELSIO_DEFS_H
-#include <linux/skbuff.h>
#include <net/tcp.h>
#include "t3cdev.h"
diff --git a/drivers/net/cxgb4/sge.c b/drivers/net/cxgb4/sge.c
index 1702225..ca0f062 100644
--- a/drivers/net/cxgb4/sge.c
+++ b/drivers/net/cxgb4/sge.c
@@ -32,7 +32,6 @@
* SOFTWARE.
*/
-#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/if_vlan.h>
diff --git a/drivers/net/cxgb4vf/sge.c b/drivers/net/cxgb4vf/sge.c
index ecf0770..d051a5f 100644
--- a/drivers/net/cxgb4vf/sge.c
+++ b/drivers/net/cxgb4vf/sge.c
@@ -33,7 +33,6 @@
* SOFTWARE.
*/
-#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/if_vlan.h>
diff --git a/drivers/net/myri10ge/myri10ge.c b/drivers/net/myri10ge/myri10ge.c
index 8524cc4..5677677 100644
--- a/drivers/net/myri10ge/myri10ge.c
+++ b/drivers/net/myri10ge/myri10ge.c
@@ -40,9 +40,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
-#include <linux/tcp.h>
#include <linux/netdevice.h>
-#include <linux/skbuff.h>
#include <linux/string.h>
#include <linux/module.h>
#include <linux/pci.h>
@@ -64,9 +62,6 @@
#include <linux/moduleparam.h>
#include <linux/io.h>
#include <linux/log2.h>
-#include <linux/slab.h>
-#include <net/checksum.h>
-#include <net/ip.h>
#include <net/tcp.h>
#include <asm/byteorder.h>
#include <asm/io.h>
diff --git a/drivers/net/pch_gbe/pch_gbe.h b/drivers/net/pch_gbe/pch_gbe.h
index a0c26a9..264088a 100644
--- a/drivers/net/pch_gbe/pch_gbe.h
+++ b/drivers/net/pch_gbe/pch_gbe.h
@@ -30,7 +30,6 @@
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
#include <linux/vmalloc.h>
-#include <net/ip.h>
#include <net/tcp.h>
#include <net/udp.h>
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index ecc25aa..f0e243f 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -64,7 +64,6 @@
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/mdio.h>
-#include <linux/skbuff.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/stddef.h>
@@ -74,10 +73,8 @@
#include <linux/workqueue.h>
#include <linux/if_vlan.h>
#include <linux/ip.h>
-#include <linux/tcp.h>
#include <linux/uaccess.h>
#include <linux/io.h>
-#include <linux/slab.h>
#include <net/tcp.h>
#include <asm/system.h>
diff --git a/drivers/net/slhc.c b/drivers/net/slhc.c
index ab9e3b7..869d0bc 100644
--- a/drivers/net/slhc.c
+++ b/drivers/net/slhc.c
@@ -51,7 +51,6 @@
*/
#include <linux/module.h>
-#include <linux/slab.h>
#include <linux/types.h>
#include <linux/string.h>
#include <linux/errno.h>
@@ -68,16 +67,12 @@
#include <linux/fcntl.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
-#include <net/ip.h>
#include <net/protocol.h>
#include <net/icmp.h>
#include <net/tcp.h>
-#include <linux/skbuff.h>
-#include <net/sock.h>
#include <linux/timer.h>
#include <asm/system.h>
#include <asm/uaccess.h>
-#include <net/checksum.h>
#include <asm/unaligned.h>
static unsigned char *encode(unsigned char *cp, unsigned short n);
diff --git a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
index 8c04fad..8b95399 100644
--- a/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
+++ b/drivers/scsi/cxgbi/cxgb4i/cxgb4i.c
@@ -18,7 +18,6 @@
#include <linux/moduleparam.h>
#include <scsi/scsi_host.h>
#include <net/tcp.h>
-#include <net/dst.h>
#include <linux/netdevice.h>
#include "t4_msg.h"
diff --git a/drivers/scsi/cxgbi/libcxgbi.c b/drivers/scsi/cxgbi/libcxgbi.c
index be56617..f3ca6b2 100644
--- a/drivers/scsi/cxgbi/libcxgbi.c
+++ b/drivers/scsi/cxgbi/libcxgbi.c
@@ -13,8 +13,6 @@
#define pr_fmt(fmt) KBUILD_MODNAME ":%s: " fmt, __func__
-#include <linux/skbuff.h>
-#include <linux/crypto.h>
#include <linux/scatterlist.h>
#include <linux/pci.h>
#include <scsi/scsi.h>
@@ -22,7 +20,6 @@
#include <scsi/scsi_host.h>
#include <linux/if_vlan.h>
#include <linux/inet.h>
-#include <net/dst.h>
#include <net/route.h>
#include <linux/inetdevice.h> /* ip_dev_find */
#include <net/tcp.h>
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index fec47de..48a10ac 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -28,10 +28,8 @@
#include <linux/types.h>
#include <linux/inet.h>
-#include <linux/slab.h>
#include <linux/file.h>
#include <linux/blkdev.h>
-#include <linux/crypto.h>
#include <linux/delay.h>
#include <linux/kfifo.h>
#include <linux/scatterlist.h>
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index c15fde8..90bef29 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -25,7 +25,6 @@
#include <linux/kfifo.h>
#include <linux/delay.h>
#include <linux/log2.h>
-#include <linux/slab.h>
#include <asm/unaligned.h>
#include <net/tcp.h>
#include <scsi/scsi_cmnd.h>
diff --git a/drivers/scsi/libiscsi_tcp.c b/drivers/scsi/libiscsi_tcp.c
index 8eeb39f..946dff5 100644
--- a/drivers/scsi/libiscsi_tcp.c
+++ b/drivers/scsi/libiscsi_tcp.c
@@ -27,12 +27,9 @@
*/
#include <linux/types.h>
-#include <linux/list.h>
#include <linux/inet.h>
-#include <linux/slab.h>
#include <linux/file.h>
#include <linux/blkdev.h>
-#include <linux/crypto.h>
#include <linux/delay.h>
#include <linux/kfifo.h>
#include <linux/scatterlist.h>
diff --git a/drivers/scsi/qla4xxx/ql4_def.h b/drivers/scsi/qla4xxx/ql4_def.h
index 0f3bfc3..5b6a212 100644
--- a/drivers/scsi/qla4xxx/ql4_def.h
+++ b/drivers/scsi/qla4xxx/ql4_def.h
@@ -12,11 +12,9 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/module.h>
-#include <linux/list.h>
#include <linux/pci.h>
#include <linux/dma-mapping.h>
#include <linux/sched.h>
-#include <linux/slab.h>
#include <linux/dmapool.h>
#include <linux/mempool.h>
#include <linux/spinlock.h>
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 332387a..b1d1e62 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -22,7 +22,6 @@
*/
#include <linux/module.h>
#include <linux/mutex.h>
-#include <linux/slab.h>
#include <net/tcp.h>
#include <scsi/scsi.h>
#include <scsi/scsi_host.h>
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
index 37a34c2..afb84f5 100644
--- a/fs/dlm/lowcomms.c
+++ b/fs/dlm/lowcomms.c
@@ -45,13 +45,11 @@
*/
#include <asm/ioctls.h>
-#include <net/sock.h>
#include <net/tcp.h>
#include <linux/pagemap.h>
#include <linux/file.h>
#include <linux/mutex.h>
#include <linux/sctp.h>
-#include <linux/slab.h>
#include <net/sctp/user.h>
#include <net/ipv6.h>
diff --git a/fs/ocfs2/cluster/tcp.c b/fs/ocfs2/cluster/tcp.c
index 9aa426e..be7979b 100644
--- a/fs/ocfs2/cluster/tcp.c
+++ b/fs/ocfs2/cluster/tcp.c
@@ -55,9 +55,7 @@
#include <linux/kernel.h>
#include <linux/jiffies.h>
-#include <linux/slab.h>
#include <linux/idr.h>
-#include <linux/kref.h>
#include <linux/net.h>
#include <net/tcp.h>
diff --git a/include/linux/inet_lro.h b/include/linux/inet_lro.h
index c4335fa..62ebac7 100644
--- a/include/linux/inet_lro.h
+++ b/include/linux/inet_lro.h
@@ -28,7 +28,6 @@
#ifndef __INET_LRO_H_
#define __INET_LRO_H_
-#include <net/ip.h>
#include <net/tcp.h>
/*
diff --git a/include/net/netfilter/nf_tproxy_core.h b/include/net/netfilter/nf_tproxy_core.h
index cd85b3b..e8ea472 100644
--- a/include/net/netfilter/nf_tproxy_core.h
+++ b/include/net/netfilter/nf_tproxy_core.h
@@ -3,9 +3,6 @@
#include <linux/types.h>
#include <linux/in.h>
-#include <linux/skbuff.h>
-#include <net/sock.h>
-#include <net/inet_hashtables.h>
#include <net/inet6_hashtables.h>
#include <net/tcp.h>
diff --git a/include/net/tcp.h b/include/net/tcp.h
index e36c874..5bd3122 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -21,30 +21,13 @@
#define TCP_DEBUG 1
#define FASTRETRANS_DEBUG 1
-#include <linux/list.h>
#include <linux/tcp.h>
-#include <linux/slab.h>
-#include <linux/cache.h>
-#include <linux/percpu.h>
-#include <linux/skbuff.h>
-#include <linux/dmaengine.h>
#include <linux/crypto.h>
#include <linux/cryptohash.h>
-#include <linux/kref.h>
-#include <net/inet_connection_sock.h>
#include <net/inet_timewait_sock.h>
#include <net/inet_hashtables.h>
-#include <net/checksum.h>
-#include <net/request_sock.h>
-#include <net/sock.h>
-#include <net/snmp.h>
#include <net/ip.h>
-#include <net/tcp_states.h>
-#include <net/inet_ecn.h>
-#include <net/dst.h>
-
-#include <linux/seq_file.h>
extern struct inet_hashinfo tcp_hashinfo;
@@ -258,7 +241,7 @@ extern int tcp_memory_pressure;
static inline int before(__u32 seq1, __u32 seq2)
{
- return (__s32)(seq1-seq2) < 0;
+ return (__s32) (seq1 - seq2) < 0;
}
#define after(seq2, seq1) before(seq1, seq2)
@@ -421,7 +404,7 @@ extern int tcp_disconnect(struct sock *sk, int flags);
/* From syncookies.c */
-extern __u32 syncookie_secret[2][16-4+SHA_DIGEST_WORDS];
+extern __u32 syncookie_secret[2][16 - 4 + SHA_DIGEST_WORDS];
extern struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
struct ip_options *opt);
extern __u32 cookie_v4_init_sequence(struct sock *sk, struct sk_buff *skb,
@@ -498,7 +481,7 @@ extern void tcp_get_info(struct sock *, struct tcp_info *);
/* Read 'sendfile()'-style from a TCP socket */
typedef int (*sk_read_actor_t)(read_descriptor_t *, struct sk_buff *,
- unsigned int, size_t);
+ unsigned int, size_t);
extern int tcp_read_sock(struct sock *sk, read_descriptor_t *desc,
sk_read_actor_t recv_actor);
@@ -578,9 +561,9 @@ extern u32 __tcp_select_window(struct sock *sk);
* to use only the low 32-bits of jiffies and hide the ugly
* casts with the following macro.
*/
-#define tcp_time_stamp ((__u32)(jiffies))
+#define tcp_time_stamp ((__u32) (jiffies))
-#define tcp_flag_byte(th) (((u_int8_t *)th)[13])
+#define tcp_flag_byte(th) (((u_int8_t *) th)[13])
#define TCPHDR_FIN 0x01
#define TCPHDR_SYN 0x02
@@ -620,7 +603,7 @@ struct tcp_skb_cb {
__u32 ack_seq; /* Sequence number ACK'd */
};
-#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *)&((__skb)->cb[0]))
+#define TCP_SKB_CB(__skb) ((struct tcp_skb_cb *) &((__skb)->cb[0]))
/* Due to TSO, an SKB can be composed of multiple actual
* packets. To keep these tracked properly, we use this.
@@ -962,9 +945,9 @@ extern void tcp_select_initial_window(int __space, __u32 mss,
static inline int tcp_win_from_space(int space)
{
- return sysctl_tcp_adv_win_scale<=0 ?
- (space>>(-sysctl_tcp_adv_win_scale)) :
- space - (space>>sysctl_tcp_adv_win_scale);
+ return sysctl_tcp_adv_win_scale <= 0 ?
+ (space >> (- sysctl_tcp_adv_win_scale)) :
+ space - (space >> sysctl_tcp_adv_win_scale);
}
/* Note: caller must be prepared to deal with negative returns */
@@ -1094,9 +1077,6 @@ static inline void tcp_clear_all_retrans_hints(struct tcp_sock *tp)
tp->retransmit_skb_hint = NULL;
}
-/* MD5 Signature */
-struct crypto_hash;
-
/* - key database */
struct tcp_md5sig_key {
u8 *key;
@@ -1529,7 +1509,7 @@ struct tcp_extend_values {
static inline struct tcp_extend_values *tcp_xv(struct request_values *rvp)
{
- return (struct tcp_extend_values *)rvp;
+ return (struct tcp_extend_values *) rvp;
}
extern void tcp_v4_init(void);
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
index b6ff4a1..480f82e 100644
--- a/net/ceph/messenger.c
+++ b/net/ceph/messenger.c
@@ -6,7 +6,6 @@
#include <linux/inet.h>
#include <linux/kthread.h>
#include <linux/net.h>
-#include <linux/slab.h>
#include <linux/socket.h>
#include <linux/string.h>
#include <linux/bio.h>
diff --git a/net/core/netpoll.c b/net/core/netpoll.c
index 4e98ffa..30b1d37 100644
--- a/net/core/netpoll.c
+++ b/net/core/netpoll.c
@@ -22,7 +22,6 @@
#include <linux/delay.h>
#include <linux/rcupdate.h>
#include <linux/workqueue.h>
-#include <linux/slab.h>
#include <net/tcp.h>
#include <net/udp.h>
#include <asm/unaligned.h>
diff --git a/net/core/sock.c b/net/core/sock.c
index e5af8d5..71634cb 100644
--- a/net/core/sock.c
+++ b/net/core/sock.c
@@ -97,17 +97,14 @@
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
#include <linux/sched.h>
#include <linux/timer.h>
#include <linux/string.h>
#include <linux/sockios.h>
#include <linux/net.h>
#include <linux/mm.h>
-#include <linux/slab.h>
#include <linux/interrupt.h>
#include <linux/poll.h>
-#include <linux/tcp.h>
#include <linux/init.h>
#include <linux/highmem.h>
#include <linux/user_namespace.h>
@@ -117,10 +114,7 @@
#include <linux/netdevice.h>
#include <net/protocol.h>
-#include <linux/skbuff.h>
#include <net/net_namespace.h>
-#include <net/request_sock.h>
-#include <net/sock.h>
#include <linux/net_tstamp.h>
#include <net/xfrm.h>
#include <linux/ipsec.h>
diff --git a/net/dccp/dccp.h b/net/dccp/dccp.h
index a8ed459..d5f8b9e 100644
--- a/net/dccp/dccp.h
+++ b/net/dccp/dccp.h
@@ -14,8 +14,6 @@
#include <linux/dccp.h>
#include <linux/ktime.h>
-#include <net/snmp.h>
-#include <net/sock.h>
#include <net/tcp.h>
#include "ackvec.h"
diff --git a/net/dccp/ipv6.c b/net/dccp/ipv6.c
index dca711d..9930e1a 100644
--- a/net/dccp/ipv6.c
+++ b/net/dccp/ipv6.c
@@ -23,6 +23,7 @@
#include <net/inet_sock.h>
#include <net/inet6_connection_sock.h>
#include <net/inet6_hashtables.h>
+#include <net/inet_ecn.h>
#include <net/ip6_route.h>
#include <net/ipv6.h>
#include <net/protocol.h>
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index f581f77..f1cff70 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -86,7 +86,6 @@
#include <linux/poll.h>
#include <linux/netfilter_ipv4.h>
#include <linux/random.h>
-#include <linux/slab.h>
#include <asm/uaccess.h>
#include <asm/system.h>
@@ -95,18 +94,13 @@
#include <linux/igmp.h>
#include <linux/inetdevice.h>
#include <linux/netdevice.h>
-#include <net/checksum.h>
-#include <net/ip.h>
#include <net/protocol.h>
#include <net/arp.h>
#include <net/route.h>
#include <net/ip_fib.h>
-#include <net/inet_connection_sock.h>
#include <net/tcp.h>
#include <net/udp.h>
#include <net/udplite.h>
-#include <linux/skbuff.h>
-#include <net/sock.h>
#include <net/raw.h>
#include <net/icmp.h>
#include <net/ipip.h>
diff --git a/net/ipv4/arp.c b/net/ipv4/arp.c
index d8e540c..ec29d0a 100644
--- a/net/ipv4/arp.c
+++ b/net/ipv4/arp.c
@@ -90,26 +90,21 @@
#include <linux/fddidevice.h>
#include <linux/if_arp.h>
#include <linux/trdevice.h>
-#include <linux/skbuff.h>
#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
#include <linux/stat.h>
#include <linux/init.h>
#include <linux/net.h>
#include <linux/rcupdate.h>
#include <linux/jhash.h>
-#include <linux/slab.h>
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
#endif
#include <net/net_namespace.h>
-#include <net/ip.h>
#include <net/icmp.h>
#include <net/route.h>
#include <net/protocol.h>
#include <net/tcp.h>
-#include <net/sock.h>
#include <net/arp.h>
#include <net/ax25.h>
#include <net/netrom.h>
diff --git a/net/ipv4/cipso_ipv4.c b/net/ipv4/cipso_ipv4.c
index 094e150..e99b0c2 100644
--- a/net/ipv4/cipso_ipv4.c
+++ b/net/ipv4/cipso_ipv4.c
@@ -39,13 +39,10 @@
#include <linux/init.h>
#include <linux/types.h>
#include <linux/rcupdate.h>
-#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/jhash.h>
#include <linux/audit.h>
-#include <linux/slab.h>
-#include <net/ip.h>
#include <net/icmp.h>
#include <net/tcp.h>
#include <net/netlabel.h>
diff --git a/net/ipv4/fib_frontend.c b/net/ipv4/fib_frontend.c
index c19c1f7..bd5f286 100644
--- a/net/ipv4/fib_frontend.c
+++ b/net/ipv4/fib_frontend.c
@@ -31,16 +31,11 @@
#include <linux/netdevice.h>
#include <linux/if_addr.h>
#include <linux/if_arp.h>
-#include <linux/skbuff.h>
#include <linux/init.h>
-#include <linux/list.h>
-#include <linux/slab.h>
-#include <net/ip.h>
#include <net/protocol.h>
#include <net/route.h>
#include <net/tcp.h>
-#include <net/sock.h>
#include <net/arp.h>
#include <net/ip_fib.h>
#include <net/rtnetlink.h>
diff --git a/net/ipv4/fib_hash.c b/net/ipv4/fib_hash.c
index b3acb04..aafa420 100644
--- a/net/ipv4/fib_hash.c
+++ b/net/ipv4/fib_hash.c
@@ -29,17 +29,13 @@
#include <linux/netdevice.h>
#include <linux/if_arp.h>
#include <linux/proc_fs.h>
-#include <linux/skbuff.h>
#include <linux/netlink.h>
#include <linux/init.h>
-#include <linux/slab.h>
#include <net/net_namespace.h>
-#include <net/ip.h>
#include <net/protocol.h>
#include <net/route.h>
#include <net/tcp.h>
-#include <net/sock.h>
#include <net/ip_fib.h>
#include "fib_lookup.h"
diff --git a/net/ipv4/fib_rules.c b/net/ipv4/fib_rules.c
index 7981a24..1b13f54 100644
--- a/net/ipv4/fib_rules.c
+++ b/net/ipv4/fib_rules.c
@@ -24,9 +24,7 @@
#include <linux/netlink.h>
#include <linux/inetdevice.h>
#include <linux/init.h>
-#include <linux/list.h>
#include <linux/rcupdate.h>
-#include <net/ip.h>
#include <net/route.h>
#include <net/tcp.h>
#include <net/ip_fib.h>
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 3e0da3e..c7020cb 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -30,16 +30,12 @@
#include <linux/netdevice.h>
#include <linux/if_arp.h>
#include <linux/proc_fs.h>
-#include <linux/skbuff.h>
#include <linux/init.h>
-#include <linux/slab.h>
#include <net/arp.h>
-#include <net/ip.h>
#include <net/protocol.h>
#include <net/route.h>
#include <net/tcp.h>
-#include <net/sock.h>
#include <net/ip_fib.h>
#include <net/netlink.h>
#include <net/nexthop.h>
diff --git a/net/ipv4/fib_trie.c b/net/ipv4/fib_trie.c
index 0f28034..a7860ea 100644
--- a/net/ipv4/fib_trie.c
+++ b/net/ipv4/fib_trie.c
@@ -67,17 +67,12 @@
#include <linux/if_arp.h>
#include <linux/proc_fs.h>
#include <linux/rcupdate.h>
-#include <linux/skbuff.h>
#include <linux/netlink.h>
#include <linux/init.h>
-#include <linux/list.h>
-#include <linux/slab.h>
#include <net/net_namespace.h>
-#include <net/ip.h>
#include <net/protocol.h>
#include <net/route.h>
#include <net/tcp.h>
-#include <net/sock.h>
#include <net/ip_fib.h>
#include "fib_lookup.h"
diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c
index e5d1a44..255f93a 100644
--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -74,23 +74,17 @@
#include <linux/netdevice.h>
#include <linux/string.h>
#include <linux/netfilter_ipv4.h>
-#include <linux/slab.h>
-#include <net/snmp.h>
-#include <net/ip.h>
#include <net/route.h>
#include <net/protocol.h>
#include <net/icmp.h>
#include <net/tcp.h>
#include <net/udp.h>
#include <net/raw.h>
-#include <linux/skbuff.h>
-#include <net/sock.h>
#include <linux/errno.h>
#include <linux/timer.h>
#include <linux/init.h>
#include <asm/system.h>
#include <asm/uaccess.h>
-#include <net/checksum.h>
#include <net/xfrm.h>
#include <net/inet_common.h>
diff --git a/net/ipv4/inet_diag.c b/net/ipv4/inet_diag.c
index 2ada171..eb51603 100644
--- a/net/ipv4/inet_diag.c
+++ b/net/ipv4/inet_diag.c
@@ -14,8 +14,6 @@
#include <linux/types.h>
#include <linux/fcntl.h>
#include <linux/random.h>
-#include <linux/slab.h>
-#include <linux/cache.h>
#include <linux/init.h>
#include <linux/time.h>
@@ -23,9 +21,6 @@
#include <net/tcp.h>
#include <net/ipv6.h>
#include <net/inet_common.h>
-#include <net/inet_connection_sock.h>
-#include <net/inet_hashtables.h>
-#include <net/inet_timewait_sock.h>
#include <net/inet6_hashtables.h>
#include <net/netlink.h>
diff --git a/net/ipv4/inet_lro.c b/net/ipv4/inet_lro.c
index 47038cb..c54cb6e 100644
--- a/net/ipv4/inet_lro.c
+++ b/net/ipv4/inet_lro.c
@@ -30,6 +30,8 @@
#include <linux/if_vlan.h>
#include <linux/inet_lro.h>
+#include <net/inet_ecn.h>
+
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Jan-Bernd Themann <themann@de.ibm.com>");
MODULE_DESCRIPTION("Large Receive Offload (ipv4 / tcp)");
diff --git a/net/ipv4/ip_forward.c b/net/ipv4/ip_forward.c
index 99461f0..bda6ce5 100644
--- a/net/ipv4/ip_forward.c
+++ b/net/ipv4/ip_forward.c
@@ -21,20 +21,14 @@
#include <linux/types.h>
#include <linux/mm.h>
-#include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/icmp.h>
#include <linux/netdevice.h>
-#include <linux/slab.h>
-#include <net/sock.h>
-#include <net/ip.h>
#include <net/tcp.h>
#include <net/udp.h>
#include <net/icmp.h>
-#include <linux/tcp.h>
#include <linux/udp.h>
#include <linux/netfilter_ipv4.h>
-#include <net/checksum.h>
#include <linux/route.h>
#include <net/route.h>
#include <net/xfrm.h>
diff --git a/net/ipv4/ip_input.c b/net/ipv4/ip_input.c
index d859bcc..58c069e 100644
--- a/net/ipv4/ip_input.c
+++ b/net/ipv4/ip_input.c
@@ -188,7 +188,6 @@ int ip_call_ra_chain(struct sk_buff *skb)
static int ip_local_deliver_finish(struct sk_buff *skb)
{
struct net *net = dev_net(skb->dev);
-
__skb_pull(skb, ip_hdrlen(skb));
/* Point into the IP datagram, just past the header. */
diff --git a/net/ipv4/netfilter/ipt_LOG.c b/net/ipv4/netfilter/ipt_LOG.c
index 72ffc8f..227be20 100644
--- a/net/ipv4/netfilter/ipt_LOG.c
+++ b/net/ipv4/netfilter/ipt_LOG.c
@@ -12,7 +12,6 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
#include <linux/spinlock.h>
-#include <linux/skbuff.h>
#include <linux/if_arp.h>
#include <linux/ip.h>
#include <net/icmp.h>
diff --git a/net/ipv4/netfilter/ipt_REJECT.c b/net/ipv4/netfilter/ipt_REJECT.c
index 43eec80..1edbcc2 100644
--- a/net/ipv4/netfilter/ipt_REJECT.c
+++ b/net/ipv4/netfilter/ipt_REJECT.c
@@ -11,16 +11,12 @@
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
-#include <linux/skbuff.h>
-#include <linux/slab.h>
#include <linux/ip.h>
#include <linux/udp.h>
#include <linux/icmp.h>
#include <net/icmp.h>
-#include <net/ip.h>
#include <net/tcp.h>
#include <net/route.h>
-#include <net/dst.h>
#include <linux/netfilter/x_tables.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#include <linux/netfilter_ipv4/ipt_REJECT.h>
diff --git a/net/ipv4/netfilter/nf_nat_core.c b/net/ipv4/netfilter/nf_nat_core.c
index c04787c..f542fbb 100644
--- a/net/ipv4/netfilter/nf_nat_core.c
+++ b/net/ipv4/netfilter/nf_nat_core.c
@@ -11,11 +11,8 @@
#include <linux/module.h>
#include <linux/types.h>
#include <linux/timer.h>
-#include <linux/skbuff.h>
#include <linux/gfp.h>
-#include <net/checksum.h>
#include <net/icmp.h>
-#include <net/ip.h>
#include <net/tcp.h> /* For tcp_prot in getorigdst */
#include <linux/icmp.h>
#include <linux/udp.h>
diff --git a/net/ipv4/netfilter/nf_nat_h323.c b/net/ipv4/netfilter/nf_nat_h323.c
index 790f316..704a23e 100644
--- a/net/ipv4/netfilter/nf_nat_h323.c
+++ b/net/ipv4/netfilter/nf_nat_h323.c
@@ -10,7 +10,6 @@
*/
#include <linux/module.h>
-#include <linux/tcp.h>
#include <net/tcp.h>
#include <net/netfilter/nf_nat.h>
diff --git a/net/ipv4/netfilter/nf_nat_helper.c b/net/ipv4/netfilter/nf_nat_helper.c
index 31427fb..7b9b959 100644
--- a/net/ipv4/netfilter/nf_nat_helper.c
+++ b/net/ipv4/netfilter/nf_nat_helper.c
@@ -12,10 +12,7 @@
#include <linux/kmod.h>
#include <linux/types.h>
#include <linux/timer.h>
-#include <linux/skbuff.h>
-#include <linux/tcp.h>
#include <linux/udp.h>
-#include <net/checksum.h>
#include <net/tcp.h>
#include <net/route.h>
diff --git a/net/ipv4/proc.c b/net/ipv4/proc.c
index b14ec7d..1f3058b 100644
--- a/net/ipv4/proc.c
+++ b/net/ipv4/proc.c
@@ -41,8 +41,6 @@
#include <linux/bottom_half.h>
#include <linux/inetdevice.h>
#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-#include <net/sock.h>
#include <net/raw.h>
/*
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index 93bfd95..af204f4 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -80,7 +80,6 @@
#include <linux/proc_fs.h>
#include <linux/init.h>
#include <linux/workqueue.h>
-#include <linux/skbuff.h>
#include <linux/inetdevice.h>
#include <linux/igmp.h>
#include <linux/pkt_sched.h>
@@ -90,14 +89,10 @@
#include <linux/jhash.h>
#include <linux/rcupdate.h>
#include <linux/times.h>
-#include <linux/slab.h>
-#include <net/dst.h>
#include <net/net_namespace.h>
#include <net/protocol.h>
-#include <net/ip.h>
#include <net/route.h>
#include <net/inetpeer.h>
-#include <net/sock.h>
#include <net/ip_fib.h>
#include <net/arp.h>
#include <net/tcp.h>
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 650cace..064d764 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -10,10 +10,7 @@
* 2 of the License, or (at your option) any later version.
*/
-#include <linux/tcp.h>
-#include <linux/slab.h>
#include <linux/random.h>
-#include <linux/cryptohash.h>
#include <linux/kernel.h>
#include <net/tcp.h>
#include <net/route.h>
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 1b4ec21..391cf76 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -12,10 +12,7 @@
#include <linux/inetdevice.h>
#include <linux/seqlock.h>
#include <linux/init.h>
-#include <linux/slab.h>
-#include <net/snmp.h>
#include <net/icmp.h>
-#include <net/ip.h>
#include <net/route.h>
#include <net/tcp.h>
#include <net/udp.h>
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index f15c36a..a917b0b 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -252,7 +252,6 @@
#include <linux/poll.h>
#include <linux/init.h>
#include <linux/fs.h>
-#include <linux/skbuff.h>
#include <linux/scatterlist.h>
#include <linux/splice.h>
#include <linux/net.h>
@@ -261,18 +260,13 @@
#include <linux/bootmem.h>
#include <linux/highmem.h>
#include <linux/swap.h>
-#include <linux/cache.h>
#include <linux/err.h>
-#include <linux/crypto.h>
#include <linux/time.h>
-#include <linux/slab.h>
#include <net/icmp.h>
#include <net/tcp.h>
#include <net/xfrm.h>
-#include <net/ip.h>
#include <net/netdma.h>
-#include <net/sock.h>
#include <asm/uaccess.h>
#include <asm/ioctls.h>
diff --git a/net/ipv4/tcp_cong.c b/net/ipv4/tcp_cong.c
index 850c737..0462c67 100644
--- a/net/ipv4/tcp_cong.c
+++ b/net/ipv4/tcp_cong.c
@@ -9,7 +9,6 @@
#include <linux/module.h>
#include <linux/mm.h>
#include <linux/types.h>
-#include <linux/list.h>
#include <linux/gfp.h>
#include <net/tcp.h>
diff --git a/net/ipv4/tcp_diag.c b/net/ipv4/tcp_diag.c
index 939edb3..a35bfb6 100644
--- a/net/ipv4/tcp_diag.c
+++ b/net/ipv4/tcp_diag.c
@@ -13,8 +13,6 @@
#include <linux/module.h>
#include <linux/inet_diag.h>
-#include <linux/tcp.h>
-
#include <net/tcp.h>
static void tcp_diag_get_info(struct sock *sk, struct inet_diag_msg *r,
diff --git a/net/ipv4/tcp_illinois.c b/net/ipv4/tcp_illinois.c
index 00ca688..546cc48 100644
--- a/net/ipv4/tcp_illinois.c
+++ b/net/ipv4/tcp_illinois.c
@@ -13,7 +13,6 @@
*/
#include <linux/module.h>
-#include <linux/skbuff.h>
#include <linux/inet_diag.h>
#include <asm/div64.h>
#include <net/tcp.h>
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 6d8ab1c..43b27e7 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -62,13 +62,12 @@
*/
#include <linux/mm.h>
-#include <linux/slab.h>
#include <linux/module.h>
#include <linux/sysctl.h>
#include <linux/kernel.h>
-#include <net/dst.h>
#include <net/tcp.h>
#include <net/inet_common.h>
+#include <net/inet_ecn.h>
#include <linux/ipsec.h>
#include <asm/unaligned.h>
#include <net/netdma.h>
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index d978bb2..028fc57 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -56,15 +56,12 @@
#include <linux/fcntl.h>
#include <linux/module.h>
#include <linux/random.h>
-#include <linux/cache.h>
#include <linux/jhash.h>
#include <linux/init.h>
#include <linux/times.h>
-#include <linux/slab.h>
#include <net/net_namespace.h>
#include <net/icmp.h>
-#include <net/inet_hashtables.h>
#include <net/tcp.h>
#include <net/transp_v6.h>
#include <net/ipv6.h>
@@ -77,9 +74,7 @@
#include <linux/ipv6.h>
#include <linux/stddef.h>
#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-#include <linux/crypto.h>
#include <linux/scatterlist.h>
int sysctl_tcp_tw_reuse __read_mostly;
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index a66735f..ccbc61b 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -20,7 +20,6 @@
#include <linux/mm.h>
#include <linux/module.h>
-#include <linux/slab.h>
#include <linux/sysctl.h>
#include <linux/workqueue.h>
#include <net/tcp.h>
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 61c2463..d4da881 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -35,6 +35,7 @@
*/
#include <net/tcp.h>
+#include <net/inet_ecn.h>
#include <linux/compiler.h>
#include <linux/gfp.h>
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c
index 6211e21..4af3525 100644
--- a/net/ipv4/tcp_probe.c
+++ b/net/ipv4/tcp_probe.c
@@ -21,8 +21,6 @@
#include <linux/kernel.h>
#include <linux/kprobes.h>
#include <linux/socket.h>
-#include <linux/tcp.h>
-#include <linux/slab.h>
#include <linux/proc_fs.h>
#include <linux/module.h>
#include <linux/ktime.h>
diff --git a/net/ipv4/tcp_vegas.c b/net/ipv4/tcp_vegas.c
index c6743ee..b4e0cc3 100644
--- a/net/ipv4/tcp_vegas.c
+++ b/net/ipv4/tcp_vegas.c
@@ -33,7 +33,6 @@
#include <linux/mm.h>
#include <linux/module.h>
-#include <linux/skbuff.h>
#include <linux/inet_diag.h>
#include <net/tcp.h>
diff --git a/net/ipv4/tcp_veno.c b/net/ipv4/tcp_veno.c
index 38bc0b5..9c922a6 100644
--- a/net/ipv4/tcp_veno.c
+++ b/net/ipv4/tcp_veno.c
@@ -11,7 +11,6 @@
#include <linux/mm.h>
#include <linux/module.h>
-#include <linux/skbuff.h>
#include <linux/inet_diag.h>
#include <net/tcp.h>
diff --git a/net/ipv4/tcp_westwood.c b/net/ipv4/tcp_westwood.c
index a534dda..55ce2bd 100644
--- a/net/ipv4/tcp_westwood.c
+++ b/net/ipv4/tcp_westwood.c
@@ -23,7 +23,6 @@
#include <linux/mm.h>
#include <linux/module.h>
-#include <linux/skbuff.h>
#include <linux/inet_diag.h>
#include <net/tcp.h>
diff --git a/net/ipv4/tcp_yeah.c b/net/ipv4/tcp_yeah.c
index a0f2403..afa7b9b 100644
--- a/net/ipv4/tcp_yeah.c
+++ b/net/ipv4/tcp_yeah.c
@@ -8,7 +8,6 @@
*/
#include <linux/mm.h>
#include <linux/module.h>
-#include <linux/skbuff.h>
#include <linux/inet_diag.h>
#include <net/tcp.h>
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 848b355..de9eed0 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -53,7 +53,6 @@
#include <linux/route.h>
#include <linux/inetdevice.h>
#include <linux/init.h>
-#include <linux/slab.h>
#ifdef CONFIG_SYSCTL
#include <linux/sysctl.h>
#endif
@@ -63,8 +62,6 @@
#include <linux/string.h>
#include <net/net_namespace.h>
-#include <net/sock.h>
-#include <net/snmp.h>
#include <net/ipv6.h>
#include <net/protocol.h>
@@ -72,7 +69,6 @@
#include <net/ip6_route.h>
#include <net/addrconf.h>
#include <net/tcp.h>
-#include <net/ip.h>
#include <net/netlink.h>
#include <net/pkt_sched.h>
#include <linux/if_tunnel.h>
@@ -86,7 +82,6 @@
#include <asm/unaligned.h>
#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
/* Set to 3 to get tracing... */
#define ACONF_DEBUG 2
diff --git a/net/ipv6/af_inet6.c b/net/ipv6/af_inet6.c
index 54e8e42..4f88f57 100644
--- a/net/ipv6/af_inet6.c
+++ b/net/ipv6/af_inet6.c
@@ -36,14 +36,12 @@
#include <linux/proc_fs.h>
#include <linux/stat.h>
#include <linux/init.h>
-#include <linux/slab.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/icmpv6.h>
#include <linux/netfilter_ipv6.h>
-#include <net/ip.h>
#include <net/ipv6.h>
#include <net/udp.h>
#include <net/udplite.h>
diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c
index d1770e0..8c57522 100644
--- a/net/ipv6/ipv6_sockglue.c
+++ b/net/ipv6/ipv6_sockglue.c
@@ -36,10 +36,7 @@
#include <linux/init.h>
#include <linux/sysctl.h>
#include <linux/netfilter.h>
-#include <linux/slab.h>
-#include <net/sock.h>
-#include <net/snmp.h>
#include <net/ipv6.h>
#include <net/ndisc.h>
#include <net/protocol.h>
diff --git a/net/ipv6/netfilter/ip6t_LOG.c b/net/ipv6/netfilter/ip6t_LOG.c
index 09c8889..6a15d2c 100644
--- a/net/ipv6/netfilter/ip6t_LOG.c
+++ b/net/ipv6/netfilter/ip6t_LOG.c
@@ -11,7 +11,6 @@
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
-#include <linux/skbuff.h>
#include <linux/if_arp.h>
#include <linux/ip.h>
#include <linux/spinlock.h>
diff --git a/net/ipv6/netfilter/ip6t_REJECT.c b/net/ipv6/netfilter/ip6t_REJECT.c
index 2933396..97f5559 100644
--- a/net/ipv6/netfilter/ip6t_REJECT.c
+++ b/net/ipv6/netfilter/ip6t_REJECT.c
@@ -18,7 +18,6 @@
#include <linux/gfp.h>
#include <linux/module.h>
-#include <linux/skbuff.h>
#include <linux/icmpv6.h>
#include <linux/netdevice.h>
#include <net/ipv6.h>
diff --git a/net/ipv6/proc.c b/net/ipv6/proc.c
index 24b3558..05d0a01 100644
--- a/net/ipv6/proc.c
+++ b/net/ipv6/proc.c
@@ -19,11 +19,8 @@
#include <linux/net.h>
#include <linux/ipv6.h>
#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
#include <linux/stddef.h>
#include <net/net_namespace.h>
-#include <net/ip.h>
-#include <net/sock.h>
#include <net/tcp.h>
#include <net/udp.h>
#include <net/transp_v6.h>
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 7659d6f..4ad5609 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -38,11 +38,8 @@
#include <linux/init.h>
#include <linux/if_arp.h>
#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
#include <linux/nsproxy.h>
-#include <linux/slab.h>
#include <net/net_namespace.h>
-#include <net/snmp.h>
#include <net/ipv6.h>
#include <net/ip6_fib.h>
#include <net/ip6_route.h>
@@ -50,7 +47,6 @@
#include <net/addrconf.h>
#include <net/tcp.h>
#include <linux/rtnetlink.h>
-#include <net/dst.h>
#include <net/xfrm.h>
#include <net/netevent.h>
#include <net/netlink.h>
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index 09fd34f..edf879a 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -14,9 +14,7 @@
*
*/
-#include <linux/tcp.h>
#include <linux/random.h>
-#include <linux/cryptohash.h>
#include <linux/kernel.h>
#include <net/ipv6.h>
#include <net/tcp.h>
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 7e41e2c..ea31a6c 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -38,7 +38,6 @@
#include <linux/jhash.h>
#include <linux/ipsec.h>
#include <linux/times.h>
-#include <linux/slab.h>
#include <linux/ipv6.h>
#include <linux/icmpv6.h>
@@ -56,7 +55,6 @@
#include <net/inet_ecn.h>
#include <net/protocol.h>
#include <net/xfrm.h>
-#include <net/snmp.h>
#include <net/dsfield.h>
#include <net/timewait_sock.h>
#include <net/netdma.h>
@@ -65,9 +63,7 @@
#include <asm/uaccess.h>
#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
-#include <linux/crypto.h>
#include <linux/scatterlist.h>
static void tcp_v6_send_reset(struct sock *sk, struct sk_buff *skb);
diff --git a/net/netfilter/ipvs/ip_vs_app.c b/net/netfilter/ipvs/ip_vs_app.c
index a475ede..eff8bc5 100644
--- a/net/netfilter/ipvs/ip_vs_app.c
+++ b/net/netfilter/ipvs/ip_vs_app.c
@@ -23,18 +23,15 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/skbuff.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/netfilter.h>
-#include <linux/slab.h>
#include <net/net_namespace.h>
#include <net/protocol.h>
#include <net/tcp.h>
#include <asm/system.h>
#include <linux/stat.h>
#include <linux/proc_fs.h>
-#include <linux/seq_file.h>
#include <linux/mutex.h>
#include <net/ip_vs.h>
diff --git a/net/netfilter/ipvs/ip_vs_core.c b/net/netfilter/ipvs/ip_vs_core.c
index b4e51e9..1320e63 100644
--- a/net/netfilter/ipvs/ip_vs_core.c
+++ b/net/netfilter/ipvs/ip_vs_core.c
@@ -30,12 +30,9 @@
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/ip.h>
-#include <linux/tcp.h>
#include <linux/sctp.h>
#include <linux/icmp.h>
-#include <linux/slab.h>
-#include <net/ip.h>
#include <net/tcp.h>
#include <net/udp.h>
#include <net/icmp.h> /* for icmp_send */
diff --git a/net/netfilter/ipvs/ip_vs_ftp.c b/net/netfilter/ipvs/ip_vs_ftp.c
index 7545500..d87af27 100644
--- a/net/netfilter/ipvs/ip_vs_ftp.c
+++ b/net/netfilter/ipvs/ip_vs_ftp.c
@@ -28,7 +28,6 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
-#include <linux/skbuff.h>
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/netfilter.h>
diff --git a/net/netfilter/ipvs/ip_vs_proto.c b/net/netfilter/ipvs/ip_vs_proto.c
index c539983..fff800e 100644
--- a/net/netfilter/ipvs/ip_vs_proto.c
+++ b/net/netfilter/ipvs/ip_vs_proto.c
@@ -18,7 +18,6 @@
#include <linux/module.h>
#include <linux/kernel.h>
-#include <linux/skbuff.h>
#include <linux/gfp.h>
#include <linux/in.h>
#include <linux/ip.h>
diff --git a/net/netfilter/ipvs/ip_vs_proto_tcp.c b/net/netfilter/ipvs/ip_vs_proto_tcp.c
index f6c5200..42d7e8b 100644
--- a/net/netfilter/ipvs/ip_vs_proto_tcp.c
+++ b/net/netfilter/ipvs/ip_vs_proto_tcp.c
@@ -18,8 +18,6 @@
#include <linux/kernel.h>
#include <linux/ip.h>
-#include <linux/tcp.h> /* for tcphdr */
-#include <net/ip.h>
#include <net/tcp.h> /* for csum_tcpudp_magic */
#include <net/ip6_checksum.h>
#include <linux/netfilter.h>
diff --git a/net/netfilter/ipvs/ip_vs_xmit.c b/net/netfilter/ipvs/ip_vs_xmit.c
index de04ea3..e8df9b7 100644
--- a/net/netfilter/ipvs/ip_vs_xmit.c
+++ b/net/netfilter/ipvs/ip_vs_xmit.c
@@ -27,9 +27,6 @@
#define pr_fmt(fmt) KMSG_COMPONENT ": " fmt
#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/tcp.h> /* for tcphdr */
-#include <net/ip.h>
#include <net/tcp.h> /* for csum_tcpudp_magic */
#include <net/udp.h>
#include <net/icmp.h> /* for icmp_send */
diff --git a/net/netfilter/nf_conntrack_ftp.c b/net/netfilter/nf_conntrack_ftp.c
index e17cb7c..8025026 100644
--- a/net/netfilter/nf_conntrack_ftp.c
+++ b/net/netfilter/nf_conntrack_ftp.c
@@ -13,11 +13,9 @@
#include <linux/moduleparam.h>
#include <linux/netfilter.h>
#include <linux/ip.h>
-#include <linux/slab.h>
#include <linux/ipv6.h>
#include <linux/ctype.h>
#include <linux/inet.h>
-#include <net/checksum.h>
#include <net/tcp.h>
#include <net/netfilter/nf_conntrack.h>
diff --git a/net/netfilter/nf_conntrack_proto_tcp.c b/net/netfilter/nf_conntrack_proto_tcp.c
index 3fb2b73..7542a2f 100644
--- a/net/netfilter/nf_conntrack_proto_tcp.c
+++ b/net/netfilter/nf_conntrack_proto_tcp.c
@@ -10,9 +10,7 @@
#include <linux/timer.h>
#include <linux/module.h>
#include <linux/in.h>
-#include <linux/tcp.h>
#include <linux/spinlock.h>
-#include <linux/skbuff.h>
#include <linux/ipv6.h>
#include <net/ip6_checksum.h>
#include <asm/unaligned.h>
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c
index eb81c38..bfff091 100644
--- a/net/netfilter/xt_TCPMSS.c
+++ b/net/netfilter/xt_TCPMSS.c
@@ -9,12 +9,9 @@
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
-#include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/gfp.h>
#include <linux/ipv6.h>
-#include <linux/tcp.h>
-#include <net/dst.h>
#include <net/flow.h>
#include <net/ipv6.h>
#include <net/route.h>
diff --git a/net/netfilter/xt_TCPOPTSTRIP.c b/net/netfilter/xt_TCPOPTSTRIP.c
index 9dc9ecf..4b12bad 100644
--- a/net/netfilter/xt_TCPOPTSTRIP.c
+++ b/net/netfilter/xt_TCPOPTSTRIP.c
@@ -10,10 +10,8 @@
*/
#include <linux/module.h>
-#include <linux/skbuff.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
-#include <linux/tcp.h>
#include <net/ipv6.h>
#include <net/tcp.h>
#include <linux/netfilter/x_tables.h>
diff --git a/net/netfilter/xt_osf.c b/net/netfilter/xt_osf.c
index 4327e10..b7b696a 100644
--- a/net/netfilter/xt_osf.c
+++ b/net/netfilter/xt_osf.c
@@ -23,13 +23,8 @@
#include <linux/if.h>
#include <linux/inetdevice.h>
#include <linux/ip.h>
-#include <linux/list.h>
#include <linux/rculist.h>
-#include <linux/skbuff.h>
-#include <linux/slab.h>
-#include <linux/tcp.h>
-#include <net/ip.h>
#include <net/tcp.h>
#include <linux/netfilter/nfnetlink.h>
diff --git a/net/netfilter/xt_socket.c b/net/netfilter/xt_socket.c
index 00d6ae8..3f63ec5 100644
--- a/net/netfilter/xt_socket.c
+++ b/net/netfilter/xt_socket.c
@@ -11,13 +11,11 @@
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/module.h>
-#include <linux/skbuff.h>
#include <linux/netfilter/x_tables.h>
#include <linux/netfilter_ipv4/ip_tables.h>
#include <net/tcp.h>
#include <net/udp.h>
#include <net/icmp.h>
-#include <net/sock.h>
#include <net/inet_sock.h>
#include <net/netfilter/nf_tproxy_core.h>
#include <net/netfilter/ipv4/nf_defrag_ipv4.h>
diff --git a/net/netfilter/xt_tcpmss.c b/net/netfilter/xt_tcpmss.c
index c53d4d1..19f71a4 100644
--- a/net/netfilter/xt_tcpmss.c
+++ b/net/netfilter/xt_tcpmss.c
@@ -9,7 +9,6 @@
*/
#include <linux/module.h>
-#include <linux/skbuff.h>
#include <net/tcp.h>
#include <linux/netfilter/xt_tcpmss.h>
diff --git a/net/netfilter/xt_tcpudp.c b/net/netfilter/xt_tcpudp.c
index c14d464..ca24142 100644
--- a/net/netfilter/xt_tcpudp.c
+++ b/net/netfilter/xt_tcpudp.c
@@ -1,7 +1,6 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/types.h>
#include <linux/module.h>
-#include <net/ip.h>
#include <linux/ipv6.h>
#include <net/ipv6.h>
#include <net/tcp.h>
diff --git a/net/rds/tcp.c b/net/rds/tcp.c
index 8e0a320..15814ea 100644
--- a/net/rds/tcp.c
+++ b/net/rds/tcp.c
@@ -31,7 +31,6 @@
*
*/
#include <linux/kernel.h>
-#include <linux/slab.h>
#include <linux/in.h>
#include <net/tcp.h>
diff --git a/net/rds/tcp_recv.c b/net/rds/tcp_recv.c
index 78205e2..82a2614 100644
--- a/net/rds/tcp_recv.c
+++ b/net/rds/tcp_recv.c
@@ -31,7 +31,6 @@
*
*/
#include <linux/kernel.h>
-#include <linux/slab.h>
#include <net/tcp.h>
#include "rds.h"
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index 67dc7ce..55354e6 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -20,9 +20,6 @@
#include <net/netlink.h>
#include <linux/rtnetlink.h>
-#include <linux/skbuff.h>
-
-#include <net/ip.h>
#include <net/ipv6.h>
#include <net/icmp.h>
#include <linux/icmpv6.h>
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 186eb83..0dda31a 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -15,14 +15,11 @@
#include <linux/module.h>
#include <linux/netfilter.h>
#include <linux/rtnetlink.h>
-#include <linux/skbuff.h>
-#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/string.h>
#include <linux/tc_act/tc_nat.h>
#include <net/act_api.h>
#include <net/icmp.h>
-#include <net/ip.h>
#include <net/netlink.h>
#include <net/tc_act/tc_nat.h>
#include <net/tcp.h>
diff --git a/net/sunrpc/svcsock.c b/net/sunrpc/svcsock.c
index 07919e1..8659740 100644
--- a/net/sunrpc/svcsock.c
+++ b/net/sunrpc/svcsock.c
@@ -27,16 +27,10 @@
#include <linux/in.h>
#include <linux/inet.h>
#include <linux/udp.h>
-#include <linux/tcp.h>
#include <linux/unistd.h>
-#include <linux/slab.h>
#include <linux/netdevice.h>
-#include <linux/skbuff.h>
#include <linux/file.h>
#include <linux/freezer.h>
-#include <net/sock.h>
-#include <net/checksum.h>
-#include <net/ip.h>
#include <net/ipv6.h>
#include <net/tcp.h>
#include <net/tcp_states.h>
diff --git a/net/sunrpc/xprtsock.c b/net/sunrpc/xprtsock.c
index dfcab5a..03786a0 100644
--- a/net/sunrpc/xprtsock.c
+++ b/net/sunrpc/xprtsock.c
@@ -19,7 +19,6 @@
*/
#include <linux/types.h>
-#include <linux/slab.h>
#include <linux/module.h>
#include <linux/capability.h>
#include <linux/pagemap.h>
@@ -29,7 +28,6 @@
#include <linux/net.h>
#include <linux/mm.h>
#include <linux/udp.h>
-#include <linux/tcp.h>
#include <linux/sunrpc/clnt.h>
#include <linux/sunrpc/sched.h>
#include <linux/sunrpc/svcsock.h>
@@ -39,8 +37,6 @@
#include <linux/sunrpc/bc_xprt.h>
#endif
-#include <net/sock.h>
-#include <net/checksum.h>
#include <net/udp.h>
#include <net/tcp.h>
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c
index 65fa8bf..5e3cb9a 100644
--- a/security/selinux/hooks.c
+++ b/security/selinux/hooks.c
@@ -34,7 +34,6 @@
#include <linux/unistd.h>
#include <linux/mm.h>
#include <linux/mman.h>
-#include <linux/slab.h>
#include <linux/pagemap.h>
#include <linux/swap.h>
#include <linux/spinlock.h>
@@ -48,7 +47,6 @@
#include <linux/netfilter_ipv6.h>
#include <linux/tty.h>
#include <net/icmp.h>
-#include <net/ip.h> /* for local_port_range[] */
#include <net/tcp.h> /* struct or_callable used in sock_rcv_skb */
#include <net/net_namespace.h>
#include <net/netlabel.h>
@@ -59,7 +57,6 @@
#include <linux/interrupt.h>
#include <linux/netdevice.h> /* for network interface checks */
#include <linux/netlink.h>
-#include <linux/tcp.h>
#include <linux/udp.h>
#include <linux/dccp.h>
#include <linux/quota.h>
--
1.7.1
^ permalink raw reply related
* Re: [PATCH] net_sched: factorize qdisc stats handling
From: Eric Dumazet @ 2011-01-09 18:30 UTC (permalink / raw)
To: Stephen Hemminger, Jarek Poplawski
Cc: Changli Gao, David Miller, Fabio Checconi, netdev, Luigi Rizzo
In-Reply-To: <20110109095735.5241e755@nehalam>
Le dimanche 09 janvier 2011 à 09:57 -0800, Stephen Hemminger a écrit :
> On Sat, 08 Jan 2011 10:26:29 +0100
> Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
> > +static inline void bstats_update(struct gnet_stats_basic_packed *bstats,
> > + struct sk_buff *skb)
> > +{
> > + bstats->bytes += qdisc_pkt_len(skb);
> > + bstats->packets += skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
> > +}
> > +
> > +static inline void qdisc_bstats_update(struct Qdisc *sch, struct sk_buff *skb)
> > {
> > - sch->bstats.bytes += len;
> > - sch->bstats.packets++;
> > + bstats_update(&sch->bstats, skb);
> > }
>
> Minor nit. I prefer to show that skb is not modified.
>
> static inline void bstats_update(struct gnet_stats_basic_packed *bstats,
> const struct sk_buff *skb)
>
> static inline void qdisc_bstats_update(struct Qdisc *sch, const struct sk_buff *skb)
>
Right, qdisc_pkt_len() must also be constified
Here is v2, with Jarek remark addressed too :)
My next plan is to make stab handler RCU safe so that
qdisc_calculate_pkt_len() call can be done before locking qdisc
(and TCQ_F_CAN_BYPASS can be used even if a stab is setup)
Thanks
[PATCH v2] net_sched: factorize qdisc stats handling
HTB takes into account skb is segmented in stats updates.
Generalize this to all schedulers.
They should use qdisc_bstats_update() helper instead of manipulating
bstats.bytes and bstats.packets
Add bstats_update() helper too for classes that use
gnet_stats_basic_packed fields.
Note : Right now, TCQ_F_CAN_BYPASS shortcurt can be taken only if no
stab is setup on qdisc.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
---
v2: constify some methods, and make sure qdisc_skb_cb(skb)->pkt_len is
set in the TCQ_F_CAN_BYPASS shortcut in __dev_xmit_skb()
include/net/sch_generic.h | 20 ++++++++++++++------
net/core/dev.c | 5 ++++-
net/sched/act_csum.c | 3 +--
net/sched/act_ipt.c | 3 +--
net/sched/act_mirred.c | 3 +--
net/sched/act_nat.c | 3 +--
net/sched/act_pedit.c | 3 +--
net/sched/act_police.c | 3 +--
net/sched/act_simple.c | 3 +--
net/sched/act_skbedit.c | 3 +--
net/sched/sch_atm.c | 6 ++----
net/sched/sch_cbq.c | 6 ++----
net/sched/sch_drr.c | 8 ++------
net/sched/sch_dsmark.c | 3 +--
net/sched/sch_hfsc.c | 6 ++----
net/sched/sch_htb.c | 17 ++++++-----------
net/sched/sch_ingress.c | 3 +--
net/sched/sch_multiq.c | 3 +--
net/sched/sch_netem.c | 6 ++----
net/sched/sch_prio.c | 3 +--
net/sched/sch_red.c | 3 +--
net/sched/sch_sfq.c | 3 +--
net/sched/sch_tbf.c | 3 +--
net/sched/sch_teql.c | 3 +--
24 files changed, 50 insertions(+), 72 deletions(-)
diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h
index 0af57eb..e9eee99 100644
--- a/include/net/sch_generic.h
+++ b/include/net/sch_generic.h
@@ -207,7 +207,7 @@ static inline int qdisc_qlen(struct Qdisc *q)
return q->q.qlen;
}
-static inline struct qdisc_skb_cb *qdisc_skb_cb(struct sk_buff *skb)
+static inline struct qdisc_skb_cb *qdisc_skb_cb(const struct sk_buff *skb)
{
return (struct qdisc_skb_cb *)skb->cb;
}
@@ -394,7 +394,7 @@ static inline bool qdisc_tx_is_noop(const struct net_device *dev)
return true;
}
-static inline unsigned int qdisc_pkt_len(struct sk_buff *skb)
+static inline unsigned int qdisc_pkt_len(const struct sk_buff *skb)
{
return qdisc_skb_cb(skb)->pkt_len;
}
@@ -426,10 +426,18 @@ static inline int qdisc_enqueue_root(struct sk_buff *skb, struct Qdisc *sch)
return qdisc_enqueue(skb, sch) & NET_XMIT_MASK;
}
-static inline void __qdisc_update_bstats(struct Qdisc *sch, unsigned int len)
+
+static inline void bstats_update(struct gnet_stats_basic_packed *bstats,
+ const struct sk_buff *skb)
+{
+ bstats->bytes += qdisc_pkt_len(skb);
+ bstats->packets += skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
+}
+
+static inline void qdisc_bstats_update(struct Qdisc *sch,
+ const struct sk_buff *skb)
{
- sch->bstats.bytes += len;
- sch->bstats.packets++;
+ bstats_update(&sch->bstats, skb);
}
static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
@@ -437,7 +445,7 @@ static inline int __qdisc_enqueue_tail(struct sk_buff *skb, struct Qdisc *sch,
{
__skb_queue_tail(list, skb);
sch->qstats.backlog += qdisc_pkt_len(skb);
- __qdisc_update_bstats(sch, qdisc_pkt_len(skb));
+ qdisc_bstats_update(sch, skb);
return NET_XMIT_SUCCESS;
}
diff --git a/net/core/dev.c b/net/core/dev.c
index a215269..98248f6 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2301,7 +2301,10 @@ static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q,
*/
if (!(dev->priv_flags & IFF_XMIT_DST_RELEASE))
skb_dst_force(skb);
- __qdisc_update_bstats(q, skb->len);
+
+ qdisc_skb_cb(skb)->pkt_len = skb->len;
+ qdisc_bstats_update(q, skb);
+
if (sch_direct_xmit(skb, q, dev, txq, root_lock)) {
if (unlikely(contended)) {
spin_unlock(&q->busylock);
diff --git a/net/sched/act_csum.c b/net/sched/act_csum.c
index 67dc7ce..83ddfc0 100644
--- a/net/sched/act_csum.c
+++ b/net/sched/act_csum.c
@@ -508,8 +508,7 @@ static int tcf_csum(struct sk_buff *skb,
spin_lock(&p->tcf_lock);
p->tcf_tm.lastuse = jiffies;
- p->tcf_bstats.bytes += qdisc_pkt_len(skb);
- p->tcf_bstats.packets++;
+ bstats_update(&p->tcf_bstats, skb);
action = p->tcf_action;
update_flags = p->update_flags;
spin_unlock(&p->tcf_lock);
diff --git a/net/sched/act_ipt.c b/net/sched/act_ipt.c
index 8daef96..c2a7c20 100644
--- a/net/sched/act_ipt.c
+++ b/net/sched/act_ipt.c
@@ -209,8 +209,7 @@ static int tcf_ipt(struct sk_buff *skb, struct tc_action *a,
spin_lock(&ipt->tcf_lock);
ipt->tcf_tm.lastuse = jiffies;
- ipt->tcf_bstats.bytes += qdisc_pkt_len(skb);
- ipt->tcf_bstats.packets++;
+ bstats_update(&ipt->tcf_bstats, skb);
/* yes, we have to worry about both in and out dev
worry later - danger - this API seems to have changed
diff --git a/net/sched/act_mirred.c b/net/sched/act_mirred.c
index 0c311be..d765067 100644
--- a/net/sched/act_mirred.c
+++ b/net/sched/act_mirred.c
@@ -165,8 +165,7 @@ static int tcf_mirred(struct sk_buff *skb, struct tc_action *a,
spin_lock(&m->tcf_lock);
m->tcf_tm.lastuse = jiffies;
- m->tcf_bstats.bytes += qdisc_pkt_len(skb);
- m->tcf_bstats.packets++;
+ bstats_update(&m->tcf_bstats, skb);
dev = m->tcfm_dev;
if (!dev) {
diff --git a/net/sched/act_nat.c b/net/sched/act_nat.c
index 186eb83..178a4bd 100644
--- a/net/sched/act_nat.c
+++ b/net/sched/act_nat.c
@@ -125,8 +125,7 @@ static int tcf_nat(struct sk_buff *skb, struct tc_action *a,
egress = p->flags & TCA_NAT_FLAG_EGRESS;
action = p->tcf_action;
- p->tcf_bstats.bytes += qdisc_pkt_len(skb);
- p->tcf_bstats.packets++;
+ bstats_update(&p->tcf_bstats, skb);
spin_unlock(&p->tcf_lock);
diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index a0593c9..445bef7 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -187,8 +187,7 @@ static int tcf_pedit(struct sk_buff *skb, struct tc_action *a,
bad:
p->tcf_qstats.overlimits++;
done:
- p->tcf_bstats.bytes += qdisc_pkt_len(skb);
- p->tcf_bstats.packets++;
+ bstats_update(&p->tcf_bstats, skb);
spin_unlock(&p->tcf_lock);
return p->tcf_action;
}
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 7ebf743..e2f08b1 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -298,8 +298,7 @@ static int tcf_act_police(struct sk_buff *skb, struct tc_action *a,
spin_lock(&police->tcf_lock);
- police->tcf_bstats.bytes += qdisc_pkt_len(skb);
- police->tcf_bstats.packets++;
+ bstats_update(&police->tcf_bstats, skb);
if (police->tcfp_ewma_rate &&
police->tcf_rate_est.bps >= police->tcfp_ewma_rate) {
diff --git a/net/sched/act_simple.c b/net/sched/act_simple.c
index 97e84f3..7287cff 100644
--- a/net/sched/act_simple.c
+++ b/net/sched/act_simple.c
@@ -42,8 +42,7 @@ static int tcf_simp(struct sk_buff *skb, struct tc_action *a, struct tcf_result
spin_lock(&d->tcf_lock);
d->tcf_tm.lastuse = jiffies;
- d->tcf_bstats.bytes += qdisc_pkt_len(skb);
- d->tcf_bstats.packets++;
+ bstats_update(&d->tcf_bstats, skb);
/* print policy string followed by _ then packet count
* Example if this was the 3rd packet and the string was "hello"
diff --git a/net/sched/act_skbedit.c b/net/sched/act_skbedit.c
index 66cbf4e..836f5fe 100644
--- a/net/sched/act_skbedit.c
+++ b/net/sched/act_skbedit.c
@@ -46,8 +46,7 @@ static int tcf_skbedit(struct sk_buff *skb, struct tc_action *a,
spin_lock(&d->tcf_lock);
d->tcf_tm.lastuse = jiffies;
- d->tcf_bstats.bytes += qdisc_pkt_len(skb);
- d->tcf_bstats.packets++;
+ bstats_update(&d->tcf_bstats, skb);
if (d->flags & SKBEDIT_F_PRIORITY)
skb->priority = d->priority;
diff --git a/net/sched/sch_atm.c b/net/sched/sch_atm.c
index 2825407..943d733 100644
--- a/net/sched/sch_atm.c
+++ b/net/sched/sch_atm.c
@@ -422,10 +422,8 @@ drop: __maybe_unused
}
return ret;
}
- sch->bstats.bytes += qdisc_pkt_len(skb);
- sch->bstats.packets++;
- flow->bstats.bytes += qdisc_pkt_len(skb);
- flow->bstats.packets++;
+ qdisc_bstats_update(sch, skb);
+ bstats_update(&flow->bstats, skb);
/*
* Okay, this may seem weird. We pretend we've dropped the packet if
* it goes via ATM. The reason for this is that the outer qdisc
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c
index eb76315..c80d1c2 100644
--- a/net/sched/sch_cbq.c
+++ b/net/sched/sch_cbq.c
@@ -390,8 +390,7 @@ cbq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
ret = qdisc_enqueue(skb, cl->q);
if (ret == NET_XMIT_SUCCESS) {
sch->q.qlen++;
- sch->bstats.packets++;
- sch->bstats.bytes += qdisc_pkt_len(skb);
+ qdisc_bstats_update(sch, skb);
cbq_mark_toplevel(q, cl);
if (!cl->next_alive)
cbq_activate_class(cl);
@@ -650,8 +649,7 @@ static int cbq_reshape_fail(struct sk_buff *skb, struct Qdisc *child)
ret = qdisc_enqueue(skb, cl->q);
if (ret == NET_XMIT_SUCCESS) {
sch->q.qlen++;
- sch->bstats.packets++;
- sch->bstats.bytes += qdisc_pkt_len(skb);
+ qdisc_bstats_update(sch, skb);
if (!cl->next_alive)
cbq_activate_class(cl);
return 0;
diff --git a/net/sched/sch_drr.c b/net/sched/sch_drr.c
index aa8b531..de55e64 100644
--- a/net/sched/sch_drr.c
+++ b/net/sched/sch_drr.c
@@ -351,7 +351,6 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch)
{
struct drr_sched *q = qdisc_priv(sch);
struct drr_class *cl;
- unsigned int len;
int err;
cl = drr_classify(skb, sch, &err);
@@ -362,7 +361,6 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch)
return err;
}
- len = qdisc_pkt_len(skb);
err = qdisc_enqueue(skb, cl->qdisc);
if (unlikely(err != NET_XMIT_SUCCESS)) {
if (net_xmit_drop_count(err)) {
@@ -377,10 +375,8 @@ static int drr_enqueue(struct sk_buff *skb, struct Qdisc *sch)
cl->deficit = cl->quantum;
}
- cl->bstats.packets++;
- cl->bstats.bytes += len;
- sch->bstats.packets++;
- sch->bstats.bytes += len;
+ bstats_update(&cl->bstats, skb);
+ qdisc_bstats_update(sch, skb);
sch->q.qlen++;
return err;
diff --git a/net/sched/sch_dsmark.c b/net/sched/sch_dsmark.c
index 1d295d6..60f4bdd 100644
--- a/net/sched/sch_dsmark.c
+++ b/net/sched/sch_dsmark.c
@@ -260,8 +260,7 @@ static int dsmark_enqueue(struct sk_buff *skb, struct Qdisc *sch)
return err;
}
- sch->bstats.bytes += qdisc_pkt_len(skb);
- sch->bstats.packets++;
+ qdisc_bstats_update(sch, skb);
sch->q.qlen++;
return NET_XMIT_SUCCESS;
diff --git a/net/sched/sch_hfsc.c b/net/sched/sch_hfsc.c
index 069c62b..2e45791 100644
--- a/net/sched/sch_hfsc.c
+++ b/net/sched/sch_hfsc.c
@@ -1599,10 +1599,8 @@ hfsc_enqueue(struct sk_buff *skb, struct Qdisc *sch)
if (cl->qdisc->q.qlen == 1)
set_active(cl, qdisc_pkt_len(skb));
- cl->bstats.packets++;
- cl->bstats.bytes += qdisc_pkt_len(skb);
- sch->bstats.packets++;
- sch->bstats.bytes += qdisc_pkt_len(skb);
+ bstats_update(&cl->bstats, skb);
+ qdisc_bstats_update(sch, skb);
sch->q.qlen++;
return NET_XMIT_SUCCESS;
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c
index 01b519d..984c1b0 100644
--- a/net/sched/sch_htb.c
+++ b/net/sched/sch_htb.c
@@ -569,15 +569,12 @@ static int htb_enqueue(struct sk_buff *skb, struct Qdisc *sch)
}
return ret;
} else {
- cl->bstats.packets +=
- skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
- cl->bstats.bytes += qdisc_pkt_len(skb);
+ bstats_update(&cl->bstats, skb);
htb_activate(q, cl);
}
sch->q.qlen++;
- sch->bstats.packets += skb_is_gso(skb)?skb_shinfo(skb)->gso_segs:1;
- sch->bstats.bytes += qdisc_pkt_len(skb);
+ qdisc_bstats_update(sch, skb);
return NET_XMIT_SUCCESS;
}
@@ -648,12 +645,10 @@ static void htb_charge_class(struct htb_sched *q, struct htb_class *cl,
htb_add_to_wait_tree(q, cl, diff);
}
- /* update byte stats except for leaves which are already updated */
- if (cl->level) {
- cl->bstats.bytes += bytes;
- cl->bstats.packets += skb_is_gso(skb)?
- skb_shinfo(skb)->gso_segs:1;
- }
+ /* update basic stats except for leaves which are already updated */
+ if (cl->level)
+ bstats_update(&cl->bstats, skb);
+
cl = cl->parent;
}
}
diff --git a/net/sched/sch_ingress.c b/net/sched/sch_ingress.c
index f10e34a..bce1665 100644
--- a/net/sched/sch_ingress.c
+++ b/net/sched/sch_ingress.c
@@ -63,8 +63,7 @@ static int ingress_enqueue(struct sk_buff *skb, struct Qdisc *sch)
result = tc_classify(skb, p->filter_list, &res);
- sch->bstats.packets++;
- sch->bstats.bytes += qdisc_pkt_len(skb);
+ qdisc_bstats_update(sch, skb);
switch (result) {
case TC_ACT_SHOT:
result = TC_ACT_SHOT;
diff --git a/net/sched/sch_multiq.c b/net/sched/sch_multiq.c
index 32690de..21f13da 100644
--- a/net/sched/sch_multiq.c
+++ b/net/sched/sch_multiq.c
@@ -83,8 +83,7 @@ multiq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
ret = qdisc_enqueue(skb, qdisc);
if (ret == NET_XMIT_SUCCESS) {
- sch->bstats.bytes += qdisc_pkt_len(skb);
- sch->bstats.packets++;
+ qdisc_bstats_update(sch, skb);
sch->q.qlen++;
return NET_XMIT_SUCCESS;
}
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c
index e5593c0..1c4bce8 100644
--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -240,8 +240,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch)
if (likely(ret == NET_XMIT_SUCCESS)) {
sch->q.qlen++;
- sch->bstats.bytes += qdisc_pkt_len(skb);
- sch->bstats.packets++;
+ qdisc_bstats_update(sch, skb);
} else if (net_xmit_drop_count(ret)) {
sch->qstats.drops++;
}
@@ -477,8 +476,7 @@ static int tfifo_enqueue(struct sk_buff *nskb, struct Qdisc *sch)
__skb_queue_after(list, skb, nskb);
sch->qstats.backlog += qdisc_pkt_len(nskb);
- sch->bstats.bytes += qdisc_pkt_len(nskb);
- sch->bstats.packets++;
+ qdisc_bstats_update(sch, nskb);
return NET_XMIT_SUCCESS;
}
diff --git a/net/sched/sch_prio.c b/net/sched/sch_prio.c
index b1c95bc..966158d 100644
--- a/net/sched/sch_prio.c
+++ b/net/sched/sch_prio.c
@@ -84,8 +84,7 @@ prio_enqueue(struct sk_buff *skb, struct Qdisc *sch)
ret = qdisc_enqueue(skb, qdisc);
if (ret == NET_XMIT_SUCCESS) {
- sch->bstats.bytes += qdisc_pkt_len(skb);
- sch->bstats.packets++;
+ qdisc_bstats_update(sch, skb);
sch->q.qlen++;
return NET_XMIT_SUCCESS;
}
diff --git a/net/sched/sch_red.c b/net/sched/sch_red.c
index a67ba3c..a6009c5 100644
--- a/net/sched/sch_red.c
+++ b/net/sched/sch_red.c
@@ -94,8 +94,7 @@ static int red_enqueue(struct sk_buff *skb, struct Qdisc* sch)
ret = qdisc_enqueue(skb, child);
if (likely(ret == NET_XMIT_SUCCESS)) {
- sch->bstats.bytes += qdisc_pkt_len(skb);
- sch->bstats.packets++;
+ qdisc_bstats_update(sch, skb);
sch->q.qlen++;
} else if (net_xmit_drop_count(ret)) {
q->stats.pdrop++;
diff --git a/net/sched/sch_sfq.c b/net/sched/sch_sfq.c
index d54ac94..239ec53 100644
--- a/net/sched/sch_sfq.c
+++ b/net/sched/sch_sfq.c
@@ -403,8 +403,7 @@ sfq_enqueue(struct sk_buff *skb, struct Qdisc *sch)
slot->allot = q->scaled_quantum;
}
if (++sch->q.qlen <= q->limit) {
- sch->bstats.bytes += qdisc_pkt_len(skb);
- sch->bstats.packets++;
+ qdisc_bstats_update(sch, skb);
return NET_XMIT_SUCCESS;
}
diff --git a/net/sched/sch_tbf.c b/net/sched/sch_tbf.c
index 641a30d..77565e7 100644
--- a/net/sched/sch_tbf.c
+++ b/net/sched/sch_tbf.c
@@ -134,8 +134,7 @@ static int tbf_enqueue(struct sk_buff *skb, struct Qdisc* sch)
}
sch->q.qlen++;
- sch->bstats.bytes += qdisc_pkt_len(skb);
- sch->bstats.packets++;
+ qdisc_bstats_update(sch, skb);
return NET_XMIT_SUCCESS;
}
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c
index 106479a..af9360d 100644
--- a/net/sched/sch_teql.c
+++ b/net/sched/sch_teql.c
@@ -83,8 +83,7 @@ teql_enqueue(struct sk_buff *skb, struct Qdisc* sch)
if (q->q.qlen < dev->tx_queue_len) {
__skb_queue_tail(&q->q, skb);
- sch->bstats.bytes += qdisc_pkt_len(skb);
- sch->bstats.packets++;
+ qdisc_bstats_update(sch, skb);
return NET_XMIT_SUCCESS;
}
^ permalink raw reply related
* Re: [PATCH] net_sched: factorize qdisc stats handling
From: Stephen Hemminger @ 2011-01-09 17:57 UTC (permalink / raw)
To: Eric Dumazet
Cc: Changli Gao, David Miller, Fabio Checconi, netdev, Luigi Rizzo
In-Reply-To: <1294478789.2709.79.camel@edumazet-laptop>
On Sat, 08 Jan 2011 10:26:29 +0100
Eric Dumazet <eric.dumazet@gmail.com> wrote:
> +static inline void bstats_update(struct gnet_stats_basic_packed *bstats,
> + struct sk_buff *skb)
> +{
> + bstats->bytes += qdisc_pkt_len(skb);
> + bstats->packets += skb_is_gso(skb) ? skb_shinfo(skb)->gso_segs : 1;
> +}
> +
> +static inline void qdisc_bstats_update(struct Qdisc *sch, struct sk_buff *skb)
> {
> - sch->bstats.bytes += len;
> - sch->bstats.packets++;
> + bstats_update(&sch->bstats, skb);
> }
Minor nit. I prefer to show that skb is not modified.
static inline void bstats_update(struct gnet_stats_basic_packed *bstats,
const struct sk_buff *skb)
static inline void qdisc_bstats_update(struct Qdisc *sch, const struct sk_buff *skb)
--
^ permalink raw reply
* Re: iproute2 caching and batch mode
From: Stephen Hemminger @ 2011-01-09 17:53 UTC (permalink / raw)
To: denys; +Cc: netdev
In-Reply-To: <0befc7c09f04936c1244eaa5a1d2620c@localhost>
On Sat, 08 Jan 2011 22:09:39 +0200
<denys@visp.net.lb> wrote:
> Hi,
>
> noticed some issue a while ago, and because of recent patches decided to
> post my thoughts:
>
> This issue can happen if ip or tc running in some kind of "daemon" batch
> mode, or processing large batch file on computer where interfaces can
> reappear with same name but different index (pppoe NAS for example).
>
> It is easy to reproduce the problem:
>
> centaur iproute2-2.6.37 # ip/ip -force -batch -
> tunnel add test0 mode ipip remote 1.1.1.2 local 1.1.1.1
> link show dev test0
> 201: test0: <POINTOPOINT,NOARP> mtu 1480 qdisc noop state DOWN
> link/ipip 1.1.1.1 peer 1.1.1.2
> tunnel del test0
> Unsupported family:17
>
> Or:
>
> centaur iproute2-2.6.37 # ip/ip -force -batch -
> tunnel del test0
> tunnel add test0 mode ipip remote 1.1.1.2 local 1.1.1.1
> link show dev test0
> 202: test0: <POINTOPOINT,NOARP> mtu 1480 qdisc noop state DOWN
> link/ipip 1.1.1.1 peer 1.1.1.2
> (another console, delete and create again test0)
> link show dev test0
> (nothing will appear)
>
This is one of the reasons caching names seems to be a bad idea.
Caching ifindex is okay because it normally does not change.
The point of batch mode was to allow complex setup scripts to
avoid the overhead of repeated invocations. Using it as a long
running daemon was not something I thought about, and frankly
seems like a bad idea for general usage.
^ permalink raw reply
* [PATCH 6/6] offloading: Convert checksums to use centrally computed features.
From: Jesse Gross @ 2011-01-09 16:23 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <1294590215-15541-1-git-send-email-jesse@nicira.com>
In order to compute the features for other offloads (primarily
scatter/gather), we need to first check the ability of the NIC to
offload the checksum for the packet. Since we have already computed
this, we can directly use the result instead of figuring it out
again.
Signed-off-by: Jesse Gross <jesse@nicira.com>
---
net/core/dev.c | 40 ++++++++++++----------------------------
1 files changed, 12 insertions(+), 28 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 2f838f1..3fe443b 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1732,33 +1732,6 @@ void netif_device_attach(struct net_device *dev)
}
EXPORT_SYMBOL(netif_device_attach);
-static bool can_checksum_protocol(unsigned long features, __be16 protocol)
-{
- return ((features & NETIF_F_GEN_CSUM) ||
- ((features & NETIF_F_V4_CSUM) &&
- protocol == htons(ETH_P_IP)) ||
- ((features & NETIF_F_V6_CSUM) &&
- protocol == htons(ETH_P_IPV6)) ||
- ((features & NETIF_F_FCOE_CRC) &&
- protocol == htons(ETH_P_FCOE)));
-}
-
-static bool dev_can_checksum(struct net_device *dev, struct sk_buff *skb)
-{
- __be16 protocol = skb->protocol;
- int features = dev->features;
-
- if (vlan_tx_tag_present(skb)) {
- features &= dev->vlan_features;
- } else if (protocol == htons(ETH_P_8021Q)) {
- struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
- protocol = veh->h_vlan_encapsulated_proto;
- features &= dev->vlan_features;
- }
-
- return can_checksum_protocol(features, protocol);
-}
-
/**
* skb_dev_set -- assign a new device to a buffer
* @skb: buffer for the new device
@@ -2015,6 +1988,17 @@ static inline void skb_orphan_try(struct sk_buff *skb)
}
}
+static bool can_checksum_protocol(unsigned long features, __be16 protocol)
+{
+ return ((features & NETIF_F_GEN_CSUM) ||
+ ((features & NETIF_F_V4_CSUM) &&
+ protocol == htons(ETH_P_IP)) ||
+ ((features & NETIF_F_V6_CSUM) &&
+ protocol == htons(ETH_P_IPV6)) ||
+ ((features & NETIF_F_FCOE_CRC) &&
+ protocol == htons(ETH_P_FCOE)));
+}
+
static int harmonize_features(struct sk_buff *skb, __be16 protocol, int features)
{
if (!can_checksum_protocol(protocol, features)) {
@@ -2117,7 +2101,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
if (skb->ip_summed == CHECKSUM_PARTIAL) {
skb_set_transport_header(skb,
skb_checksum_start_offset(skb));
- if (!dev_can_checksum(dev, skb) &&
+ if (!(features & NETIF_F_ALL_CSUM) &&
skb_checksum_help(skb))
goto out_kfree_skb;
}
--
1.7.1
^ permalink raw reply related
* [PATCH 5/6] offloading: Convert skb_need_linearize() to use precomputed features.
From: Jesse Gross @ 2011-01-09 16:23 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <1294590215-15541-1-git-send-email-jesse@nicira.com>
This switches skb_need_linearize() to use the features that have
been centrally computed. In doing so, this fixes a problem where
scatter/gather should not be used because the card does not support
checksum offloading on that type of packet. On device registration
we only check that some form of checksum offloading is available if
scatter/gatther is enabled but we must also check at transmission
time. Examples of this include IPv6 or vlan packets on a NIC that
only supports IPv4 offloading.
Signed-off-by: Jesse Gross <jesse@nicira.com>
---
net/core/dev.c | 21 ++++++---------------
1 files changed, 6 insertions(+), 15 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 4cd3e84..2f838f1 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2059,22 +2059,13 @@ EXPORT_SYMBOL(netif_skb_features);
* support DMA from it.
*/
static inline int skb_needs_linearize(struct sk_buff *skb,
- struct net_device *dev)
+ int features)
{
- if (skb_is_nonlinear(skb)) {
- int features = dev->features;
-
- if (vlan_tx_tag_present(skb))
- features &= dev->vlan_features;
-
- return (skb_has_frag_list(skb) &&
- !(features & NETIF_F_FRAGLIST)) ||
+ return skb_is_nonlinear(skb) &&
+ ((skb_has_frag_list(skb) &&
+ !(features & NETIF_F_FRAGLIST)) ||
(skb_shinfo(skb)->nr_frags &&
- (!(features & NETIF_F_SG) ||
- illegal_highdma(dev, skb)));
- }
-
- return 0;
+ !(features & NETIF_F_SG)));
}
int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
@@ -2115,7 +2106,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
if (skb->next)
goto gso;
} else {
- if (skb_needs_linearize(skb, dev) &&
+ if (skb_needs_linearize(skb, features) &&
__skb_linearize(skb))
goto out_kfree_skb;
--
1.7.1
^ permalink raw reply related
* [PATCH 4/6] offloading: Convert dev_gso_segment() to use precomputed features.
From: Jesse Gross @ 2011-01-09 16:23 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <1294590215-15541-1-git-send-email-jesse@nicira.com>
This switches dev_gso_segment() to use the device features computed
by the centralized routine. In doing so, it fixes a problem where
it would always use dev->features, instead of those appropriate
to the number of vlan tags if any are present.
Signed-off-by: Jesse Gross <jesse@nicira.com>
---
net/core/dev.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index 1444ed3..4cd3e84 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1971,16 +1971,14 @@ static void dev_gso_skb_destructor(struct sk_buff *skb)
/**
* dev_gso_segment - Perform emulated hardware segmentation on skb.
* @skb: buffer to segment
+ * @features: device features as applicable to this skb
*
* This function segments the given skb and stores the list of segments
* in skb->next.
*/
-static int dev_gso_segment(struct sk_buff *skb)
+static int dev_gso_segment(struct sk_buff *skb, int features)
{
- struct net_device *dev = skb->dev;
struct sk_buff *segs;
- int features = dev->features & ~(illegal_highdma(dev, skb) ?
- NETIF_F_SG : 0);
segs = skb_gso_segment(skb, features);
@@ -2112,7 +2110,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
}
if (netif_needs_gso(skb, features)) {
- if (unlikely(dev_gso_segment(skb)))
+ if (unlikely(dev_gso_segment(skb, features)))
goto out_kfree_skb;
if (skb->next)
goto gso;
--
1.7.1
^ permalink raw reply related
* [PATCH 3/6] offloading: Pass features into netif_needs_gso().
From: Jesse Gross @ 2011-01-09 16:23 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <1294590215-15541-1-git-send-email-jesse@nicira.com>
Now that there is a single function that can compute the device
features relevant to a packet, we don't want to run it for each
offload. This converts netif_needs_gso() to take the features
of the device, rather than computing them itself.
Signed-off-by: Jesse Gross <jesse@nicira.com>
---
drivers/net/xen-netfront.c | 2 +-
include/linux/netdevice.h | 12 +++---------
net/core/dev.c | 8 ++++++--
3 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
index cdbeec9..546de57 100644
--- a/drivers/net/xen-netfront.c
+++ b/drivers/net/xen-netfront.c
@@ -488,7 +488,7 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
if (unlikely(!netif_carrier_ok(dev) ||
(frags > 1 && !xennet_can_sg(dev)) ||
- netif_needs_gso(dev, skb))) {
+ netif_needs_gso(skb, netif_skb_features(skb)))) {
spin_unlock_irq(&np->tx_lock);
goto drop;
}
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index d4dac09..de2bfe6 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2317,16 +2317,10 @@ static inline int skb_gso_ok(struct sk_buff *skb, int features)
(!skb_has_frag_list(skb) || (features & NETIF_F_FRAGLIST));
}
-static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
+static inline int netif_needs_gso(struct sk_buff *skb, int features)
{
- if (skb_is_gso(skb)) {
- int features = netif_skb_features(skb);
-
- return (!skb_gso_ok(skb, features) ||
- unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
- }
-
- return 0;
+ return skb_is_gso(skb) && (!skb_gso_ok(skb, features) ||
+ unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
}
static inline void netif_set_gso_max_size(struct net_device *dev,
diff --git a/net/core/dev.c b/net/core/dev.c
index a51dfd7..1444ed3 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2086,6 +2086,8 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
int rc = NETDEV_TX_OK;
if (likely(!skb->next)) {
+ int features;
+
/*
* If device doesnt need skb->dst, release it right now while
* its hot in this cpu cache
@@ -2098,8 +2100,10 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
skb_orphan_try(skb);
+ features = netif_skb_features(skb);
+
if (vlan_tx_tag_present(skb) &&
- !(dev->features & NETIF_F_HW_VLAN_TX)) {
+ !(features & NETIF_F_HW_VLAN_TX)) {
skb = __vlan_put_tag(skb, vlan_tx_tag_get(skb));
if (unlikely(!skb))
goto out;
@@ -2107,7 +2111,7 @@ int dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
skb->vlan_tci = 0;
}
- if (netif_needs_gso(dev, skb)) {
+ if (netif_needs_gso(skb, features)) {
if (unlikely(dev_gso_segment(skb)))
goto out_kfree_skb;
if (skb->next)
--
1.7.1
^ permalink raw reply related
* [PATCH 2/6] offloading: Generalize netif_get_vlan_features().
From: Jesse Gross @ 2011-01-09 16:23 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <1294590215-15541-1-git-send-email-jesse@nicira.com>
netif_get_vlan_features() is currently only used by netif_needs_gso(),
so it only concerns itself with GSO features. However, several other
places also should take into account the contents of the packet when
deciding whether to offload to hardware. This generalizes the function
to return features about all of the various forms of offloading. Since
offloads tend to be linked together, this avoids duplicating the logic
in each location (i.e. the scatter/gather code also needs the checksum
logic).
Suggested-by: Michał Mirosław <mirqus@gmail.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
---
include/linux/netdevice.h | 4 ++--
net/core/dev.c | 35 +++++++++++++++++++++++++++--------
2 files changed, 29 insertions(+), 10 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0f6b1c9..d4dac09 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -2303,7 +2303,7 @@ unsigned long netdev_fix_features(unsigned long features, const char *name);
void netif_stacked_transfer_operstate(const struct net_device *rootdev,
struct net_device *dev);
-int netif_get_vlan_features(struct sk_buff *skb, struct net_device *dev);
+int netif_skb_features(struct sk_buff *skb);
static inline int net_gso_ok(int features, int gso_type)
{
@@ -2320,7 +2320,7 @@ static inline int skb_gso_ok(struct sk_buff *skb, int features)
static inline int netif_needs_gso(struct net_device *dev, struct sk_buff *skb)
{
if (skb_is_gso(skb)) {
- int features = netif_get_vlan_features(skb, dev);
+ int features = netif_skb_features(skb);
return (!skb_gso_ok(skb, features) ||
unlikely(skb->ip_summed != CHECKSUM_PARTIAL));
diff --git a/net/core/dev.c b/net/core/dev.c
index d8befd0..a51dfd7 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2017,22 +2017,41 @@ static inline void skb_orphan_try(struct sk_buff *skb)
}
}
-int netif_get_vlan_features(struct sk_buff *skb, struct net_device *dev)
+static int harmonize_features(struct sk_buff *skb, __be16 protocol, int features)
+{
+ if (!can_checksum_protocol(protocol, features)) {
+ features &= ~NETIF_F_ALL_CSUM;
+ features &= ~NETIF_F_SG;
+ } else if (illegal_highdma(skb->dev, skb)) {
+ features &= ~NETIF_F_SG;
+ }
+
+ return features;
+}
+
+int netif_skb_features(struct sk_buff *skb)
{
__be16 protocol = skb->protocol;
+ int features = skb->dev->features;
if (protocol == htons(ETH_P_8021Q)) {
struct vlan_ethhdr *veh = (struct vlan_ethhdr *)skb->data;
protocol = veh->h_vlan_encapsulated_proto;
- } else if (!skb->vlan_tci)
- return dev->features;
+ } else if (!vlan_tx_tag_present(skb)) {
+ return harmonize_features(skb, protocol, features);
+ }
- if (protocol != htons(ETH_P_8021Q))
- return dev->features & dev->vlan_features;
- else
- return 0;
+ features &= skb->dev->vlan_features;
+
+ if (protocol != htons(ETH_P_8021Q)) {
+ return harmonize_features(skb, protocol, features);
+ } else {
+ features &= NETIF_F_SG | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST |
+ NETIF_F_GEN_CSUM;
+ return harmonize_features(skb, protocol, features);
+ }
}
-EXPORT_SYMBOL(netif_get_vlan_features);
+EXPORT_SYMBOL(netif_skb_features);
/*
* Returns true if either:
--
1.7.1
^ permalink raw reply related
* [PATCH 1/6] offloading: Accept NETIF_F_HW_CSUM for all protocols.
From: Jesse Gross @ 2011-01-09 16:23 UTC (permalink / raw)
To: David Miller; +Cc: netdev
We currently only have software fallback for one type of checksum: the
TCP/UDP one's complement. This means that a protocol that uses hardware
offloading for a different type of checksum (FCoE, SCTP) must directly
check the device's features and do the right thing ahead of time. By
the time we get to dev_can_checksum(), we're only deciding whether to
apply the one algorithm in software or hardware. NETIF_F_HW_CSUM has the
same capabilities as the software version, so we should always use it if
present. The primary advantage of this is multiply tagged vlans can use
hardware checksumming.
Signed-off-by: Jesse Gross <jesse@nicira.com>
---
net/core/dev.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index a215269..d8befd0 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1734,7 +1734,7 @@ EXPORT_SYMBOL(netif_device_attach);
static bool can_checksum_protocol(unsigned long features, __be16 protocol)
{
- return ((features & NETIF_F_NO_CSUM) ||
+ return ((features & NETIF_F_GEN_CSUM) ||
((features & NETIF_F_V4_CSUM) &&
protocol == htons(ETH_P_IP)) ||
((features & NETIF_F_V6_CSUM) &&
--
1.7.1
^ permalink raw reply related
* Re: [PATCH 2/2] sky2: convert to new VLAN model (v0.2)
From: Jesse Gross @ 2011-01-09 16:13 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: David Miller, netdev
In-Reply-To: <20110107201350.0be350bf@nehalam>
On Fri, Jan 7, 2011 at 11:13 PM, Stephen Hemminger
<shemminger@vyatta.com> wrote:
> This converts sky2 to new VLAN offload flags control via ethtool.
> It also allows for transmit offload of vlan tagged frames which
> was not possible before.
>
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
>
> ---
> Changed the setting of vlan_features in this version to keep
> non-offload settings (GRO|HIGHDMA) even if vlan offload is not
> enabled.
Thanks Stephen.
Reviewed-by: Jesse Gross <jesse@nicira.com>
^ permalink raw reply
* Re: Reset hardware address (MAC address) in c++
From: Ben Hutchings @ 2011-01-09 16:06 UTC (permalink / raw)
To: Chin Shi Hong; +Cc: netdev
In-Reply-To: <AANLkTimW247sL7mVKChOVjGFTcSA4mYZhwXdasfaYzXN@mail.gmail.com>
On Sun, 2011-01-09 at 22:39 +0800, Chin Shi Hong wrote:
> Dear All,
>
> My final year project is all about MAC address spoofing.
>
> I do know that I can reset the MAC address of my network adapter to
> its original by rebooting the Linux operating system I am using.
>
> My Linux distribution is using NetworkManager. On Wireless network,
> each time after I change the MAC address of my wireless network
> adapter and then connect to the wireless network, and then once I
> disconnect from wireless network, NetworkManager will reset the MAC
> address of my wireless network adapter to its original.
>
> I had programmed my application to change the MAC address. Now, trying
> to implement the feature that reset the MAC address. I don't know
> whether NetworkManager record down the original MAC address of my
> Network Adapter or not. But, assume if NetworkManager is able to reset
> the MAC address of my network adapter to its original MAC address
> without recording the original MAC address and without reboot, then my
> application must be able to do the same.
>
> So, can anyone tell me the C++ codes that is able to reset the MAC
> address, or give me some ideas on this, please?
You can read the permanent MAC address using the ethtool
ETHTOOL_GPERMADDR operation. See the ethtool utility for an example of
how to use this.
Ben.
--
Ben Hutchings, Senior Software Engineer, Solarflare Communications
Not speaking for my employer; that's the marketing department's job.
They asked us to note that Solarflare product names are trademarked.
^ permalink raw reply
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