* Re: [PATCH 2/4] C/R: Basic support for network namespaces and devices (v3)
From: Serge E. Hallyn @ 2010-02-10 20:30 UTC (permalink / raw)
To: Oren Laadan; +Cc: Dan Smith, containers, netdev
In-Reply-To: <4B7310AA.3090708@cs.columbia.edu>
Quoting Oren Laadan (orenl@cs.columbia.edu):
>
>
> Dan Smith wrote:
> >SH> What exactly is this == 0 case? Does it mean 'use inherited
> >SH> netns'?
> >
> >It means it wasn't in the checkpoint image to begin with, so yeah,
> >kinda.
>
> Maybe it's time to define CKPT_OBJREF_NULL for that ?
> (to make it easy to fold, in a separate patch please)
Honestly that wouldn't be any more helpful. Just a comment. The
problem is with 0 having a different meaning for each type of
object, so 0 or CKPT_OBJREF_NULL is equally unhelpful imo :)
/* wasn't in the checkpoint image, use the netns of restarting task */
or somesuch
-serge
^ permalink raw reply
* Re: [PATCH 2/4] C/R: Basic support for network namespaces and devices (v3)
From: Dan Smith @ 2010-02-10 20:31 UTC (permalink / raw)
To: Serge E. Hallyn; +Cc: containers, netdev
In-Reply-To: <20100210202509.GA23301@us.ibm.com>
SH> I think that's be better. Right now if we checkpoint a container
SH> with macvlan restart will be bogus, right? We're trying to avoid
SH> any cases where we can't tell, at checkpoint, that restart won't
SH> be right.
Depends on your definition of bogus, and the situation, but okay.
SH> What I was asking is should do_veth_message() be in drivers/net/veth.c?
Well, we could add another ndo_* function to the net device, I guess,
but I'd be afraid we'd hit some cases where that wasn't sufficient.
Maybe it would be best to generalize that bit after I've added macvlan
(,etc) support so we have a good idea of what else would be needed?
--
Dan Smith
IBM Linux Technology Center
email: danms@us.ibm.com
^ permalink raw reply
* Re: pull request: wireless-2.6 2010-02-10
From: John W. Linville @ 2010-02-10 20:32 UTC (permalink / raw)
To: David Miller; +Cc: johannes, linux-wireless, netdev, linux-kernel, mb
In-Reply-To: <20100210.122540.149553948.davem@davemloft.net>
On Wed, Feb 10, 2010 at 12:25:40PM -0800, David Miller wrote:
> From: "John W. Linville" <linville@tuxdriver.com>
> Date: Wed, 10 Feb 2010 15:19:54 -0500
>
> > On Wed, Feb 10, 2010 at 11:36:58AM -0800, David Miller wrote:
> >> From: Johannes Berg <johannes@sipsolutions.net>
> >> Date: Wed, 10 Feb 2010 20:15:37 +0100
> >>
> >> > It was intentional -- that sdev doesn't even have an irq member, but
> >> > nobody ever noticed because of the wrong ifdef.
> >>
> >> Ok, then this needs to be explained in the commit message.
> >
> > OK...mind if I just revert the current version and ask Michael to
> > resubmit with an appropriate changelog entry?
>
> Have you pulled this tree into others already? Why not
> just pop out the commit and fix it's commit message, then
> reapply?
>
> Having the revert commit in there is really stupid just for this.
I have it pulled into wireless-next-2.6 to fix a merge conflict (from
a latter commit). It is also pulled into wireless-testing but that
is obviously less of an issue.
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply
* Re: pull request: wireless-2.6 2010-02-10
From: David Miller @ 2010-02-10 20:35 UTC (permalink / raw)
To: linville; +Cc: johannes, linux-wireless, netdev, linux-kernel, mb
In-Reply-To: <20100210203227.GD3286@tuxdriver.com>
From: "John W. Linville" <linville@tuxdriver.com>
Date: Wed, 10 Feb 2010 15:32:28 -0500
> On Wed, Feb 10, 2010 at 12:25:40PM -0800, David Miller wrote:
>> From: "John W. Linville" <linville@tuxdriver.com>
>> Date: Wed, 10 Feb 2010 15:19:54 -0500
>>
>> > On Wed, Feb 10, 2010 at 11:36:58AM -0800, David Miller wrote:
>> >> From: Johannes Berg <johannes@sipsolutions.net>
>> >> Date: Wed, 10 Feb 2010 20:15:37 +0100
>> >>
>> >> > It was intentional -- that sdev doesn't even have an irq member, but
>> >> > nobody ever noticed because of the wrong ifdef.
>> >>
>> >> Ok, then this needs to be explained in the commit message.
>> >
>> > OK...mind if I just revert the current version and ask Michael to
>> > resubmit with an appropriate changelog entry?
>>
>> Have you pulled this tree into others already? Why not
>> just pop out the commit and fix it's commit message, then
>> reapply?
>>
>> Having the revert commit in there is really stupid just for this.
>
> I have it pulled into wireless-next-2.6 to fix a merge conflict (from
> a latter commit). It is also pulled into wireless-testing but that
> is obviously less of an issue.
Ok, forget this, I'll just pull it in as-is.
But we have to have a better system to handle cases where I
don't like a change you're asking me to pull in and I want
changes made to it.
If you want to push stuff into wireless-next-2.6, get it into
my tree first. That way we can tidy things up before it
propagates.
Thanks.
^ permalink raw reply
* Re: [PATCH 2/4] C/R: Basic support for network namespaces and devices (v3)
From: Serge E. Hallyn @ 2010-02-10 20:34 UTC (permalink / raw)
To: Dan Smith; +Cc: containers, netdev
In-Reply-To: <87d40chlyx.fsf@caffeine.danplanet.com>
Quoting Dan Smith (danms@us.ibm.com):
> SH> I think that's be better. Right now if we checkpoint a container
> SH> with macvlan restart will be bogus, right? We're trying to avoid
> SH> any cases where we can't tell, at checkpoint, that restart won't
> SH> be right.
>
> Depends on your definition of bogus, and the situation, but okay.
>
> SH> What I was asking is should do_veth_message() be in drivers/net/veth.c?
>
> Well, we could add another ndo_* function to the net device, I guess,
> but I'd be afraid we'd hit some cases where that wasn't sufficient.
> Maybe it would be best to generalize that bit after I've added macvlan
> (,etc) support so we have a good idea of what else would be needed?
Yeah, I think you're right.
thanks,
-serge
^ permalink raw reply
* Re: pull request: wireless-2.6 2010-02-10
From: John W. Linville @ 2010-02-10 20:37 UTC (permalink / raw)
To: David Miller; +Cc: johannes, linux-wireless, netdev, linux-kernel, mb
In-Reply-To: <20100210.123503.129355851.davem@davemloft.net>
On Wed, Feb 10, 2010 at 12:35:03PM -0800, David Miller wrote:
> From: "John W. Linville" <linville@tuxdriver.com>
> Date: Wed, 10 Feb 2010 15:32:28 -0500
>
> > On Wed, Feb 10, 2010 at 12:25:40PM -0800, David Miller wrote:
> >> From: "John W. Linville" <linville@tuxdriver.com>
> >> Date: Wed, 10 Feb 2010 15:19:54 -0500
> >>
> >> > On Wed, Feb 10, 2010 at 11:36:58AM -0800, David Miller wrote:
> >> >> From: Johannes Berg <johannes@sipsolutions.net>
> >> >> Date: Wed, 10 Feb 2010 20:15:37 +0100
> >> >>
> >> >> > It was intentional -- that sdev doesn't even have an irq member, but
> >> >> > nobody ever noticed because of the wrong ifdef.
> >> >>
> >> >> Ok, then this needs to be explained in the commit message.
> >> >
> >> > OK...mind if I just revert the current version and ask Michael to
> >> > resubmit with an appropriate changelog entry?
> >>
> >> Have you pulled this tree into others already? Why not
> >> just pop out the commit and fix it's commit message, then
> >> reapply?
> >>
> >> Having the revert commit in there is really stupid just for this.
> >
> > I have it pulled into wireless-next-2.6 to fix a merge conflict (from
> > a latter commit). It is also pulled into wireless-testing but that
> > is obviously less of an issue.
>
> Ok, forget this, I'll just pull it in as-is.
K, thx!
> But we have to have a better system to handle cases where I
> don't like a change you're asking me to pull in and I want
> changes made to it.
>
> If you want to push stuff into wireless-next-2.6, get it into
> my tree first. That way we can tidy things up before it
> propagates.
Yeah, I was trying to be proactive about the merge conflicts and
avoid the emails about the conflicts in -next. But I guess that
isn't a huge deal anyway, so I'll be a bit more cautious in the future.
Thanks!
John
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply
* [PATCH 0/6] tcp: bugs and cleanup updated to 2.6.33-rc7
From: William Allen Simpson @ 2010-02-10 20:56 UTC (permalink / raw)
To: Linux Kernel Developers, Linux Kernel Network Developers; +Cc: Andrew Morton
Combination of patches reported in October, November, December, and
January. These patches fix perceived bugs, and other cleanup.
This code has had previous review and several months of limited testing.
Some portions were removed during the various TCPCT part 1 patch splits,
then were cut off by the sudden unexpected end of that merge window.
[03 Dec 2009] I've restarted the sub-numbering (again).
Of particular interest are the TCPCT header extensions that already
appear in the next phase of testing with other platforms. These patches
allow correct reception without data corruption.
The remainder of the original TCPCT part 2 will be merged with part 3.
These patches are against the current linux-2.6 tree.
[Since Feb 2nd, Part 2g temporarily removed from this series; possible
insufficient resistance to very rare option re-ordering by middleware.]
^ permalink raw reply
* [PATCH v3 1/6] net: tcp_header_len_th and tcp_option_len_th
From: William Allen Simpson @ 2010-02-10 21:00 UTC (permalink / raw)
To: Linux Kernel Developers, Linux Kernel Network Developers; +Cc: Andrew Morton
In-Reply-To: <4B731D61.2080603@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 359 bytes --]
Redefine two TCP header functions to accept TCP header pointer.
When subtracting, return signed int to allow error checking.
These functions will be used in subsequent patches that implement
additional features.
Signed-off-by: William.Allen.Simpson@gmail.com
---
include/linux/tcp.h | 12 ++++++++++++
1 files changed, 12 insertions(+), 0 deletions(-)
[-- Attachment #2: len_th+2a3+2.6.33-rc7.patch --]
[-- Type: text/plain, Size: 719 bytes --]
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 7fee8a4..d0133cf 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -223,6 +223,18 @@ static inline unsigned int tcp_optlen(const struct sk_buff *skb)
return (tcp_hdr(skb)->doff - 5) * 4;
}
+/* Length of fixed header plus standard options. */
+static inline unsigned int tcp_header_len_th(const struct tcphdr *th)
+{
+ return th->doff * 4;
+}
+
+/* Length of standard options only. This could be negative. */
+static inline int tcp_option_len_th(const struct tcphdr *th)
+{
+ return (int)(th->doff * 4) - sizeof(*th);
+}
+
/* This defines a selective acknowledgement block. */
struct tcp_sack_block_wire {
__be32 start_seq;
--
1.6.3.3
^ permalink raw reply related
* bnx2 limits user-specified advertised speeds to one
From: Vlad Yasevich @ 2010-02-10 21:05 UTC (permalink / raw)
To: netdev
Hi
A customer has noted that when attempting to change the advertised speeds
setting on card using a bnx2 driver, the driver advertises either all available
speeds or just one. In other words, if a user attempts to set multiple
advertised speeds, the settings will not be honored.
Looking at the code in bnx2_set_settings, the checks for 10baseT and 100baseT
make an assumption that the user provided only 1 speed setting.
e1000 and e1000e work correctly when the user specifies multiple advertised
speeds.
Before attempting to fix this, I wanted to ask if there was a reason for the
current functionality.
Thanks
-vlad
^ permalink raw reply
* Re: [PATCH 0/3] net: fec fixes
From: David Miller @ 2010-02-10 21:06 UTC (permalink / raw)
To: amit.kucheria
Cc: linux-kernel, netdev, s.hauer, gerg, u.kleine-koenig,
amit.kucheria
In-Reply-To: <cover.1265396105.git.amit.kucheria@canonical.com>
From: Amit Kucheria <amit.kucheria@canonical.com>
Date: Fri, 5 Feb 2010 10:56:19 -0800
> Some fixes to the fec driver to get it to work on the Freescale i.MX5 SoC
> platform
>
> Amit Kucheria (2):
> fec: Add LAN8700 phy support
> fec: Add ARCH_MX5 as a dependency
>
> Rob Herring (1):
> fec: fix uninitialized rx buffer usage
All applied to net-next-2.6, thanks.
^ permalink raw reply
* [PATCH v3 2/6] net: remove old tcp_optlen function
From: William Allen Simpson @ 2010-02-10 21:07 UTC (permalink / raw)
To: Linux Kernel Developers, Linux Kernel Network Developers
Cc: Andrew Morton, Michael Chan
In-Reply-To: <4B731D61.2080603@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1070 bytes --]
The tcp_optlen() function returns a potential *negative* unsigned.
In the only two existing files using the old tcp_optlen() function,
clean up confusing and inconsistent mixing of both byte and word
offsets, and other coding style issues. Document assumptions.
Quoth David Miller:
This is transmit, and the packets can only come from the Linux
TCP stack, not some external entity.
You're being way too anal here, and adding these checks to
drivers would be just a lot of rediculious bloat. [sic]
Therefore, there are *no* checks for bad TCP and IP header sizes, nor
any semantic changes. The drivers should function exactly as existing.
No response from testers in 16+ weeks.
Requires:
net: tcp_header_len_th and tcp_option_len_th
Signed-off-by: William.Allen.Simpson@gmail.com
CC: Michael Chan <mchan@broadcom.com>
---
drivers/net/bnx2.c | 29 +++++++++++++-----------
drivers/net/tg3.c | 60 +++++++++++++++++++++++---------------------------
include/linux/tcp.h | 5 ----
3 files changed, 44 insertions(+), 50 deletions(-)
[-- Attachment #2: len_th+2b3+2.6.33-rc7.patch --]
[-- Type: text/plain, Size: 6936 bytes --]
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 65df1de..45452c5 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -6352,6 +6352,8 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp)
/* Called with netif_tx_lock.
* bnx2_tx_int() runs without netif_tx_lock unless it needs to call
* netif_wake_queue().
+ *
+ * No TCP or IP length checking, per David Miller (see commit log).
*/
static netdev_tx_t
bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
@@ -6396,19 +6398,19 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
(TX_BD_FLAGS_VLAN_TAG | (vlan_tx_tag_get(skb) << 16));
}
#endif
- if ((mss = skb_shinfo(skb)->gso_size)) {
- u32 tcp_opt_len;
- struct iphdr *iph;
+ mss = skb_shinfo(skb)->gso_size;
+ if (mss != 0) {
+ struct tcphdr *th = tcp_hdr(skb);
+ int tcp_opt_words = th->doff - (sizeof(*th) >> 2);
+ /* assumes positive tcp_opt_words without checking */
vlan_tag_flags |= TX_BD_FLAGS_SW_LSO;
- tcp_opt_len = tcp_optlen(skb);
-
if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6) {
u32 tcp_off = skb_transport_offset(skb) -
sizeof(struct ipv6hdr) - ETH_HLEN;
- vlan_tag_flags |= ((tcp_opt_len >> 2) << 8) |
+ vlan_tag_flags |= (tcp_opt_words << 8) |
TX_BD_FLAGS_SW_FLAGS;
if (likely(tcp_off == 0))
vlan_tag_flags &= ~TX_BD_FLAGS_TCP6_OFF0_MSK;
@@ -6421,14 +6423,15 @@ bnx2_start_xmit(struct sk_buff *skb, struct net_device *dev)
mss |= (tcp_off & 0xc) << TX_BD_TCP6_OFF2_SHL;
}
} else {
- iph = ip_hdr(skb);
- if (tcp_opt_len || (iph->ihl > 5)) {
- vlan_tag_flags |= ((iph->ihl - 5) +
- (tcp_opt_len >> 2)) << 8;
- }
+ struct iphdr *iph = ip_hdr(skb);
+ int ip_opt_words = iph->ihl - (sizeof(*iph) >> 2);
+ /* assumes positive ip_opt_words without checking */
+ int opt_words = ip_opt_words + tcp_opt_words;
+
+ if (opt_words > 0)
+ vlan_tag_flags |= opt_words << 8;
}
- } else
- mss = 0;
+ }
mapping = pci_map_single(bp->pdev, skb->data, len, PCI_DMA_TODEVICE);
if (pci_dma_mapping_error(bp->pdev, mapping)) {
diff --git a/drivers/net/tg3.c b/drivers/net/tg3.c
index 7f82b02..c20c800 100644
--- a/drivers/net/tg3.c
+++ b/drivers/net/tg3.c
@@ -5426,6 +5426,8 @@ static void tg3_set_txd(struct tg3_napi *tnapi, int entry,
/* hard_start_xmit for devices that don't have any bugs and
* support TG3_FLG2_HW_TSO_2 and TG3_FLG2_HW_TSO_3 only.
+ *
+ * No TCP or IP length checking, per David Miller (see commit log).
*/
static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
struct net_device *dev)
@@ -5461,9 +5463,9 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
entry = tnapi->tx_prod;
base_flags = 0;
- mss = 0;
- if ((mss = skb_shinfo(skb)->gso_size) != 0) {
- int tcp_opt_len, ip_tcp_len;
+ mss = skb_shinfo(skb)->gso_size;
+ if (mss != 0) {
+ struct tcphdr *th;
u32 hdrlen;
if (skb_header_cloned(skb) &&
@@ -5471,18 +5473,16 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
dev_kfree_skb(skb);
goto out_unlock;
}
+ th = tcp_hdr(skb);
if (skb_shinfo(skb)->gso_type & SKB_GSO_TCPV6)
hdrlen = skb_headlen(skb) - ETH_HLEN;
else {
struct iphdr *iph = ip_hdr(skb);
- tcp_opt_len = tcp_optlen(skb);
- ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
-
+ hdrlen = ip_hdrlen(skb) + tcp_header_len_th(th);
+ iph->tot_len = htons(mss + hdrlen);
iph->check = 0;
- iph->tot_len = htons(mss + ip_tcp_len + tcp_opt_len);
- hdrlen = ip_tcp_len + tcp_opt_len;
}
if (tp->tg3_flags2 & TG3_FLG2_HW_TSO_3) {
@@ -5496,7 +5496,7 @@ static netdev_tx_t tg3_start_xmit(struct sk_buff *skb,
base_flags |= (TXD_FLAG_CPU_PRE_DMA |
TXD_FLAG_CPU_POST_DMA);
- tcp_hdr(skb)->check = 0;
+ th->check = 0;
}
else if (skb->ip_summed == CHECKSUM_PARTIAL)
@@ -5629,6 +5629,8 @@ tg3_tso_bug_end:
/* hard_start_xmit for devices that have the 4G bug and/or 40-bit bug and
* support TG3_FLG2_HW_TSO_1 or firmware TSO only.
+ *
+ * No TCP or IP length checking, per David Miller (see commit log).
*/
static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
struct net_device *dev)
@@ -5668,20 +5670,21 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
if (skb->ip_summed == CHECKSUM_PARTIAL)
base_flags |= TXD_FLAG_TCPUDP_CSUM;
- if ((mss = skb_shinfo(skb)->gso_size) != 0) {
+ mss = skb_shinfo(skb)->gso_size;
+ if (mss != 0) {
struct iphdr *iph;
- u32 tcp_opt_len, ip_tcp_len, hdr_len;
+ struct tcphdr *th;
+ u32 hdr_len;
+ int opt_bytes;
if (skb_header_cloned(skb) &&
pskb_expand_head(skb, 0, 0, GFP_ATOMIC)) {
dev_kfree_skb(skb);
goto out_unlock;
}
+ th = tcp_hdr(skb);
+ hdr_len = ip_hdrlen(skb) + tcp_header_len_th(th);
- tcp_opt_len = tcp_optlen(skb);
- ip_tcp_len = ip_hdrlen(skb) + sizeof(struct tcphdr);
-
- hdr_len = ip_tcp_len + tcp_opt_len;
if (unlikely((ETH_HLEN + hdr_len) > 80) &&
(tp->tg3_flags2 & TG3_FLG2_TSO_BUG))
return (tg3_tso_bug(tp, skb));
@@ -5693,13 +5696,14 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
iph->check = 0;
iph->tot_len = htons(mss + hdr_len);
if (tp->tg3_flags2 & TG3_FLG2_HW_TSO) {
- tcp_hdr(skb)->check = 0;
+ th->check = 0;
base_flags &= ~TXD_FLAG_TCPUDP_CSUM;
} else
- tcp_hdr(skb)->check = ~csum_tcpudp_magic(iph->saddr,
- iph->daddr, 0,
- IPPROTO_TCP,
- 0);
+ th->check = ~csum_tcpudp_magic(iph->saddr, iph->daddr,
+ 0, IPPROTO_TCP, 0);
+
+ opt_bytes = hdr_len - sizeof(*iph) - sizeof(*th);
+ /* assumes positive opt_bytes without checking */
if (tp->tg3_flags2 & TG3_FLG2_HW_TSO_3) {
mss |= (hdr_len & 0xc) << 12;
@@ -5710,19 +5714,11 @@ static netdev_tx_t tg3_start_xmit_dma_bug(struct sk_buff *skb,
mss |= hdr_len << 9;
else if ((tp->tg3_flags2 & TG3_FLG2_HW_TSO_1) ||
GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_5705) {
- if (tcp_opt_len || iph->ihl > 5) {
- int tsflags;
-
- tsflags = (iph->ihl - 5) + (tcp_opt_len >> 2);
- mss |= (tsflags << 11);
- }
+ if (opt_bytes > 0)
+ mss |= opt_bytes << (11 - 2);
} else {
- if (tcp_opt_len || iph->ihl > 5) {
- int tsflags;
-
- tsflags = (iph->ihl - 5) + (tcp_opt_len >> 2);
- base_flags |= tsflags << 12;
- }
+ if (opt_bytes > 0)
+ base_flags |= opt_bytes << (12 - 2);
}
}
#if TG3_VLAN_TAG_USED
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index d0133cf..74728f7 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -218,11 +218,6 @@ static inline unsigned int tcp_hdrlen(const struct sk_buff *skb)
return tcp_hdr(skb)->doff * 4;
}
-static inline unsigned int tcp_optlen(const struct sk_buff *skb)
-{
- return (tcp_hdr(skb)->doff - 5) * 4;
-}
-
/* Length of fixed header plus standard options. */
static inline unsigned int tcp_header_len_th(const struct tcphdr *th)
{
--
1.6.3.3
^ permalink raw reply related
* [PATCH v5 3/6] tcp: harmonize tcp_vx_rcv header length assumptions
From: William Allen Simpson @ 2010-02-10 21:11 UTC (permalink / raw)
To: Linux Kernel Developers, Linux Kernel Network Developers
Cc: Andrew Morton, Andi Kleen
In-Reply-To: <4B731D61.2080603@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 825 bytes --]
Harmonize tcp_v4_rcv() and tcp_v6_rcv() -- better document tcp doff
and header length assumptions, and carefully compare implementations.
Reduces multiply/shifts, marginally improving speed.
Removes redundant tcp header length checks before checksumming.
Instead, assumes (and documents) that any backlog processing and
transform policies will carefully preserve the header, and will
ensure the socket buffer length remains >= the header size.
Stand-alone patch, originally developed for TCPCT.
Signed-off-by: William.Allen.Simpson@gmail.com
CC: Andi Kleen <andi@firstfloor.org>
---
include/net/xfrm.h | 7 ++++++
net/ipv4/tcp_ipv4.c | 45 +++++++++++++++++++++-----------------
net/ipv6/tcp_ipv6.c | 59 ++++++++++++++++++++++++++++----------------------
3 files changed, 65 insertions(+), 46 deletions(-)
[-- Attachment #2: len_th+2c5+2.6.33-rc7.patch --]
[-- Type: text/plain, Size: 8037 bytes --]
diff --git a/include/net/xfrm.h b/include/net/xfrm.h
index 60c2770..81492a1 100644
--- a/include/net/xfrm.h
+++ b/include/net/xfrm.h
@@ -975,6 +975,13 @@ xfrm_state_addr_cmp(struct xfrm_tmpl *tmpl, struct xfrm_state *x, unsigned short
}
#ifdef CONFIG_XFRM
+/*
+ * For transport, the policy is checked before the presumed more expensive
+ * checksum. The transport header has already been checked for size, and is
+ * guaranteed to be contiguous. These policies must not alter the header or
+ * its position in the buffer, and should not shorten the buffer length
+ * without ensuring the length remains >= the header size.
+ */
extern int __xfrm_policy_check(struct sock *, int dir, struct sk_buff *skb, unsigned short family);
static inline int __xfrm_policy_check2(struct sock *sk, int dir,
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 65b8ebf..0a76e41 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1559,7 +1559,8 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
return 0;
}
- if (skb->len < tcp_hdrlen(skb) || tcp_checksum_complete(skb))
+ /* Assumes header and options unchanged since checksum_init() */
+ if (tcp_checksum_complete(skb))
goto csum_err;
if (sk->sk_state == TCP_LISTEN) {
@@ -1601,14 +1602,13 @@ csum_err:
}
/*
- * From tcp_input.c
+ * Called by ip_input.c: ip_local_deliver_finish()
*/
-
int tcp_v4_rcv(struct sk_buff *skb)
{
- const struct iphdr *iph;
struct tcphdr *th;
struct sock *sk;
+ int tcp_header_len;
int ret;
struct net *net = dev_net(skb->dev);
@@ -1618,31 +1618,33 @@ int tcp_v4_rcv(struct sk_buff *skb)
/* Count it even if it's bad */
TCP_INC_STATS_BH(net, TCP_MIB_INSEGS);
+ /* Check too short header */
if (!pskb_may_pull(skb, sizeof(struct tcphdr)))
goto discard_it;
- th = tcp_hdr(skb);
-
- if (th->doff < sizeof(struct tcphdr) / 4)
+ /* Check bad doff, compare doff directly to constant value */
+ tcp_header_len = tcp_hdr(skb)->doff;
+ if (tcp_header_len < (sizeof(struct tcphdr) / 4))
goto bad_packet;
- if (!pskb_may_pull(skb, th->doff * 4))
+
+ /* Check too short header and options */
+ tcp_header_len *= 4;
+ if (!pskb_may_pull(skb, tcp_header_len))
goto discard_it;
- /* An explanation is required here, I think.
- * Packet length and doff are validated by header prediction,
- * provided case of th->doff==0 is eliminated.
- * So, we defer the checks. */
+ /* Packet length and doff are validated by header prediction,
+ * provided case of th->doff == 0 is eliminated (above).
+ */
if (!skb_csum_unnecessary(skb) && tcp_v4_checksum_init(skb))
goto bad_packet;
th = tcp_hdr(skb);
- iph = ip_hdr(skb);
TCP_SKB_CB(skb)->seq = ntohl(th->seq);
TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin +
- skb->len - th->doff * 4);
+ skb->len - tcp_header_len);
TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq);
TCP_SKB_CB(skb)->when = 0;
- TCP_SKB_CB(skb)->flags = iph->tos;
+ TCP_SKB_CB(skb)->flags = ip_hdr(skb)->tos;
TCP_SKB_CB(skb)->sacked = 0;
sk = __inet_lookup_skb(&tcp_hashinfo, skb, th->source, th->dest);
@@ -1682,14 +1684,14 @@ process:
bh_unlock_sock(sk);
sock_put(sk);
-
return ret;
no_tcp_socket:
if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb))
goto discard_it;
- if (skb->len < (th->doff << 2) || tcp_checksum_complete(skb)) {
+ /* Assumes header and options unchanged since checksum_init() */
+ if (tcp_checksum_complete(skb)) {
bad_packet:
TCP_INC_STATS_BH(net, TCP_MIB_INERRS);
} else {
@@ -1711,18 +1713,21 @@ do_time_wait:
goto discard_it;
}
- if (skb->len < (th->doff << 2) || tcp_checksum_complete(skb)) {
+ /* Assumes header and options unchanged since checksum_init() */
+ if (tcp_checksum_complete(skb)) {
TCP_INC_STATS_BH(net, TCP_MIB_INERRS);
inet_twsk_put(inet_twsk(sk));
goto discard_it;
}
+
switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) {
case TCP_TW_SYN: {
struct sock *sk2 = inet_lookup_listener(dev_net(skb->dev),
&tcp_hashinfo,
- iph->daddr, th->dest,
+ ip_hdr(skb)->daddr,
+ th->dest,
inet_iif(skb));
- if (sk2) {
+ if (sk2 != NULL) {
inet_twsk_deschedule(inet_twsk(sk), &tcp_death_row);
inet_twsk_put(inet_twsk(sk));
sk = sk2;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index febfd59..b76939a 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1594,7 +1594,8 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
return 0;
}
- if (skb->len < tcp_hdrlen(skb) || tcp_checksum_complete(skb))
+ /* Assumes header and options unchanged since checksum_init() */
+ if (tcp_checksum_complete(skb))
goto csum_err;
if (sk->sk_state == TCP_LISTEN) {
@@ -1664,38 +1665,47 @@ ipv6_pktoptions:
return 0;
}
+/*
+ * Called by ip6_input.c: ip6_input_finish()
+ */
static int tcp_v6_rcv(struct sk_buff *skb)
{
struct tcphdr *th;
struct sock *sk;
+ int tcp_header_len;
int ret;
struct net *net = dev_net(skb->dev);
if (skb->pkt_type != PACKET_HOST)
goto discard_it;
- /*
- * Count it even if it's bad.
- */
+ /* Count it even if it's bad */
TCP_INC_STATS_BH(net, TCP_MIB_INSEGS);
+ /* Check too short header */
if (!pskb_may_pull(skb, sizeof(struct tcphdr)))
goto discard_it;
- th = tcp_hdr(skb);
-
- if (th->doff < sizeof(struct tcphdr)/4)
+ /* Check bad doff, compare doff directly to constant value */
+ tcp_header_len = tcp_hdr(skb)->doff;
+ if (tcp_header_len < (sizeof(struct tcphdr) / 4))
goto bad_packet;
- if (!pskb_may_pull(skb, th->doff*4))
+
+ /* Check too short header and options */
+ tcp_header_len *= 4;
+ if (!pskb_may_pull(skb, tcp_header_len))
goto discard_it;
+ /* Packet length and doff are validated by header prediction,
+ * provided case of th->doff == 0 is eliminated (above).
+ */
if (!skb_csum_unnecessary(skb) && tcp_v6_checksum_init(skb))
goto bad_packet;
th = tcp_hdr(skb);
TCP_SKB_CB(skb)->seq = ntohl(th->seq);
TCP_SKB_CB(skb)->end_seq = (TCP_SKB_CB(skb)->seq + th->syn + th->fin +
- skb->len - th->doff*4);
+ skb->len - tcp_header_len);
TCP_SKB_CB(skb)->ack_seq = ntohl(th->ack_seq);
TCP_SKB_CB(skb)->when = 0;
TCP_SKB_CB(skb)->flags = ipv6_get_dsfield(ipv6_hdr(skb));
@@ -1711,6 +1721,7 @@ process:
if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))
goto discard_and_relse;
+ /* nf_reset(skb); in ip6_input.c ip6_input_finish() */
if (sk_filter(sk, skb))
goto discard_and_relse;
@@ -1743,7 +1754,8 @@ no_tcp_socket:
if (!xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb))
goto discard_it;
- if (skb->len < (th->doff<<2) || tcp_checksum_complete(skb)) {
+ /* Assumes header and options unchanged since checksum_init() */
+ if (tcp_checksum_complete(skb)) {
bad_packet:
TCP_INC_STATS_BH(net, TCP_MIB_INERRS);
} else {
@@ -1751,11 +1763,7 @@ bad_packet:
}
discard_it:
-
- /*
- * Discard frame
- */
-
+ /* Discard frame. */
kfree_skb(skb);
return 0;
@@ -1769,24 +1777,23 @@ do_time_wait:
goto discard_it;
}
- if (skb->len < (th->doff<<2) || tcp_checksum_complete(skb)) {
+ /* Assumes header and options unchanged since checksum_init() */
+ if (tcp_checksum_complete(skb)) {
TCP_INC_STATS_BH(net, TCP_MIB_INERRS);
inet_twsk_put(inet_twsk(sk));
goto discard_it;
}
switch (tcp_timewait_state_process(inet_twsk(sk), skb, th)) {
- case TCP_TW_SYN:
- {
- struct sock *sk2;
-
- sk2 = inet6_lookup_listener(dev_net(skb->dev), &tcp_hashinfo,
- &ipv6_hdr(skb)->daddr,
- ntohs(th->dest), inet6_iif(skb));
+ case TCP_TW_SYN: {
+ struct sock *sk2 = inet6_lookup_listener(dev_net(skb->dev),
+ &tcp_hashinfo,
+ &ipv6_hdr(skb)->daddr,
+ ntohs(th->dest),
+ inet6_iif(skb));
if (sk2 != NULL) {
- struct inet_timewait_sock *tw = inet_twsk(sk);
- inet_twsk_deschedule(tw, &tcp_death_row);
- inet_twsk_put(tw);
+ inet_twsk_deschedule(inet_twsk(sk), &tcp_death_row);
+ inet_twsk_put(inet_twsk(sk));
sk = sk2;
goto process;
}
--
1.6.3.3
^ permalink raw reply related
* [PATCH v4 4/6] tcp: input header length, prediction, and timestamp bugs
From: William Allen Simpson @ 2010-02-10 21:15 UTC (permalink / raw)
To: Linux Kernel Developers, Linux Kernel Network Developers
Cc: Andrew Morton, Andi Kleen
In-Reply-To: <4B731D61.2080603@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1871 bytes --]
Fix incorrect header prediction flags documentation.
Relieve register pressure in (the i386) fast path by accessing skb->len
directly, instead of carrying a rarely used len parameter.
Eliminate unused len parameters in two other functions.
Don't use output calculated tp->tcp_header_len for input decisions.
While the output header is usually the same as the input (same options
in both directions), that's a poor assumption. In particular, Sack will
be different. Newer options are not guaranteed.
Moreover, in the fast path, that only saved a shift or two. The other
efficiencies in this patch more than make up the difference.
Instead, use tp->rx_opt.tstamp_ok to accurately predict header length.
Likewise, use tp->rx_opt.tstamp_ok for received MSS calculations.
Don't use "sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED" to guess that
the timestamp is present. This may have been OK in the days with fewer
possible options, but various combinations of newer options may yield
the same header length. (This bug is in 3 places.)
Instead, use tp->rx_opt.saw_tstamp to determine a timestamp is present.
There's no need to test buffer length against header length, already
checked by tcp_v[4,6]_rcv(). Straighten code for minor efficiency gain.
Stand-alone patch, originally developed for TCPCT.
Requires:
net: tcp_header_len_th and tcp_option_len_th
tcp: harmonize tcp_vx_rcv header length assumptions
Signed-off-by: William.Allen.Simpson@gmail.com
CC: Andi Kleen <andi@firstfloor.org>
---
include/linux/tcp.h | 6 ++-
include/net/tcp.h | 15 +++++--
net/ipv4/tcp_input.c | 94 ++++++++++++++++++----------------------------
net/ipv4/tcp_ipv4.c | 4 +-
net/ipv4/tcp_minisocks.c | 3 +-
net/ipv4/tcp_probe.c | 2 +-
net/ipv6/tcp_ipv6.c | 4 +-
7 files changed, 58 insertions(+), 70 deletions(-)
[-- Attachment #2: len_th+2d4+2.6.33-rc7.patch --]
[-- Type: text/plain, Size: 9932 bytes --]
diff --git a/include/linux/tcp.h b/include/linux/tcp.h
index 74728f7..2987ee8 100644
--- a/include/linux/tcp.h
+++ b/include/linux/tcp.h
@@ -301,7 +301,11 @@ struct tcp_sock {
/*
* Header prediction flags
- * 0x5?10 << 16 + snd_wnd in net byte order
+ * S << 28 + TCP_FLAG_ACK + snd_wnd, in net byte order
+ * (PSH flag is ignored)
+ * S is 5 (no options), or 8 (timestamp aligned)
+ * otherwise, 0 to turn it off -- for instance, when there are
+ * holes in receive space.
*/
__be32 pred_flags;
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 34f5cc2..6b0d7e9 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -310,13 +310,11 @@ extern int tcp_ioctl(struct sock *sk,
extern int tcp_rcv_state_process(struct sock *sk,
struct sk_buff *skb,
- struct tcphdr *th,
- unsigned len);
+ struct tcphdr *th);
extern int tcp_rcv_established(struct sock *sk,
struct sk_buff *skb,
- struct tcphdr *th,
- unsigned len);
+ struct tcphdr *th);
extern void tcp_rcv_space_adjust(struct sock *sk);
@@ -533,9 +531,16 @@ static inline u32 __tcp_set_rto(const struct tcp_sock *tp)
return (tp->srtt >> 3) + tp->rttvar;
}
+static inline u16 __tcp_fast_path_header_length(const struct tcp_sock *tp)
+{
+ return tp->rx_opt.tstamp_ok
+ ? sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED
+ : sizeof(struct tcphdr);
+}
+
static inline void __tcp_fast_path_on(struct tcp_sock *tp, u32 snd_wnd)
{
- tp->pred_flags = htonl((tp->tcp_header_len << 26) |
+ tp->pred_flags = htonl((__tcp_fast_path_header_length(tp) << (28 - 2)) |
ntohl(TCP_FLAG_ACK) |
snd_wnd);
}
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 28e0296..8e0f6ae 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -152,7 +152,7 @@ static void tcp_measure_rcv_mss(struct sock *sk, const struct sk_buff *skb)
* tcp header plus fixed timestamp option length.
* Resulting "len" is MSS free of SACK jitter.
*/
- len -= tcp_sk(sk)->tcp_header_len;
+ len -= __tcp_fast_path_header_length(tcp_sk(sk));
icsk->icsk_ack.last_seg_size = len;
if (len == lss) {
icsk->icsk_ack.rcv_mss = len;
@@ -5206,7 +5206,7 @@ discard:
* tcp_data_queue when everything is OK.
*/
int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
- struct tcphdr *th, unsigned len)
+ struct tcphdr *th)
{
struct tcp_sock *tp = tcp_sk(sk);
int res;
@@ -5225,31 +5225,15 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
* extra cost of the net_bh soft interrupt processing...
* We do checksum and copy also but from device to kernel.
*/
-
- tp->rx_opt.saw_tstamp = 0;
-
- /* pred_flags is 0xS?10 << 16 + snd_wnd
- * if header_prediction is to be made
- * 'S' will always be tp->tcp_header_len >> 2
- * '?' will be 0 for the fast path, otherwise pred_flags is 0 to
- * turn it off (when there are holes in the receive
- * space for instance)
- * PSH flag is ignored.
- */
-
if ((tcp_flag_word(th) & TCP_HP_BITS) == tp->pred_flags &&
TCP_SKB_CB(skb)->seq == tp->rcv_nxt &&
!after(TCP_SKB_CB(skb)->ack_seq, tp->snd_nxt)) {
- int tcp_header_len = tp->tcp_header_len;
-
- /* Timestamp header prediction: tcp_header_len
- * is automatically equal to th->doff*4 due to pred_flags
- * match.
- */
+ int tcp_header_len = tcp_header_len_th(th);
- /* Check timestamp */
- if (tcp_header_len == sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) {
- /* No? Slow path! */
+ /* Timestamp header prediction */
+ if (tcp_header_len != sizeof(*th) + TCPOLEN_TSTAMP_ALIGNED) {
+ tp->rx_opt.saw_tstamp = 0; /* false */
+ } else {
if (!tcp_parse_aligned_timestamp(tp, th))
goto slow_path;
@@ -5264,35 +5248,12 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
*/
}
- if (len <= tcp_header_len) {
- /* Bulk data transfer: sender */
- if (len == tcp_header_len) {
- /* Predicted packet is in window by definition.
- * seq == rcv_nxt and rcv_wup <= rcv_nxt.
- * Hence, check seq<=rcv_wup reduces to:
- */
- if (tcp_header_len ==
- (sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) &&
- tp->rcv_nxt == tp->rcv_wup)
- tcp_store_ts_recent(tp);
-
- /* We know that such packets are checksummed
- * on entry.
- */
- tcp_ack(sk, skb, 0);
- __kfree_skb(skb);
- tcp_data_snd_check(sk);
- return 0;
- } else { /* Header too small */
- TCP_INC_STATS_BH(sock_net(sk), TCP_MIB_INERRS);
- goto discard;
- }
- } else {
+ if (tcp_header_len < skb->len) {
int eaten = 0;
int copied_early = 0;
if (tp->copied_seq == tp->rcv_nxt &&
- len - tcp_header_len <= tp->ucopy.len) {
+ skb->len - tcp_header_len <= tp->ucopy.len) {
#ifdef CONFIG_NET_DMA
if (tcp_dma_try_early_copy(sk, skb, tcp_header_len)) {
copied_early = 1;
@@ -5311,9 +5272,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
* seq == rcv_nxt and rcv_wup <= rcv_nxt.
* Hence, check seq<=rcv_wup reduces to:
*/
- if (tcp_header_len ==
- (sizeof(struct tcphdr) +
- TCPOLEN_TSTAMP_ALIGNED) &&
+ if (tp->rx_opt.saw_tstamp &&
tp->rcv_nxt == tp->rcv_wup)
tcp_store_ts_recent(tp);
@@ -5334,8 +5293,7 @@ int tcp_rcv_established(struct sock *sk, struct sk_buff *skb,
* seq == rcv_nxt and rcv_wup <= rcv_nxt.
* Hence, check seq<=rcv_wup reduces to:
*/
- if (tcp_header_len ==
- (sizeof(struct tcphdr) + TCPOLEN_TSTAMP_ALIGNED) &&
+ if (tp->rx_opt.saw_tstamp &&
tp->rcv_nxt == tp->rcv_wup)
tcp_store_ts_recent(tp);
@@ -5376,11 +5334,33 @@ no_ack:
else
sk->sk_data_ready(sk, 0);
return 0;
+ } else {
+ /* Bulk data transfer: sender
+ *
+ * tcp_header_len > skb->len never happens,
+ * already checked by tcp_v[4,6]_rcv()
+ *
+ * Predicted packet is in window by definition.
+ * seq == rcv_nxt and rcv_wup <= rcv_nxt.
+ * Hence, check seq<=rcv_wup reduces to:
+ */
+ if (tp->rx_opt.saw_tstamp &&
+ tp->rcv_nxt == tp->rcv_wup)
+ tcp_store_ts_recent(tp);
+
+ /* We know that such packets are checksummed
+ * on entry.
+ */
+ tcp_ack(sk, skb, 0);
+ __kfree_skb(skb);
+ tcp_data_snd_check(sk);
+ return 0;
}
}
slow_path:
- if (len < (th->doff << 2) || tcp_checksum_complete_user(sk, skb))
+ /* Assumes header and options unchanged since checksum_init() */
+ if (tcp_checksum_complete_user(sk, skb))
goto csum_error;
/*
@@ -5416,7 +5396,7 @@ discard:
}
static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
- struct tcphdr *th, unsigned len)
+ struct tcphdr *th)
{
u8 *hash_location;
struct inet_connection_sock *icsk = inet_csk(sk);
@@ -5693,7 +5673,7 @@ reset_and_undo:
*/
int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
- struct tcphdr *th, unsigned len)
+ struct tcphdr *th)
{
struct tcp_sock *tp = tcp_sk(sk);
struct inet_connection_sock *icsk = inet_csk(sk);
@@ -5740,7 +5720,7 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb,
goto discard;
case TCP_SYN_SENT:
- queued = tcp_rcv_synsent_state_process(sk, skb, th, len);
+ queued = tcp_rcv_synsent_state_process(sk, skb, th);
if (queued >= 0)
return queued;
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 0a76e41..f999e06 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1551,7 +1551,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */
TCP_CHECK_TIMER(sk);
- if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len)) {
+ if (tcp_rcv_established(sk, skb, tcp_hdr(skb))) {
rsk = sk;
goto reset;
}
@@ -1578,7 +1578,7 @@ int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
}
TCP_CHECK_TIMER(sk);
- if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len)) {
+ if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb))) {
rsk = sk;
goto reset;
}
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index f206ee5..37b7536 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -718,8 +718,7 @@ int tcp_child_process(struct sock *parent, struct sock *child,
int state = child->sk_state;
if (!sock_owned_by_user(child)) {
- ret = tcp_rcv_state_process(child, skb, tcp_hdr(skb),
- skb->len);
+ ret = tcp_rcv_state_process(child, skb, tcp_hdr(skb));
/* Wakeup parent, send SIGIO */
if (state == TCP_SYN_RECV && child->sk_state != state)
parent->sk_data_ready(parent, 0);
diff --git a/net/ipv4/tcp_probe.c b/net/ipv4/tcp_probe.c
index 9bc805d..de2a32e 100644
--- a/net/ipv4/tcp_probe.c
+++ b/net/ipv4/tcp_probe.c
@@ -88,7 +88,7 @@ static inline int tcp_probe_avail(void)
* Note: arguments must match tcp_rcv_established()!
*/
static int jtcp_rcv_established(struct sock *sk, struct sk_buff *skb,
- struct tcphdr *th, unsigned len)
+ struct tcphdr *th)
{
const struct tcp_sock *tp = tcp_sk(sk);
const struct inet_sock *inet = inet_sk(sk);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index b76939a..3d08a4d 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1586,7 +1586,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */
TCP_CHECK_TIMER(sk);
- if (tcp_rcv_established(sk, skb, tcp_hdr(skb), skb->len))
+ if (tcp_rcv_established(sk, skb, tcp_hdr(skb)))
goto reset;
TCP_CHECK_TIMER(sk);
if (opt_skb)
@@ -1618,7 +1618,7 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
}
TCP_CHECK_TIMER(sk);
- if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb), skb->len))
+ if (tcp_rcv_state_process(sk, skb, tcp_hdr(skb)))
goto reset;
TCP_CHECK_TIMER(sk);
if (opt_skb)
--
1.6.3.3
^ permalink raw reply related
* Re: Flooded with bonding: bond0: doing slave updates when interface is down.
From: Jay Vosburgh @ 2010-02-10 21:15 UTC (permalink / raw)
To: Ferenc Wagner; +Cc: netdev
In-Reply-To: <87mxzj6eyx.fsf@tac.ki.iif.hu>
Ferenc Wagner <wferi@niif.hu> wrote:
>Hi,
>
>On a system running Linux 2.6.32.7 I use the following initramfs script
>to bring up some interfaces before mounting the root filesystem:
>
>---------- /etc/initramfs-tools/scripts/init-premount/net_up ----------
>#!/bin/sh
>
>PREREQ="udev"
>prereqs()
>{
> echo "$PREREQ"
>}
>
>case $1 in
>prereqs)
> prereqs
> exit 0
> ;;
>esac
>
>. /scripts/functions
>
>maybe_break pre-netup
>
># Arguments: DEV IP/MASKLEN
>ifup()
>{
> ip addr add $2 dev $1
> ip link set up dev $1
> echo "Configured $1 with address $2"
>}
>
>BOND=bond0
>
>modprobe bonding
>cd /sys/class/net/$BOND/bonding
>
>echo active-backup >mode
>echo +eth0 >slaves
>echo +eth1 >slaves
>echo eth0 >primary
>echo +10.0.0.1 >arp_ip_target
>echo +10.0.0.2 >arp_ip_target
>echo 1000 >arp_interval
>
>vconfig set_name_type VLAN_PLUS_VID_NO_PAD
>vconfig add $BOND 39
>
>eval $(getprops) || { panic "MAC of eth0 unknown, aborting."; halt; }
>
>ifup $BOND $MYVLAN2
>ifup vlan39 $MYVLAN39
>
>ip addr
>
>maybe_break post-netup
>-----------------------------------------------------------------------
>
>The eval $(getprops) command sets the MYVLANx variables depending on the
>MAC address of eth0. This stuff mostly works as expected, but sometimes
>I get this on the console:
>
>[ 27.792746] Ethernet Channel Bonding Driver: v3.5.0 (November 4, 2008)
>[ 27.831788] bonding: Warning: either miimon or arp_interval and arp_ip_target module parameters must be specified, otherwise bonding will not detect link failures! see bonding.txt for details.
>[ 27.935640] bonding: bond0: setting mode to active-backup (1).
>[ 27.970565] bonding: bond0: doing slave updates when interface is down.
>[ 28.010110] bonding: bond0: Adding slave eth0.
>[ 28.036651] bonding bond0: master_dev is not up in bond_enslave
>[ 28.137410] bonding: bond0: Warning: failed to get speed and duplex from eth0, assumed to be 100Mb/sec and Full.
>[ 28.198298] bonding: bond0: making interface eth0 the new active one.
>[ 28.236806] bonding: bond0: first active interface up!
>[ 28.267515] bonding: bond0: enslaving eth0 as an active interface with an up link.
>[ 28.312847] bonding: bond0: doing slave updates when interface is down.
>[ 28.352397] bonding: bond0: doing slave updates when interface is down.
>[ 28.391941] bonding: bond0: doing slave updates when interface is down.
>[ 28.431482] bonding: bond0: doing slave updates when interface is down.
>[ 28.471023] bonding: bond0: doing slave updates when interface is down.
>[ 28.510566] bonding: bond0: doing slave updates when interface is down.
>[ 28.550111] bonding: bond0: doing slave updates when interface is down.
>[ 28.589652] bonding: bond0: doing slave updates when interface is down.
>[ 28.629197] bonding: bond0: doing slave updates when interface is down.
>[ 28.668740] bonding: bond0: doing slave updates when interface is down.
>[ 28.708282] bonding: bond0: doing slave updates when interface is down.
>[ 28.749653] bonding: bond0: doing slave updates when interface is down.
>[ 28.789195] bonding: bond0: doing slave updates when interface is down.
>[ 28.828738] bonding: bond0: doing slave updates when interface is down.
>[ 28.868280] bonding: bond0: doing slave updates when interface is down.
>[ 28.907823] bonding: bond0: doing slave updates when interface is down.
>[ 28.947364] bonding: bond0: doing slave updates when interface is down.
>[ 28.986907] bonding: bond0: doing slave updates when interface is down.
>[ 29.026450] bonding: bond0: doing slave updates when interface is down.
>[ 29.065994] bonding: bond0: doing slave updates when interface is down.
>[ 29.105535] bonding: bond0: doing slave updates when interface is down.
>[ 29.145172] tg3: eth0: Link is up at 1000 Mbps, full duplex.
>[ 29.178990] tg3: eth0: Flow control is off for TX and off for RX.
>[ 29.215415] bonding: bond0: doing slave updates when interface is down.
>[ 29.254956] bonding: bond0: doing slave updates when interface is down.
>[ 29.294496] bonding: bond0: doing slave updates when interface is down.
>[ 29.334038] bonding: bond0: doing slave updates when interface is down.
>[ 29.373581] bonding: bond0: doing slave updates when interface is down.
>[ 29.413122] bonding: bond0: doing slave updates when interface is down.
>[ 29.452663] bonding: bond0: doing slave updates when interface is down.
>[ 29.492205] bonding: bond0: doing slave updates when interface is down.
>[ 29.531748] bonding: bond0: doing slave updates when interface is down.
>[...]
>[ 78.580920] bonding: bond0: doing slave updates when interface is down.
>[ 78.620463] bonding: bond0: doing slave updates when interface is down.
>[ 78.660009] bonding: bond0: doing slave updates when interface is down.
>[ 78.699825] bonding: bond0: doing slave updates when interface is down.
>[ 78.739373] bonding: bond0: Adding slave eth1.
>[ 78.765914] bonding bond0: master_dev is not up in bond_enslave
>[ 78.817517] tg3 0000:05:01.1: firmware: requesting tigon/tg3_tso.bin
>[ 78.919759] bonding: bond0: Warning: failed to get speed and duplex from eth1, assumed to be 100Mb/sec and Full.
>[ 78.980658] bonding: bond0: enslaving eth1 as a backup interface with an up link.
>[ 79.025492] bonding: bond0: Setting eth0 as primary slave.
>[ 79.058351] bonding: bond0: adding ARP target 10.0.0.1.
>[ 79.089601] bonding: bond0: adding ARP target 10.0.0.2.
>[ 79.120855] bonding: bond0: Setting ARP monitoring interval to 1000.
>[ 79.167280] 802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
>[ 79.208621] All bugs added by David S. Miller <davem@redhat.com>
>[ 79.259000] bonding: bond0: no route to arp_ip_target 10.0.0.1
>
>In the end, everything seems to be all right, but this occasional
>interlude is disturbing and seems to indicate that something isn't quite
>right. Which may well be my abuse of the bonding driver, but then
>please enlighten me, as I'd like to eliminate this 50-second delay from
>the boot procedure. I don't mind the couple of "doing slave updates
>when interface is down" warnings which appear during the normal course
>of actions, but the above is way too much in my opinion.
The message itself means that you're adding a slave to bonding
while the bond itself is down. It's a warning only; the path through
the function doesn't change when the warning is printed.
I would hazard to guess that you're getting zillions of them
because something is holding rtnl, and the bonding sysfs store function
conditionally acquires rtnl after printing the warning. If the rtnl
acquisition fails, the system call is restarted, and you'll see the
warning message again. This rtnl_trylock/restart business is to prevent
a deadlock during unregister.
I don't know why this repeats for 50-odd seconds, though.
Nothing should be holding rtnl for that long.
Do you still get the long delay if you set the bond up prior to
adding the slaves? Not necessarily assign an address, just set it
administratively up (ip link set up dev bond0).
-J
---
-Jay Vosburgh, IBM Linux Technology Center, fubar@us.ibm.com
^ permalink raw reply
* Re: [PATCH 2/6] DMFE: move pci ID definitions into pci_ids.h and clean up the code
From: David Miller @ 2010-02-10 21:18 UTC (permalink / raw)
To: maximlevitsky; +Cc: netdev, linux-kernel, maxim-levitsky
In-Reply-To: <1265487542-4447-3-git-send-email-maximlevitsky@gmail.com>
From: Maxim Levitsky <maximlevitsky@gmail.com>
Date: Sat, 6 Feb 2010 22:18:58 +0200
> Signed-off-by: Maxim Levitsky <maxim-levitsky@gmail.com>
We don't add new definitions to pci_ids.h that will only
be used in a single driver.
Instead, we just use the raw constants (if it's only referenced once,
say in the PCI ID table for the driver) or using local definitions
(if used multiple times in the driver).
^ permalink raw reply
* Re: [PATCH 2/6] DMFE: move pci ID definitions into pci_ids.h and clean up the code
From: David Miller @ 2010-02-10 21:22 UTC (permalink / raw)
To: maximlevitsky; +Cc: netdev, linux-kernel, maxim-levitsky
In-Reply-To: <20100210.131849.237007566.davem@davemloft.net>
From: David Miller <davem@davemloft.net>
Date: Wed, 10 Feb 2010 13:18:49 -0800 (PST)
> From: Maxim Levitsky <maximlevitsky@gmail.com>
> Date: Sat, 6 Feb 2010 22:18:58 +0200
>
>> Signed-off-by: Maxim Levitsky <maxim-levitsky@gmail.com>
>
> We don't add new definitions to pci_ids.h that will only
> be used in a single driver.
>
> Instead, we just use the raw constants (if it's only referenced once,
> say in the PCI ID table for the driver) or using local definitions
> (if used multiple times in the driver).
BTW, the rest of your patch set is likely to not apply
correctly after you fix this patch up. So at a minimum
you'll need to resubmit this whole set after fixing
patch #2.
In fact I would recommend that you seperate the bug
fixes from all of the massive cleanups.
Get the bug fixes, especially the PCI READ MULTIPLE
disable one, into net-2.6
Then afterwards you can do all of the cleanups against
net-next-2.6 when the bug fixes propagate there.
Thank you!
^ permalink raw reply
* [PATCH v3 5/6] TCPCT part 2e: accept SYNACK data
From: William Allen Simpson @ 2010-02-10 21:27 UTC (permalink / raw)
To: Linux Kernel Developers, Linux Kernel Network Developers; +Cc: Andrew Morton
In-Reply-To: <4B731D61.2080603@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 709 bytes --]
When accompanied by cookie option, Initiator (client) queues incoming
SYNACK transaction data.
This is a straightforward re-implementation of an earlier (year-old)
patch that no longer applies cleanly, with permission of the original
author (Adam Langley). The patch was previously reviewed:
http://thread.gmane.org/gmane.linux.network/102586
This function will also be used in subsequent patches that implement
additional features.
Requires:
TCPCT part 1g: Responder Cookie => Initiator
net: tcp_header_len_th and tcp_option_len_th
Signed-off-by: William.Allen.Simpson@gmail.com
---
net/ipv4/tcp_input.c | 26 +++++++++++++++++++++++++-
1 files changed, 25 insertions(+), 1 deletions(-)
[-- Attachment #2: TCPCT+2e3+2.6.33-rc7.patch --]
[-- Type: text/plain, Size: 2057 bytes --]
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 8e0f6ae..165040e 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -5395,6 +5395,12 @@ discard:
return 0;
}
+/*
+ * Returns:
+ * +1 on reset,
+ * 0 success and/or SYNACK data,
+ * -1 on discard.
+ */
static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
struct tcphdr *th)
{
@@ -5403,6 +5409,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
struct tcp_sock *tp = tcp_sk(sk);
struct tcp_cookie_values *cvp = tp->cookie_values;
int saved_clamp = tp->rx_opt.mss_clamp;
+ int queued = 0;
tcp_parse_options(skb, &tp->rx_opt, &hash_location, 0);
@@ -5509,6 +5516,7 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
- TCPOLEN_COOKIE_BASE;
int cookie_pair_size = cookie_size
+ cvp->cookie_desired;
+ int tcp_header_len = tcp_header_len_th(th);
/* A cookie extension option was sent and returned.
* Note that each incoming SYNACK replaces the
@@ -5524,6 +5532,19 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
hash_location, cookie_size);
cvp->cookie_pair_size = cookie_pair_size;
}
+
+ queued = skb->len - tcp_header_len;
+ if (queued > 0) {
+ /* Queue incoming transaction data. */
+ __skb_pull(skb, tcp_header_len);
+ __skb_queue_tail(&sk->sk_receive_queue, skb);
+ skb_set_owner_r(skb, sk);
+ sk->sk_data_ready(sk, 0);
+ cvp->s_data_in = 1; /* true */
+ tp->rcv_nxt = TCP_SKB_CB(skb)->end_seq;
+ tp->rcv_wup = TCP_SKB_CB(skb)->end_seq;
+ tp->copied_seq = TCP_SKB_CB(skb)->seq + 1;
+ }
}
smp_mb();
@@ -5577,11 +5598,14 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
TCP_DELACK_MAX, TCP_RTO_MAX);
discard:
- __kfree_skb(skb);
+ if (queued <= 0)
+ __kfree_skb(skb);
return 0;
} else {
tcp_send_ack(sk);
}
+ if (queued > 0)
+ return 0;
return -1;
}
--
1.6.3.3
^ permalink raw reply related
* [PATCH v3 6/6] TCPCT part 2f: cleanup tcp_parse_options
From: William Allen Simpson @ 2010-02-10 21:29 UTC (permalink / raw)
To: Linux Kernel Developers, Linux Kernel Network Developers; +Cc: Andrew Morton
In-Reply-To: <4B731D61.2080603@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 623 bytes --]
Split switch, shift cases to the left, fix most lines beyond column 80.
Prepare (future) error return.
Requires:
TCPCT part 1g: Responder Cookie => Initiator
net: tcp_header_len_th and tcp_option_len_th
Signed-off-by: William.Allen.Simpson@gmail.com
---
include/net/tcp.h | 3 +-
net/ipv4/syncookies.c | 5 +-
net/ipv4/tcp_input.c | 217 ++++++++++++++++++++++++++--------------------
net/ipv4/tcp_ipv4.c | 10 ++-
net/ipv4/tcp_minisocks.c | 14 ++-
net/ipv6/syncookies.c | 5 +-
net/ipv6/tcp_ipv6.c | 6 +-
7 files changed, 154 insertions(+), 106 deletions(-)
[-- Attachment #2: TCPCT+2f3+2.6.33-rc7.patch --]
[-- Type: text/plain, Size: 13523 bytes --]
diff --git a/include/net/tcp.h b/include/net/tcp.h
index 6b0d7e9..420e872 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -403,7 +403,8 @@ extern int tcp_recvmsg(struct kiocb *iocb, struct sock *sk,
size_t len, int nonblock,
int flags, int *addr_len);
-extern void tcp_parse_options(struct sk_buff *skb,
+extern int tcp_parse_options(struct sk_buff *skb,
+ const struct tcphdr *th,
struct tcp_options_received *opt_rx,
u8 **hvpp,
int estab);
diff --git a/net/ipv4/syncookies.c b/net/ipv4/syncookies.c
index 66fd80e..3bed530 100644
--- a/net/ipv4/syncookies.c
+++ b/net/ipv4/syncookies.c
@@ -254,6 +254,7 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
struct ip_options *opt)
{
struct tcp_options_received tcp_opt;
+ int parsed;
u8 *hash_location;
struct inet_request_sock *ireq;
struct tcp_request_sock *treq;
@@ -279,7 +280,9 @@ struct sock *cookie_v4_check(struct sock *sk, struct sk_buff *skb,
/* check for timestamp cookie support */
memset(&tcp_opt, 0, sizeof(tcp_opt));
- tcp_parse_options(skb, &tcp_opt, &hash_location, 0);
+ parsed = tcp_parse_options(skb, th, &tcp_opt, &hash_location, 0);
+ if (parsed < 0)
+ goto out;
if (tcp_opt.saw_tstamp)
cookie_check_timestamp(&tcp_opt);
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c
index 165040e..d3c6c7a 100644
--- a/net/ipv4/tcp_input.c
+++ b/net/ipv4/tcp_input.c
@@ -3726,15 +3726,14 @@ old_ack:
* But, this can also be called on packets in the established flow when
* the fast version below fails.
*/
-void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx,
- u8 **hvpp, int estab)
+int tcp_parse_options(struct sk_buff *skb, const struct tcphdr *th,
+ struct tcp_options_received *opt_rx, u8 **hvpp, int estab)
{
- unsigned char *ptr;
- struct tcphdr *th = tcp_hdr(skb);
- int length = (th->doff * 4) - sizeof(struct tcphdr);
+ unsigned char *ptr = (unsigned char *)(th + 1);
+ int length = tcp_option_len_th(th);
- ptr = (unsigned char *)(th + 1);
- opt_rx->saw_tstamp = 0;
+ opt_rx->cookie_plus = 0;
+ opt_rx->saw_tstamp = 0; /* false */
while (length > 0) {
int opcode = *ptr++;
@@ -3742,106 +3741,130 @@ void tcp_parse_options(struct sk_buff *skb, struct tcp_options_received *opt_rx,
switch (opcode) {
case TCPOPT_EOL:
- return;
+ return 0;
case TCPOPT_NOP: /* Ref: RFC 793 section 3.1 */
length--;
continue;
default:
- opsize = *ptr++;
- if (opsize < 2) /* "silly options" */
- return;
- if (opsize > length)
- return; /* don't parse partial options */
- switch (opcode) {
- case TCPOPT_MSS:
- if (opsize == TCPOLEN_MSS && th->syn && !estab) {
- u16 in_mss = get_unaligned_be16(ptr);
- if (in_mss) {
- if (opt_rx->user_mss &&
- opt_rx->user_mss < in_mss)
- in_mss = opt_rx->user_mss;
- opt_rx->mss_clamp = in_mss;
- }
- }
- break;
- case TCPOPT_WINDOW:
- if (opsize == TCPOLEN_WINDOW && th->syn &&
- !estab && sysctl_tcp_window_scaling) {
- __u8 snd_wscale = *(__u8 *)ptr;
- opt_rx->wscale_ok = 1;
- if (snd_wscale > 14) {
- if (net_ratelimit())
- printk(KERN_INFO "tcp_parse_options: Illegal window "
- "scaling value %d >14 received.\n",
- snd_wscale);
- snd_wscale = 14;
- }
- opt_rx->snd_wscale = snd_wscale;
- }
- break;
- case TCPOPT_TIMESTAMP:
- if ((opsize == TCPOLEN_TIMESTAMP) &&
- ((estab && opt_rx->tstamp_ok) ||
- (!estab && sysctl_tcp_timestamps))) {
- opt_rx->saw_tstamp = 1;
- opt_rx->rcv_tsval = get_unaligned_be32(ptr);
- opt_rx->rcv_tsecr = get_unaligned_be32(ptr + 4);
- }
- break;
- case TCPOPT_SACK_PERM:
- if (opsize == TCPOLEN_SACK_PERM && th->syn &&
- !estab && sysctl_tcp_sack) {
- opt_rx->sack_ok = 1;
- tcp_sack_reset(opt_rx);
+ /* fallthru */
+ break;
+ };
+
+ opsize = *ptr++;
+ if (opsize < 2 || opsize > length) {
+ /* don't parse partial options */
+ return 0;
+ }
+
+ switch (opcode) {
+ case TCPOPT_MSS:
+ if (opsize == TCPOLEN_MSS && th->syn && !estab) {
+ u16 in_mss = get_unaligned_be16(ptr);
+ if (in_mss) {
+ if (opt_rx->user_mss &&
+ opt_rx->user_mss < in_mss)
+ in_mss = opt_rx->user_mss;
+ opt_rx->mss_clamp = in_mss;
}
- break;
+ }
+ break;
- case TCPOPT_SACK:
- if ((opsize >= (TCPOLEN_SACK_BASE + TCPOLEN_SACK_PERBLOCK)) &&
- !((opsize - TCPOLEN_SACK_BASE) % TCPOLEN_SACK_PERBLOCK) &&
- opt_rx->sack_ok) {
- TCP_SKB_CB(skb)->sacked = (ptr - 2) - (unsigned char *)th;
+ case TCPOPT_WINDOW:
+ if (opsize == TCPOLEN_WINDOW && th->syn &&
+ !estab && sysctl_tcp_window_scaling) {
+ __u8 snd_wscale = *(__u8 *)ptr;
+ opt_rx->wscale_ok = 1;
+ if (snd_wscale > 14) {
+ if (net_ratelimit())
+ printk(KERN_INFO
+ "tcp_parse_options: "
+ "window scaling value "
+ "%d > 14 received.\n",
+ snd_wscale);
+ snd_wscale = 14;
}
- break;
+ opt_rx->snd_wscale = snd_wscale;
+ }
+ break;
+
+ case TCPOPT_SACK_PERM:
+ if (opsize == TCPOLEN_SACK_PERM && th->syn &&
+ !estab && sysctl_tcp_sack) {
+ opt_rx->sack_ok = 1;
+ tcp_sack_reset(opt_rx);
+ }
+ break;
+
+ case TCPOPT_SACK:
+ if ((opsize >= (TCPOLEN_SACK_BASE + TCPOLEN_SACK_PERBLOCK)) &&
+ !((opsize - TCPOLEN_SACK_BASE) % TCPOLEN_SACK_PERBLOCK) &&
+ opt_rx->sack_ok) {
+ TCP_SKB_CB(skb)->sacked = (ptr - 2)
+ - (unsigned char *)th;
+ }
+ break;
+
+ case TCPOPT_TIMESTAMP:
+ if ((opsize == TCPOLEN_TIMESTAMP) &&
+ ((estab && opt_rx->tstamp_ok) ||
+ (!estab && sysctl_tcp_timestamps))) {
+ opt_rx->saw_tstamp = 1;
+ opt_rx->rcv_tsval = get_unaligned_be32(ptr);
+ opt_rx->rcv_tsecr = get_unaligned_be32(ptr + 4);
+ }
+ break;
#ifdef CONFIG_TCP_MD5SIG
- case TCPOPT_MD5SIG:
- /*
- * The MD5 Hash has already been
- * checked (see tcp_v{4,6}_do_rcv()).
- */
- break;
+ case TCPOPT_MD5SIG:
+ /*
+ * The MD5 Hash has already been
+ * checked (see tcp_v{4,6}_do_rcv()).
+ */
+ break;
#endif
- case TCPOPT_COOKIE:
- /* This option is variable length.
- */
- switch (opsize) {
- case TCPOLEN_COOKIE_BASE:
- /* not yet implemented */
- break;
- case TCPOLEN_COOKIE_PAIR:
- /* not yet implemented */
- break;
- case TCPOLEN_COOKIE_MIN+0:
- case TCPOLEN_COOKIE_MIN+2:
- case TCPOLEN_COOKIE_MIN+4:
- case TCPOLEN_COOKIE_MIN+6:
- case TCPOLEN_COOKIE_MAX:
- /* 16-bit multiple */
+ case TCPOPT_COOKIE:
+ /* This option is variable length.
+ */
+ switch (opsize) {
+ case TCPOLEN_COOKIE_BASE:
+ /* not yet implemented */
+ break;
+ case TCPOLEN_COOKIE_PAIR:
+ /* not yet implemented */
+ break;
+ case TCPOLEN_COOKIE_MIN+0:
+ case TCPOLEN_COOKIE_MIN+2:
+ case TCPOLEN_COOKIE_MIN+4:
+ case TCPOLEN_COOKIE_MIN+6:
+ case TCPOLEN_COOKIE_MAX:
+ /* 16-bit multiple */
+ if (th->syn && opt_rx->saw_tstamp &&
+ opt_rx->cookie_plus == 0) {
opt_rx->cookie_plus = opsize;
*hvpp = ptr;
- default:
- /* ignore option */
- break;
- };
+ }
+ break;
+ default:
+ /* ignore option */
break;
};
+ break;
- ptr += opsize-2;
- length -= opsize;
- }
+ default:
+ /* skip unrecognized options */
+ break;
+ };
+
+ ptr += opsize - 2;
+ length -= opsize;
}
+ return 0;
}
+/*
+ * Returns:
+ * 1 on success
+ * 0 on failure
+ */
static int tcp_parse_aligned_timestamp(struct tcp_sock *tp, struct tcphdr *th)
{
__be32 *ptr = (__be32 *)(th + 1);
@@ -3875,8 +3898,7 @@ static int tcp_fast_parse_options(struct sk_buff *skb, struct tcphdr *th,
if (tcp_parse_aligned_timestamp(tp, th))
return 1;
}
- tcp_parse_options(skb, &tp->rx_opt, hvpp, 1);
- return 1;
+ return tcp_parse_options(skb, th, &tp->rx_opt, hvpp, 1);
}
#ifdef CONFIG_TCP_MD5SIG
@@ -5127,10 +5149,13 @@ static int tcp_validate_incoming(struct sock *sk, struct sk_buff *skb,
{
u8 *hash_location;
struct tcp_sock *tp = tcp_sk(sk);
+ int parsed = tcp_fast_parse_options(skb, th, tp, &hash_location);
+
+ if (parsed < 0)
+ goto discard;
/* RFC1323: H1. Apply PAWS check first. */
- if (tcp_fast_parse_options(skb, th, tp, &hash_location) &&
- tp->rx_opt.saw_tstamp &&
+ if (tp->rx_opt.saw_tstamp &&
tcp_paws_discard(sk, skb)) {
if (!th->rst) {
NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_PAWSESTABREJECTED);
@@ -5410,8 +5435,10 @@ static int tcp_rcv_synsent_state_process(struct sock *sk, struct sk_buff *skb,
struct tcp_cookie_values *cvp = tp->cookie_values;
int saved_clamp = tp->rx_opt.mss_clamp;
int queued = 0;
+ int parsed = tcp_parse_options(skb, th, &tp->rx_opt, &hash_location, 0);
- tcp_parse_options(skb, &tp->rx_opt, &hash_location, 0);
+ if (parsed < 0)
+ goto discard;
if (th->ack) {
/* rfc793:
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index f999e06..3f0813f 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -1215,6 +1215,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
{
struct tcp_extend_values tmp_ext;
struct tcp_options_received tmp_opt;
+ int parsed;
u8 *hash_location;
struct request_sock *req;
struct inet_request_sock *ireq;
@@ -1265,7 +1266,10 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
tcp_clear_options(&tmp_opt);
tmp_opt.mss_clamp = TCP_MSS_DEFAULT;
tmp_opt.user_mss = tp->rx_opt.user_mss;
- tcp_parse_options(skb, &tmp_opt, &hash_location, 0);
+ parsed = tcp_parse_options(skb, tcp_hdr(skb), &tmp_opt, &hash_location,
+ 0);
+ if (parsed < 0)
+ goto drop_and_free;
if (tmp_opt.cookie_plus > 0 &&
tmp_opt.saw_tstamp &&
@@ -1278,7 +1282,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
int l = tmp_opt.cookie_plus - TCPOLEN_COOKIE_BASE;
if (tcp_cookie_generator(&tmp_ext.cookie_bakery[0]) != 0)
- goto drop_and_release;
+ goto drop_and_free;
/* Secret recipe starts with IP addresses */
*mess++ ^= daddr;
@@ -1299,7 +1303,7 @@ int tcp_v4_conn_request(struct sock *sk, struct sk_buff *skb)
tmp_ext.cookie_out_never = 1; /* true */
tmp_ext.cookie_plus = 0;
} else {
- goto drop_and_release;
+ goto drop_and_free;
}
tmp_ext.cookie_in_always = tp->rx_opt.cookie_in_always;
diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c
index 37b7536..0d42635 100644
--- a/net/ipv4/tcp_minisocks.c
+++ b/net/ipv4/tcp_minisocks.c
@@ -97,9 +97,12 @@ tcp_timewait_state_process(struct inet_timewait_sock *tw, struct sk_buff *skb,
tmp_opt.saw_tstamp = 0;
if (th->doff > (sizeof(*th) >> 2) && tcptw->tw_ts_recent_stamp) {
- tcp_parse_options(skb, &tmp_opt, &hash_location, 0);
+ int parsed = tcp_parse_options(skb, th, &tmp_opt,
+ &hash_location, 0);
- if (tmp_opt.saw_tstamp) {
+ if (parsed < 0) {
+ paws_reject = 1; /* true */
+ } else if (tmp_opt.saw_tstamp) {
tmp_opt.ts_recent = tcptw->tw_ts_recent;
tmp_opt.ts_recent_stamp = tcptw->tw_ts_recent_stamp;
paws_reject = tcp_paws_reject(&tmp_opt, th->rst);
@@ -528,9 +531,12 @@ struct sock *tcp_check_req(struct sock *sk, struct sk_buff *skb,
tmp_opt.saw_tstamp = 0;
if (th->doff > (sizeof(struct tcphdr)>>2)) {
- tcp_parse_options(skb, &tmp_opt, &hash_location, 0);
+ int parsed = tcp_parse_options(skb, th, &tmp_opt,
+ &hash_location, 0);
- if (tmp_opt.saw_tstamp) {
+ if (parsed < 0) {
+ paws_reject = 1; /* true */
+ } else if (tmp_opt.saw_tstamp) {
tmp_opt.ts_recent = req->ts_recent;
/* We do not store true stamp, but it is not required,
* it can be estimated (approximately)
diff --git a/net/ipv6/syncookies.c b/net/ipv6/syncookies.c
index 7208a06..3072500 100644
--- a/net/ipv6/syncookies.c
+++ b/net/ipv6/syncookies.c
@@ -160,6 +160,7 @@ static inline int cookie_check(struct sk_buff *skb, __u32 cookie)
struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
{
struct tcp_options_received tcp_opt;
+ int parsed;
u8 *hash_location;
struct inet_request_sock *ireq;
struct inet6_request_sock *ireq6;
@@ -187,7 +188,9 @@ struct sock *cookie_v6_check(struct sock *sk, struct sk_buff *skb)
/* check for timestamp cookie support */
memset(&tcp_opt, 0, sizeof(tcp_opt));
- tcp_parse_options(skb, &tcp_opt, &hash_location, 0);
+ parsed = tcp_parse_options(skb, th, &tcp_opt, &hash_location, 0);
+ if (parsed < 0)
+ goto out;
if (tcp_opt.saw_tstamp)
cookie_check_timestamp(&tcp_opt);
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 3d08a4d..e15e4f6 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1164,6 +1164,7 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
{
struct tcp_extend_values tmp_ext;
struct tcp_options_received tmp_opt;
+ int parsed;
u8 *hash_location;
struct request_sock *req;
struct inet6_request_sock *treq;
@@ -1207,7 +1208,10 @@ static int tcp_v6_conn_request(struct sock *sk, struct sk_buff *skb)
tcp_clear_options(&tmp_opt);
tmp_opt.mss_clamp = IPV6_MIN_MTU - sizeof(struct tcphdr) - sizeof(struct ipv6hdr);
tmp_opt.user_mss = tp->rx_opt.user_mss;
- tcp_parse_options(skb, &tmp_opt, &hash_location, 0);
+ parsed = tcp_parse_options(skb, tcp_hdr(skb), &tmp_opt, &hash_location,
+ 0);
+ if (parsed < 0)
+ goto drop_and_free;
if (tmp_opt.cookie_plus > 0 &&
tmp_opt.saw_tstamp &&
--
1.6.3.3
^ permalink raw reply related
* Re: ixgbe RSS not working as expected with 8021q and bridging
From: Eldon Koyle @ 2010-02-10 20:50 UTC (permalink / raw)
To: netdev
In-Reply-To: <4B27E4A1.4050802@gmail.com>
On Dec 15 20:33+0100, Eric Dumazet wrote:
> Le 15/12/2009 18:21, Eldon Koyle a écrit :
> > On Dec 11 1:11+0100, Eric Dumazet wrote:
> >> Le 11/12/2009 00:11, Eldon Koyle a écrit :
> >>> We have built a firewall with two 10 Gbit interfaces (intel 82598EB) and
> >>> are doing some testing. A simple bridge between the two interfaces acts
> >>> as expected with packets being distributed fairly evenly across all of
> >>> the rx/tx queues.
> >>>
> >>> We then switched to tagged vlans on both interfaces (10 vlans each, 8
> >>> source and 8 dest addresses per vlan) and bridged eth0.N to eth1.N, and
> >>> many of our queues (and CPUs) remained idle, and all of our VLAN traffic
> >>> went out on the same tx queue. Are multiple transmit queues supported
> >>> with 802.1q? How do we figure out what is causing some of our receive
> >>> queues to be unused?
> >>>
> >>> We are using 2.6.31 (from Debian) and ixgbe-2.0.44.14 .
> >>>
> >>
> >> You need more recent kernel (2.6.32) to get multi queue support on vlans, sorry.
> >
> > Excellent. 2.6.32 solved half of the problem. Now, we are using the
> > same number of rx and tx queues. We are still seeing no packets on 3 of
> > our 8 rx queues on each interface, though (no packets on 2, 4 or 6).
> > Does the card assign queues in hardware, or is that handled by the
> > kernel?
> >
>
> When a packet is received (ethernet -> Card), the hardware chooses a RX queue using
> hash function.
>
> Then, in your forwarding setup, we (the kernel) automaticaly use same queue to transmit packet.
>
> So if only 5 queues out of 8 receive trafic, it might be because of the flows all map to only 5 queues,
> but you should ask Intel people for details :)
I am now trying 2.6.32.7 with the in-tree ixgbe driver. I am still
seeing some unusual behavior when bridging VLAN interfaces. It looks
like there is an off-by-one error in the mapping from rx queue to tx
queue (ie. packets are sent on <rx queue number>-1 instead of using the
same rx and tx queue number).
Any idea what might cause this?
The following shows queues vs packets on the physical interfaces (the
counts aren't exact, since not all traffic was bridged):
with vlans:
br3990 (eth0.3990 and eth1.3990)
queue| eth0-rx| eth1-tx| eth1-rx| eth0-tx
--------------------------------------------------------------
0| 6344| 150003| 222| 261103
1| 150488| 118250| 261103| 80550
2| 118909| 97282| 80545| 133299
3| 97588| 104442| 133299| 170111
4| 105242| 231104| 170001| 68381
5| 231551| 100548| 68381| 262220
6| 101202| 262220| 262220| 88248
7| 262309| 0| 88253| 0
without vlans (expected behavior):
br0 (eth0 and eth1)
queue| eth0-rx| eth1-tx| eth1-rx| eth0-tx
--------------------------------------------------------------
0| 6001| 5977| 159| 159
1| 541| 541| 1419199| 1419199
2| 1420084| 1419051| 6270| 6270
3| 74354| 74312| 305867| 305867
4| 232547| 232421| 163397| 163397
5| 367| 365| 2| 2
6| 170854| 170174| 5| 5
7| 99| 97| 9| 9
--
Eldon Koyle
System Administration Operations
Information Technology
Utah State University
--
The rule is, jam to-morrow and jam yesterday, but never jam today.
-- Lewis Carroll
^ permalink raw reply
* LXC bridged networking issues
From: Michael B. Trausch @ 2010-02-10 21:45 UTC (permalink / raw)
To: containers, netdev
Hello all,
I am having some rather extreme difficulty getting networking reliably
working with containers running under LXC. First some basic system
information, and my problem description follows.
The host machine has two Ethernet cards, one of which is disabled and
not presently in use, and the other which is connected to a 100Mbps
Ethernet network. The system has a bridge (br0) configured, and br0 has
a static IP address on the LAN. The LAN's network is 172.16.0.0/24. I
also have 173.15.213.184/29 from my ISP. The kernel running on the host
system is a vanilla 2.6.32.7 kernel and lxc is vanilla 0.6.5.
The output of lxc-checkconfig is:
=====================================================================
Kernel config /proc/config.gz not found, looking in other places...
Found kernel config file /boot/config-2.6.32.7
--- Namespaces ---
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
Network namespace: enabled
Multiple /dev/pts instances: enabled
--- Control groups ---
Cgroup: enabled
Cgroup namespace: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled
--- Misc ---
Veth pair device: enabled
Macvlan: enabled
Vlan: enabled
File capabilities: enabled
=====================================================================
Now, I have three containers, "mysql-db", "spicerack", and "secondary".
mysql-db and spicerack have IP addresses in the LAN's private address
space, and the latter two containers also have IP addresses from my pool
of global IP addresses. It seems that the IP addresses on the LAN work
perfectly---that is, I can "ping -f" against the mysql-db machine or the
LAN IP addresses of the spicerack container and I get (statistically) no
packet loss; for example, a floodping to the database server gave 5,151
packets transmitted, 5,148 received. However, flood pinging the
spicerack container yielded 5,493 transmitted, 4,624 received, and this
was a better than normal run of late:
--- mysql-db.local ping statistics ---
5151 packets transmitted, 5148 received, 0% packet loss, time 132902ms
rtt min/avg/max/mdev = 0.865/2.572/241.465/12.386 ms, pipe 11, ipg/ewma
25.806/1.406 ms
--- spicerack.trausch.us ping statistics ---
5493 packets transmitted, 4624 received, +1 errors, 15% packet loss,
time 135421ms
rtt min/avg/max/mdev = 0.784/1.697/171.491/5.200 ms, pipe 11, ipg/ewma
24.657/1.472 ms
The containers were created using lxc-create with configuration files
handed to the lxc-create command. The mysql-db machine gets its LAN IP
via DHCP, and the interfaces on the spicerack and secondary machines are
configured using the contained distribution's normal network
configuration mechanism with static IP address information. Here is the
configuration file for the spicerack container (the config files for the
mysql-db and secondary containers are the same file but with one less
network interface, and a different hostname):
=====================================================================
#
# spicerack container configuration
#
# The hostname.
lxc.utsname = spicerack.trausch.us
# The container's network configuration.
lxc.network.type = veth
lxc.network.link = br0
lxc.network.name = eth0
lxc.network.flags = up
lxc.network.ipv4 = 0.0.0.0
lxc.network.hwaddr = 00:50:56:00:00:00
lxc.network.type = veth
lxc.network.link = br0
lxc.network.name = eth1
lxc.network.flags = up
lxc.network.ipv4 = 0.0.0.0
lxc.network.hwaddr = 00:50:56:00:00:01
# Filesystem configuration.
lxc.rootfs = /srv/systems/trausch.us/spicerack.trausch.us/fs
lxc.mount = /srv/systems/trausch.us/spicerack.trausch.us/fstab
# Permit it to only use one CPU (the first core).
lxc.cgroup.cpuset.cpus = 0
# /dev/ttyX for the container.
lxc.tty = 6
=====================================================================
At first, I had an issue with containers predictably not responding to
their global IP addresses. I appear to have "fixed" this (FSVO "fixed")
by doing "echo 1 > /proc/sys/net/ipv4/conf/all/proxy_arp", however since
all the containers are on the same bridge interface which is attached to
the network, I find myself confused at why this would appear to have any
effect at all. AIUI, it should not matter since the containers are
attached to the br0 interface, and eth1 (the connected Ethernet card) is
also on the br0 interface. I know that when I used OpenVZ and even now
when I use KVM, no special changes are necessary to use
contained/virtualized systems---they Just Work when attached to the bridge.
However, now, I have the issues with packet loss shown above when
communicating with the global IP addresses on my network (note: only
when they are assigned to an LXC container's interface; I have no
problems with KVM or machines on my network that *actually* have global
IP addresses assigned on their Ethernet interfaces). These containers
also seem to lose many packets when communicating with the outside world.
Since the situation is the same for spicerack and secondary, I'll focus
on spicerack here.
The ifconfig output on the container:
=====================================================================
mbt@spicerack:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:00:00:00
inet addr:173.15.213.185 Bcast:173.15.213.191
Mask:255.255.255.248
inet6 addr: fe80::250:56ff:fe00:0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:140443 errors:0 dropped:0 overruns:0 frame:0
TX packets:46681 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23952964 (23.9 MB) TX bytes:21261328 (21.2 MB)
eth1 Link encap:Ethernet HWaddr 00:50:56:00:00:01
inet addr:172.16.0.3 Bcast:172.16.0.255 Mask:255.255.255.0
inet6 addr: fe80::250:56ff:fe00:1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:323961 errors:0 dropped:0 overruns:0 frame:0
TX packets:77990 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:283807282 (283.8 MB) TX bytes:10091642 (10.0 MB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:943 errors:0 dropped:0 overruns:0 frame:0
TX packets:943 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:96145 (96.1 KB) TX bytes:96145 (96.1 KB)
=====================================================================
And the routing table:
=====================================================================
mbt@spicerack:~$ route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface
173.15.213.184 0.0.0.0 255.255.255.248 U 0 0 0 eth0
172.16.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1
0.0.0.0 173.15.213.190 0.0.0.0 UG 100 0 0 eth0
=====================================================================
The ifconfig output for the host system:
=====================================================================
br0 Link encap:Ethernet HWaddr 00:e0:4d:c6:99:c3
inet addr:172.16.0.2 Bcast:172.16.0.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:4dff:fec6:99c3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:146811 errors:0 dropped:0 overruns:0 frame:0
TX packets:24606 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:37120879 (37.1 MB) TX bytes:3021581 (3.0 MB)
eth1 Link encap:Ethernet HWaddr 00:e0:4d:c6:99:c3
inet6 addr: fe80::2e0:4dff:fec6:99c3/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:230600 errors:0 dropped:0 overruns:0 frame:0
TX packets:183194 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:53931942 (53.9 MB) TX bytes:38845042 (38.8 MB)
Interrupt:27 Base address:0x4000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:29 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2690 (2.6 KB) TX bytes:2690 (2.6 KB)
vethN4QBGs Link encap:Ethernet HWaddr b6:60:19:4e:61:88
inet6 addr: fe80::b460:19ff:fe4e:6188/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:78455 errors:0 dropped:0 overruns:0 frame:0
TX packets:326555 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:10164679 (10.1 MB) TX bytes:285821608 (285.8 MB)
vethOc6Aba Link encap:Ethernet HWaddr ba:9f:51:d2:85:89
inet6 addr: fe80::b89f:51ff:fed2:8589/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:208508 errors:0 dropped:0 overruns:0 frame:0
TX packets:175209 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:274136769 (274.1 MB) TX bytes:16783809 (16.7 MB)
vetha8K8GK Link encap:Ethernet HWaddr 26:ca:52:e3:4c:11
UP BROADCAST PROMISC MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
vethbQHpmM Link encap:Ethernet HWaddr ee:9b:06:4b:40:98
inet6 addr: fe80::ec9b:6ff:fe4b:4098/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:47112 errors:0 dropped:0 overruns:0 frame:0
TX packets:141789 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:21474951 (21.4 MB) TX bytes:24055084 (24.0 MB)
vethfuRBD8 Link encap:Ethernet HWaddr c2:49:5d:35:e4:a8
inet6 addr: fe80::c049:5dff:fe35:e4a8/64 Scope:Link
UP BROADCAST RUNNING PROMISC MULTICAST MTU:1500 Metric:1
RX packets:64830 errors:0 dropped:0 overruns:0 frame:0
TX packets:140564 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6155988 (6.1 MB) TX bytes:22442987 (22.4 MB)
=====================================================================
And its routing table:
=====================================================================
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use
Iface
173.15.213.184 0.0.0.0 255.255.255.248 U 0 0 0 br0
172.16.0.0 0.0.0.0 255.255.255.0 U 0 0 0 br0
0.0.0.0 172.16.0.1 0.0.0.0 UG 100 0 0 br0
=====================================================================
Insofar as other data, I don't know what else to provide. I am
completely confused and I haven't the slightest clue how to debug this
setup. Am I doing something wrong with LXC that OpenVZ or full
virtualization handles for me? Have I stumbled upon some bug in the
stack somewhere?
Thanks a bunch!
Mike
--
Michael B. Trausch Blog: http://mike.trausch.us/blog/
Tel: (404) 592-5746 x1 Email: mike@trausch.us
^ permalink raw reply
* Re: RX performance degradation with e1000e in Linux 2.6.31 / F12
From: Kelvin Ku @ 2010-02-10 22:13 UTC (permalink / raw)
To: Community support for Fedora users; +Cc: e1000-devel, netdev
In-Reply-To: <4B73016F.5050106@cchtml.com>
On Wed, Feb 10, 2010 at 12:56:47PM -0600, Michael Cronenworth wrote:
> Kelvin Ku wrote:
> > After upgrading from Linux 2.6.30 (Fedora Core 11) to 2.6.31 (F12), I am
> > experiencing significant packet loss on an Intel 82574L NIC running on the
> > e1000e driver. I was not experiencing this with kernel 2.6.30. I notice 2.6.30
> > uses e1000e version 0.3.3.4-k4 whereas 2.6.31 uses version 1.0.2-k2.
>
> And the driver version would be the significance. It appears there are
> (very) serious issues with the e1000e driver and the 82574L chip. I'm
> having to use 2.6.30 on a F12 server with an 82574L to have network
> connectivity at all. The issue has been reported[1] and it is being
> investigated. We had a hard time convincing Intel it wasn't a
> motherboard manufacturer problem.
>
> [1]
> http://sourceforge.net/tracker/?func=detail&aid=2908463&group_id=42302&atid=447449
> --
> users mailing list
> users@lists.fedoraproject.org
> To unsubscribe or change subscription options:
> https://admin.fedoraproject.org/mailman/listinfo/users
> Guidelines: http://fedoraproject.org/wiki/Communicate/MailingListGuidelines
>
Note that my RX performance issue arises with the latest Intel e1000e driver,
1.1.2-NAPI, and an older Intel driver, 0.5.18.3-NAPI, as well. I can't get an
even older version of the driver, 0.4.1.7, to compile on Linux 2.6.31, probably
because the kernel API has changed since that driver was released.
- Kelvin
^ permalink raw reply
* Re: bnx2 limits user-specified advertised speeds to one
From: Michael Chan @ 2010-02-10 22:11 UTC (permalink / raw)
To: Vlad Yasevich; +Cc: netdev
In-Reply-To: <4B731F8A.20508@hp.com>
On Wed, 2010-02-10 at 13:05 -0800, Vlad Yasevich wrote:
> Hi
>
> A customer has noted that when attempting to change the advertised speeds
> setting on card using a bnx2 driver, the driver advertises either all available
> speeds or just one. In other words, if a user attempts to set multiple
> advertised speeds, the settings will not be honored.
>
> Looking at the code in bnx2_set_settings, the checks for 10baseT and 100baseT
> make an assumption that the user provided only 1 speed setting.
>
> e1000 and e1000e work correctly when the user specifies multiple advertised
> speeds.
>
> Before attempting to fix this, I wanted to ask if there was a reason for the
> current functionality.
>
Probably code to handle limitations in older versions of the ethtool
program. There is no reason for it to be like this anymore. I'll fix
this in my next patch set. Thanks for reporting this.
^ permalink raw reply
* RE: [net-next-2.6 PATCH v3 4/5] rtnetlink: Add VF config code to rtnetlink
From: Williams, Mitch A @ 2010-02-10 22:33 UTC (permalink / raw)
To: Patrick McHardy, Kirsher, Jeffrey T
Cc: davem@davemloft.net, netdev@vger.kernel.org, gospo@redhat.com
In-Reply-To: <4B72A061.40905@trash.net>
>From: Patrick McHardy [mailto:kaber@trash.net]
[snip]
>
>We usually encapsulate lists of the same attribute type in another
>top-level attribute. Check out the IFLA_VLAN_*_QOS attributes for
>an example.
>
>The interface should also be symetrical, IOW you should dump the
>same attributes used in the userspace->kernel direction instead
>of a combined "info" attribute.
Sheesh, Patrick, where were you three months ago when I first
posted this stuff? It would have helped a lot if I heard from
you back then. We've had at least five internal review cycles
here and nobody caught this, mostly because nobody understands
it.
That being said, I'll take another look at the NLA_NESTED stuff
and see what I can figure out. Do you know of any place (outside
of the code) where this is documented? It's particularly
difficult to follow this code.
I see your point about symmetrical interfaces, but I'm not sure
it's the best thing here. We want the user to be able to set these
attributes independently, without blowing away any other settings.
If we put all three settings together into one data structure,
the code flow will end up being much more complicated.
I'd prefer to leave the data structures as they are, and switch
to using nested attributes for the status reporting part, i.e.
what happens when you type 'ip link show'. Would this work for you?
>
>It dev_base_lock really correct here? This is running under the RTNL, so
>changes to the device list can't happen.
>
Good catch - I'll pull out the lock.
>> + if (ops->ndo_set_vf_mac)
>> + err = ops->ndo_set_vf_mac(dev, ivm->vf, ivm->mac);
>
>Shouldn't this indicate an error if the attributes aren't supported?
Yes. I'll fix this.
>The casts aren't necessary. But why does struct ifla_vf_vlan use u32
>for the vlan in the first place?
I used u32 for all of the values because that's what everything else
used. All the stuff in iproute2 seems to like u32 size as well.
The casts aren't necessary for the compiler, but I put them in for
readability purposes - to make it obvious. I can remove them if
they're objectionable.
Thanks for your review, Patrick.
-Mitch
^ permalink raw reply
* Re: LXC bridged networking issues
From: Michael B. Trausch @ 2010-02-10 22:42 UTC (permalink / raw)
To: containers-qjLDD68F18O7TbgM5vRIOg, netdev-u79uwXL29TY76Z2rM5mHXA
In-Reply-To: <4B732911.7070209-cRPrJ27hGUicqzYg7KEe8g@public.gmane.org>
On 02/10/2010 04:45 PM, Michael B. Trausch wrote:
> Insofar as other data, I don't know what else to provide. I am
> completely confused and I haven't the slightest clue how to debug this
> setup. Am I doing something wrong with LXC that OpenVZ or full
> virtualization handles for me? Have I stumbled upon some bug in the
> stack somewhere?
Ahh, nevermind.
It would seem that in this case, the answer is that yours truly here is
a moron. I done did screwed up: two of the interfaces had the same MAC
address.
My apologies for the noise.
--- Mike
--
Michael B. Trausch Blog: http://mike.trausch.us/blog/
Tel: (404) 592-5746 x1 Email: mike-cRPrJ27hGUicqzYg7KEe8g@public.gmane.org
^ permalink raw reply
* Re: bnx2 limits user-specified advertised speeds to one
From: Ben Hutchings @ 2010-02-10 23:35 UTC (permalink / raw)
To: Michael Chan; +Cc: Vlad Yasevich, netdev
In-Reply-To: <1265839887.8125.39.camel@nseg_linux_HP1.broadcom.com>
On Wed, 2010-02-10 at 14:11 -0800, Michael Chan wrote:
> On Wed, 2010-02-10 at 13:05 -0800, Vlad Yasevich wrote:
> > Hi
> >
> > A customer has noted that when attempting to change the advertised speeds
> > setting on card using a bnx2 driver, the driver advertises either all available
> > speeds or just one. In other words, if a user attempts to set multiple
> > advertised speeds, the settings will not be honored.
> >
> > Looking at the code in bnx2_set_settings, the checks for 10baseT and 100baseT
> > make an assumption that the user provided only 1 speed setting.
> >
> > e1000 and e1000e work correctly when the user specifies multiple advertised
> > speeds.
> >
> > Before attempting to fix this, I wanted to ask if there was a reason for the
> > current functionality.
> >
>
> Probably code to handle limitations in older versions of the ethtool
> program. There is no reason for it to be like this anymore. I'll fix
> this in my next patch set. Thanks for reporting this.
Older versions of ethtool can request invalid advertising masks
(including flags not set in the supported mask) and do not enable
advertising of 10G modes. In the out-of-tree version of sfc we use this
workaround:
/* Older versions of ethtool don't set all the right bits when
* turning autoneg on with no speed/duplex specified. But they
* always set more than one bit in this case, so test for that.
* Allow overriding this in ethtool 6 by setting
* ADVERTISED_Autoneg = 0x40.
*/
if (ecmd->advertising & (ecmd->advertising - 1) &&
!(ecmd->advertising & ADVERTISED_Autoneg))
ecmd->advertising = ecmd->supported;
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