Netdev List
 help / color / mirror / Atom feed
* Re: TCP sockets stalling - help! (long)
From: Frederic Leroy @ 2009-11-26 22:33 UTC (permalink / raw)
  To: Asdo; +Cc: netdev, e1000-devel
In-Reply-To: <4B0CB1B8.8030402@shiftmail.org>

Le Wed, 25 Nov 2009 05:25:28 +0100,
Asdo <asdo@shiftmail.org> a écrit :

> Hi netdev and e1000 people,
> 
> I have a weird problem here.
> [...]

I have the same kind of problem at home. I can't copy big files over
ssh unless I limit the rate ( ssh -l 8000 ... )
After reading your mail, I make some quick tests ( see below).

Results in short :
- netcat always work.
- ssh stalls, nearly immediately.

I thought fault cames from a kernel update or my wifi card update.
Apparently, I was wrong for the hardware.

Here are the test I just made : 

network:
SG ----- eth_100_Mbps ----- ISV_BOX )))   wifi_~1.5Mb   ((( HOUBA

host HOUBA:
----
gentoo - updated frequently (once a week)
kernel vanilla : Linux houba 2.6.32-rc6-fredo4-04866-g47caac1 #5
PREEMPT Fri Nov 6 14:20:20 CET 2009 i686 Intel(R) Pentium(R) M
processor 1400MHz GenuineIntel GNU/Linux

host SG: 
----
debian stable - not updated recently
kernel vanilla : Linux sg 2.6.32-rc5-fredo3 #2 Mon Oct 19 02:25:29 CEST
2009 i586 GNU/Linux 
/dev/sda is a USB disk mounted on media/big

TESTS
-----

HOUBA command for tests :
netcat -l -p 2000 | pv > /dev/null

TEST1 - OK : ~5min
fredo@sg:~/remote_wake$ cat /dev/null | netcat houba 2000

TEST2 - OK : ~5min
fredo@sg:~/remote_wake$ cat /dev/sda | netcat houba 2000

TEST3 - OK :
fredo@sg:~/remote_wake$
cat /media/big/home/fredo/cdanslair/cdanslair_20091125.wmv | netcat -q
0 houba 2000

result : 291MO 0:03:32 [1,37MO/s]

TEST4 - FAILED
fredo@sg:~/remote_wake$
scp /media/big/home/fredo/cdanslair/cdanslair_20091125.wmv houba:
Stalled within seconds (5216Kb transferred) :
cdanslair_20091125.wmv          1% 5216KB   0.0KB/s - stalled -

-- 
Frédéric Leroy

^ permalink raw reply

* Re: how expensive are mallocs?
From: Andi Kleen @ 2009-11-26 22:25 UTC (permalink / raw)
  To: Andrew Grover; +Cc: netdev
In-Reply-To: <c0a09e5c0911240957x45abfb26k1611e53f435e5179@mail.gmail.com>

Andrew Grover <andy.grover@gmail.com> writes:

> How much effort generally makes sense to avoid mallocs? For example,

The slab allocators are very optimized, with a fast path for
allocation and freeing that's essentially "disable interrupts ; 
unlink object from a list ; reenable". That's not expensive
(unless you're running on a CPU where disabling interrupts is)

The main costs in them come when you free objects on a different CPU
(or worse node) than where you allocate them. In that case you can end
up with some bounced cache lines, which are slow. If you can avoid
that you're good. If you can't even then you would need to make major
effort to do better.

> Also, RDS has its own per-cpu page remainder allocator (see
> net/rds/page.c) for kernel send buffers. Would cutting this code and
> just using kmalloc be recommended? Doesn't SL?B already do per-cpu
> pools?

Slab is all per cpu in the fast path, but see above.

> Does this stuff even matter enough to rise above the noise in benchmarks?

Yes it does in some circumstances, but it's hard to do better.

One example of doing better for special circumstances would be Eric's
rps work, but doing these things is not easy and only worth it
for really critical cases.

-Andi

-- 
ak@linux.intel.com -- Speaking for myself only.

^ permalink raw reply

* Re: [Bug 14470] New: freez in TCP stack
From: Ilpo Järvinen @ 2009-11-26 21:54 UTC (permalink / raw)
  To: David Miller
  Cc: eric.dumazet, Andrew Morton, Stephen Hemminger, Netdev, kolo,
	bugzilla-daemon
In-Reply-To: <20091029.010009.175904855.davem@davemloft.net>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1981 bytes --]

On Thu, 29 Oct 2009, David Miller wrote:

> From: Eric Dumazet <eric.dumazet@gmail.com>
> Date: Thu, 29 Oct 2009 06:59:41 +0100
> 
> > [PATCH] tcp: clear retrans hints in tcp_send_synack()
> > 
> > There is a small possibility the skb we unlink from write queue 
> > is still referenced by retrans hints.
> > 
> > Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
> 
> So, this would only be true if we were dealing with a data
> packet here.  We're not, this is a SYN+ACK which happens to
> be cloned in the write queue.
> 
> The hint SKBs pointers can only point to real data packets.
> 
> And we're only dealing with data packets once we enter established
> state, and when we enter established by definition we have unlinked
> and freed up any SYN and SYN+ACK SKBs in the write queue.

How about this then... Does the original reporter have NFS in use?

[PATCH] tcp: clear hints to avoid a stale one (nfs only affected?)

Eric Dumazet mentioned in a context of another problem:

"Well, it seems NFS reuses its socket, so maybe we miss some
cleaning as spotted in this old patch"

I've not check under which conditions that actually happens but
if true, we need to make sure we don't accidently leave stale
hints behind when the write queue had to be purged (whether reusing
with NFS can actually happen if purging took place is something I'm
not sure of).

...At least it compiles.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@helsinki.fi>
---
 include/net/tcp.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/include/net/tcp.h b/include/net/tcp.h
index 03a49c7..6b13faa 100644
--- a/include/net/tcp.h
+++ b/include/net/tcp.h
@@ -1228,6 +1228,7 @@ static inline void tcp_write_queue_purge(struct sock *sk)
 	while ((skb = __skb_dequeue(&sk->sk_write_queue)) != NULL)
 		sk_wmem_free_skb(sk, skb);
 	sk_mem_reclaim(sk);
+	tcp_clear_all_retrans_hints(tcp_sk(sk));
 }
 
 static inline struct sk_buff *tcp_write_queue_head(struct sock *sk)
-- 
1.5.6.5

^ permalink raw reply related

* Re: [PATCH 1/4] veth: move loopback logic to common location
From: Patrick McHardy @ 2009-11-26 21:14 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: David Miller, Eric W. Biederman, virtualization, Herbert Xu,
	Eric Dumazet, Anna Fischer, netdev, bridge, linux-kernel,
	Mark Smith, Gerhard Stenzel, Jens Osterkamp, Patrick Mullaney,
	Stephen Hemminger
In-Reply-To: <200911261844.59912.arnd@arndb.de>

Arnd Bergmann wrote:
> On Thursday 26 November 2009, Patrick McHardy wrote:
>> In addition to those already handled, I'd say
>>
>> - priority: affects qdisc classification, may refer to classes of the
>>   old namespace
>> - ipvs_property: might cause packets to incorrectly skip netfilter hooks
>> - nf_trace: might trigger packet tracing
>> - nf_bridge: contains references to network devices in the old NS,
>>   also indicates packet was bridged
>> - iif: index is only valid in the originating namespace
>> - probably secmark.
> 
> ok
> 
>> - tc_index: classification result, should only be set in the namespace
>>   of the classifier
>> - tc_verd: RTTL etc. should begin at zero again
> 
> Wouldn't that defeat the purpose of RTTL? If you create a loop
> across two devices in different namespaces, it may no longer get
> detected. Or is that a different problem again?

Mhh good point, that would indeed be possible. OTOH using ingress
filtering in one namespace currently might cause the packet to get
dropped in a different namespace because the ttl runs out. For now
I'd suggest to go the safe route and keep the TTL intact until we
can come up with something better.

> +void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
> +{
> +	if (skb->dev && !net_eq(dev_net(skb->dev), dev_net(dev))) {
> +		secpath_reset(skb);
> +		skb_dst_drop(skb);
> +		nf_reset(skb);
> +		skb_init_secmark(skb);
> +		skb->mark = 0;
> +		skb->priority = 0;
> +		skb->nf_trace = 0;
> +		skb->ipvs_property = 0;
> +#ifdef CONFIG_NET_SCHED
> +		skb->tc_index = 0;
> +#ifdef CONFIG_NET_CLS_ACT
> +		skb->tc_verd = SET_TC_VERD(skb->tc_verd, 0);
> +		skb->tc_verd = SET_TC_RTTL(skb->tc_verd, 0);
> +#endif
> +#endif

This makes we wonder which ones we actually should keep. Most of the
others get reinitialized anyways, so maybe its better to simply clear
the entire area up until ->tail like f.i. skb_recycle_check().

> +	}
> +	skb->dev = dev;
> +	skb->skb_iif = skb->dev->ifindex;

This doesn't seem necessary, if the packet goes through
netif_receive_skb, it will be set anyways.

> +}
> +EXPORT_SYMBOL(skb_set_dev);

^ permalink raw reply

* Re: [PATCH v3 5/7] via-velocity: Re-enable transmit scatter-gather support
From: David Miller @ 2009-11-26 21:09 UTC (permalink / raw)
  To: simon.kagstrom; +Cc: netdev, davej, shemminger, romieu
In-Reply-To: <20091126083641.4f961ce5@marrow.netinsight.se>

From: Simon Kagstrom <simon.kagstrom@netinsight.net>
Date: Thu, 26 Nov 2009 08:36:41 +0100

> and after having crunched this in my head for a while, I couldn't
> convince myself that nr_frags would always come out as less than 7 from
> here. I don't claim to have done a thorough examination though.

__skb_linearize() does pskb_pull_tail() with length skb->data_len

skb->data_len represents the length of the data represented by non-linear
buffers in the SKB.

Therfore ending up with ->nr_frags != 0 or ->frag_list != NULL after this
operation would be a bug, and not something we should assert about in
driver code.

^ permalink raw reply

* Re: [PATCH 1/4] veth: move loopback logic to common location
From: Arnd Bergmann @ 2009-11-26 17:44 UTC (permalink / raw)
  To: Patrick McHardy
  Cc: David Miller, Eric W. Biederman, virtualization, Herbert Xu,
	Eric Dumazet, Anna Fischer, netdev, bridge, linux-kernel,
	Mark Smith, Gerhard Stenzel, Jens Osterkamp, Patrick Mullaney,
	Stephen Hemminger
In-Reply-To: <4B0E9FD0.4040107@trash.net>

On Thursday 26 November 2009, Patrick McHardy wrote:
> In addition to those already handled, I'd say
> 
> - priority: affects qdisc classification, may refer to classes of the
>   old namespace
> - ipvs_property: might cause packets to incorrectly skip netfilter hooks
> - nf_trace: might trigger packet tracing
> - nf_bridge: contains references to network devices in the old NS,
>   also indicates packet was bridged
> - iif: index is only valid in the originating namespace
> - probably secmark.

ok

> - tc_index: classification result, should only be set in the namespace
>   of the classifier
> - tc_verd: RTTL etc. should begin at zero again

Wouldn't that defeat the purpose of RTTL? If you create a loop
across two devices in different namespaces, it may no longer get
detected. Or is that a different problem again?

	Arnd <><

---

net: maintain namespace isolation between vlan and real device

In the vlan and macvlan drivers, the start_xmit function forwards
data to the dev_queue_xmit function for another device, which may
potentially belong to a different namespace.

To make sure that classification stays within a single namespace,
this resets the potentially critical fields.

Still needs testing, don't apply

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/macvlan.c     |    2 +-
 include/linux/netdevice.h |    9 +++++++++
 net/8021q/vlan_dev.c      |    2 +-
 net/core/dev.c            |   37 +++++++++++++++++++++++++++++++++----
 4 files changed, 44 insertions(+), 6 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 322112c..edcebf1 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -269,7 +269,7 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
 	}
 
 xmit_world:
-	skb->dev = vlan->lowerdev;
+	skb_set_dev(skb, vlan->lowerdev);
 	return dev_queue_xmit(skb);
 }
 
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9428793..fdf4a1a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1009,6 +1009,15 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev)
 	return 0;
 }
 
+#ifdef CONFIG_NET_NS
+static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
+{
+	skb->dev = dev;
+}
+#else /* CONFIG_NET_NS */
+void skb_set_dev(struct sk_buff *skb, struct net_device *dev);
+#endif
+
 static inline bool netdev_uses_trailer_tags(struct net_device *dev)
 {
 #ifdef CONFIG_NET_DSA_TAG_TRAILER
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index de0dc6b..51fcfff 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -323,7 +323,7 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
 	}
 
 
-	skb->dev = vlan_dev_info(dev)->real_dev;
+	skb_set_dev(skb, vlan_dev_info(dev)->real_dev);
 	len = skb->len;
 	ret = dev_queue_xmit(skb);
 
diff --git a/net/core/dev.c b/net/core/dev.c
index f8baa15..220d4e4 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1448,13 +1448,10 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
 	if (skb->len > (dev->mtu + dev->hard_header_len))
 		return NET_RX_DROP;
 
-	skb_dst_drop(skb);
+	skb_set_dev(skb, dev);
 	skb->tstamp.tv64 = 0;
 	skb->pkt_type = PACKET_HOST;
 	skb->protocol = eth_type_trans(skb, dev);
-	skb->mark = 0;
-	secpath_reset(skb);
-	nf_reset(skb);
 	return netif_rx(skb);
 }
 EXPORT_SYMBOL_GPL(dev_forward_skb);
@@ -1614,6 +1611,39 @@ static bool dev_can_checksum(struct net_device *dev, struct sk_buff *skb)
 	return false;
 }
 
+/**
+ * skb_dev_set -- assign a buffer to a new device
+ * @skb: buffer for the new device
+ * @dev: network device
+ *
+ * If an skb is owned by a device already, we have to reset
+ * all data private to the namespace a device belongs to
+ * before assigning it a new device.
+ */
+void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
+{
+	if (skb->dev && !net_eq(dev_net(skb->dev), dev_net(dev))) {
+		secpath_reset(skb);
+		skb_dst_drop(skb);
+		nf_reset(skb);
+		skb_init_secmark(skb);
+		skb->mark = 0;
+		skb->priority = 0;
+		skb->nf_trace = 0;
+		skb->ipvs_property = 0;
+#ifdef CONFIG_NET_SCHED
+		skb->tc_index = 0;
+#ifdef CONFIG_NET_CLS_ACT
+		skb->tc_verd = SET_TC_VERD(skb->tc_verd, 0);
+		skb->tc_verd = SET_TC_RTTL(skb->tc_verd, 0);
+#endif
+#endif
+	}
+	skb->dev = dev;
+	skb->skb_iif = skb->dev->ifindex;
+}
+EXPORT_SYMBOL(skb_set_dev);
+
 /*
  * Invalidate hardware checksum when packet is to be mangled, and
  * complete checksum manually on outgoing path.

^ permalink raw reply related

* [PATCH] bnx2: EEH is failing with timeout
From: leitao @ 2009-11-26 17:31 UTC (permalink / raw)
  To: mchan; +Cc: netdev, Breno Leitao

bnx2 is failing when a PCI error is detected. The error is the
following:

bnx2: Chip not in correct endian mode
bnx2: fw sync timeout, reset code = 404001d

This error was caused because the way pci_restore_state() is working
after commit 4b77b0a2ba27d64f58f16d8d4d48d8319dda36ff.

Signed-off-by: Breno Leitao<leitao@linux.vnet.ibm.com>
---
 drivers/net/bnx2.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 08cddb6..7fa4048 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -8264,6 +8264,7 @@ static pci_ers_result_t bnx2_io_slot_reset(struct pci_dev *pdev)
 	}
 	pci_set_master(pdev);
 	pci_restore_state(pdev);
+	pci_save_state(pdev);
 
 	if (netif_running(dev)) {
 		bnx2_set_power_state(bp, PCI_D0);
-- 
1.6.0.2


^ permalink raw reply related

* Re: [tproxy,regression] tproxy broken in 2.6.32
From: Andreas Schultz @ 2009-11-26 17:19 UTC (permalink / raw)
  To: KOVACS Krisztian; +Cc: tproxy, netdev, jamal
In-Reply-To: <1259137434.9191.3.camel@nienna.balabit>

Hi,

git bisect shows that TPROXY has been broken by commit
f7c6fd2465d8e6f4f89c5d1262da10b4a6d499d0, [PATCH] net: Fix RPF to work
with policy routing

I had a look at the patch, and it seems logical that this would break TPROXY.

Andreas

On Wed, Nov 25, 2009 at 9:23 AM, KOVACS Krisztian <hidden@balabit.hu> wrote:
> Hi,
>
> On Mon, 2009-11-23 at 13:43 +0100, Andreas Schultz wrote:
>> I was trying to replace a setup based on a 2.6.27.14 kernel with a
>> 2.6.32-rc8 kernel and found that TPROXY is no longer working.
>>
>> The 2.6.27.14 kernel had the last stable tproxy patch plus some
>> additional fixes (TIME_WAIT, inet_sk_flowi_flags).
>> Since 2.6.32 is supposed to have working tproxy support, i dropped all patches.
>>
>> Now, connections to the local tproxy port no longer arrive at that port.
>> From the kernel log:
>>
>> Nov 23 12:32:31 scg01-wiwob user.debug kernel: tproxy socket lookup:
>> proto 6 ac19c4df:49175 -> c0a80208:80, lookup type: 2, sock (null)
>> Nov 23 12:32:31 scg01-wiwob user.debug kernel: tproxy socket lookup:
>> proto 6 ac19c4df:49175 -> c0a80208:3128, lookup type: 1, sock debae040
>> Nov 23 12:32:31 scg01-wiwob user.debug kernel: redirecting: proto 6
>> c0a80208:80 -> 00000000:3128, mark: 880400a0
>>
>>
>> The redirecting message is the last indication of the packet. tcpdump
>> shows that no answer for the initial packet goes out and the listening
>> socket it not notified either.
>
> I'll have a look at this. In the meantime, could you please post your
> kernel config, along with a summary of the iptables & ip rules you're
> using?
>
> Cheers,
> Krisztian
>
>

^ permalink raw reply

* Re: [PATCH 1/4] veth: move loopback logic to common location
From: Eric W. Biederman @ 2009-11-26 16:38 UTC (permalink / raw)
  To: Patrick McHardy
  Cc: Arnd Bergmann, David Miller, virtualization, Herbert Xu,
	Eric Dumazet, Anna Fischer, netdev, bridge, linux-kernel,
	Mark Smith, Gerhard Stenzel, Jens Osterkamp, Patrick Mullaney,
	Stephen Hemminger
In-Reply-To: <4B0E9FD0.4040107@trash.net>

Patrick McHardy <kaber@trash.net> writes:

> Arnd Bergmann wrote:
>> On Tuesday 24 November 2009, Patrick McHardy wrote:
>>> Eric W. Biederman wrote:
>>>> I don't quite follow what you intend with dev_queue_xmit when the macvlan
>>>> is in one namespace and the real physical device is in another.  Are
>>>> you mentioning that the packet classifier runs in the namespace where
>>>> the primary device lives with packets from a different namespace?
>>> Exactly. And I think we should make sure that the namespace of
>>> the macvlan device can't (deliberately or accidentally) cause
>>> misclassification.
>> 
>> This is independent of my series and a preexisting problem, right?
>
> Correct.
>
>> Which fields do you think need to be reset to maintain namespace
>> isolation for the outbound path in macvlan?
>
> In addition to those already handled, I'd say
>
> - priority: affects qdisc classification, may refer to classes of the
>   old namespace
> - ipvs_property: might cause packets to incorrectly skip netfilter hooks
> - nf_trace: might trigger packet tracing
> - nf_bridge: contains references to network devices in the old NS,
>   also indicates packet was bridged
> - iif: index is only valid in the originating namespace
> - tc_index: classification result, should only be set in the namespace
>   of the classifier
> - tc_verd: RTTL etc. should begin at zero again
> - probably secmark.

Wow.  I thought we were trying to reduce skbuff, where did all of those
fields come from?  Regarless that sounds like a good list to get stomped.

Eric

^ permalink raw reply

* Re: [PATCHv3 0/4] macvlan: add vepa and bridge mode
From: Patrick McHardy @ 2009-11-26 16:26 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Herbert Xu, Eric Dumazet, Anna Fischer, netdev, bridge,
	linux-kernel, virtualization, Mark Smith, Gerhard Stenzel,
	Eric W. Biederman, Jens Osterkamp, Patrick Mullaney,
	Stephen Hemminger, David Miller
In-Reply-To: <1259251631-11617-1-git-send-email-arnd@arndb.de>

Arnd Bergmann wrote:
> Version 2 description:
> The patch to iproute2 has not changed, so I'm not including
> it this time. Patch 4/4 (the netlink interface) is basically
> unchanged as well but included for completeness.
> 
> The other changes have moved forward a bit, to the point where
> I find them a lot cleaner and am more confident in the code
> being ready for inclusion. The implementation hardly resembles
> Erics original patch now, so I've dropped his signed-off-by.
> 
> Please take a look and ack if you are happy so we can get it
> into 2.6.33.

Looks good to me, nice work.

Acked-by: Patrick McHardy <kaber@trash.net>

for the entire series.

^ permalink raw reply

* [PATCHv3 2/4] macvlan: cleanup rx statistics
From: Arnd Bergmann @ 2009-11-26 16:07 UTC (permalink / raw)
  To: netdev
  Cc: Herbert Xu, Eric Dumazet, Anna Fischer, bridge, linux-kernel,
	virtualization, Mark Smith, Gerhard Stenzel, Arnd Bergmann,
	Eric W. Biederman, Jens Osterkamp, Patrick Mullaney,
	Stephen Hemminger, David Miller, Patrick McHardy
In-Reply-To: <1259251631-11617-1-git-send-email-arnd@arndb.de>

We have very similar code for rx statistics in
two places in the macvlan driver, with a third
one being added in the next patch.

Consolidate them into one function to improve
overall readability of the driver.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/macvlan.c |   70 ++++++++++++++++++++++++++++--------------------
 1 files changed, 41 insertions(+), 29 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index ae2b5c7..1e7faf9 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -116,42 +116,58 @@ static int macvlan_addr_busy(const struct macvlan_port *port,
 	return 0;
 }
 
+static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
+				    unsigned int len, bool success,
+				    bool multicast)
+{
+	struct macvlan_rx_stats *rx_stats;
+
+	rx_stats = per_cpu_ptr(vlan->rx_stats, smp_processor_id());
+	if (likely(success)) {
+		rx_stats->rx_packets++;;
+		rx_stats->rx_bytes += len;
+		if (multicast)
+			rx_stats->multicast++;
+	} else {
+		rx_stats->rx_errors++;
+	}
+}
+
+static int macvlan_broadcast_one(struct sk_buff *skb, struct net_device *dev,
+				 const struct ethhdr *eth)
+{
+	if (!skb)
+		return NET_RX_DROP;
+
+	skb->dev = dev;
+	if (!compare_ether_addr_64bits(eth->h_dest,
+				       dev->broadcast))
+		skb->pkt_type = PACKET_BROADCAST;
+	else
+		skb->pkt_type = PACKET_MULTICAST;
+
+	return netif_rx(skb);
+}
+
 static void macvlan_broadcast(struct sk_buff *skb,
 			      const struct macvlan_port *port)
 {
 	const struct ethhdr *eth = eth_hdr(skb);
 	const struct macvlan_dev *vlan;
 	struct hlist_node *n;
-	struct net_device *dev;
 	struct sk_buff *nskb;
 	unsigned int i;
-	struct macvlan_rx_stats *rx_stats;
+	int err;
 
 	if (skb->protocol == htons(ETH_P_PAUSE))
 		return;
 
 	for (i = 0; i < MACVLAN_HASH_SIZE; i++) {
 		hlist_for_each_entry_rcu(vlan, n, &port->vlan_hash[i], hlist) {
-			dev = vlan->dev;
-			rx_stats = per_cpu_ptr(vlan->rx_stats, smp_processor_id());
-
 			nskb = skb_clone(skb, GFP_ATOMIC);
-			if (nskb == NULL) {
-				rx_stats->rx_errors++;
-				continue;
-			}
-
-			rx_stats->rx_bytes += skb->len + ETH_HLEN;
-			rx_stats->rx_packets++;
-			rx_stats->multicast++;
-
-			nskb->dev = dev;
-			if (!compare_ether_addr_64bits(eth->h_dest, dev->broadcast))
-				nskb->pkt_type = PACKET_BROADCAST;
-			else
-				nskb->pkt_type = PACKET_MULTICAST;
-
-			netif_rx(nskb);
+			err = macvlan_broadcast_one(nskb, vlan->dev, eth);
+			macvlan_count_rx(vlan, skb->len + ETH_HLEN,
+					 err == NET_RX_SUCCESS, 1);
 		}
 	}
 }
@@ -163,7 +179,7 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
 	const struct macvlan_port *port;
 	const struct macvlan_dev *vlan;
 	struct net_device *dev;
-	struct macvlan_rx_stats *rx_stats;
+	unsigned int len;
 
 	port = rcu_dereference(skb->dev->macvlan_port);
 	if (port == NULL)
@@ -183,15 +199,11 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
 		kfree_skb(skb);
 		return NULL;
 	}
-	rx_stats = per_cpu_ptr(vlan->rx_stats, smp_processor_id());
+	len = skb->len + ETH_HLEN;
 	skb = skb_share_check(skb, GFP_ATOMIC);
-	if (skb == NULL) {
-		rx_stats->rx_errors++;
+	macvlan_count_rx(vlan, len, skb != NULL, 0);
+	if (!skb)
 		return NULL;
-	}
-
-	rx_stats->rx_bytes += skb->len + ETH_HLEN;
-	rx_stats->rx_packets++;
 
 	skb->dev = dev;
 	skb->pkt_type = PACKET_HOST;
-- 
1.6.3.3


^ permalink raw reply related

* [PATCHv3 3/4] macvlan: implement bridge, VEPA and private mode
From: Arnd Bergmann @ 2009-11-26 16:07 UTC (permalink / raw)
  To: netdev
  Cc: Herbert Xu, Eric Dumazet, Anna Fischer, bridge, linux-kernel,
	virtualization, Mark Smith, Gerhard Stenzel, Arnd Bergmann,
	Eric W. Biederman, Jens Osterkamp, Patrick Mullaney,
	Stephen Hemminger, David Miller, Patrick McHardy
In-Reply-To: <1259251631-11617-1-git-send-email-arnd@arndb.de>

This allows each macvlan slave device to be in one
of three modes, depending on the use case:

MACVLAN_PRIVATE:
  The device never communicates with any other device
  on the same upper_dev. This even includes frames
  coming back from a reflective relay, where supported
  by the adjacent bridge.

MACVLAN_VEPA:
  The new Virtual Ethernet Port Aggregator (VEPA) mode,
  we assume that the adjacent bridge returns all frames
  where both source and destination are local to the
  macvlan port, i.e. the bridge is set up as a reflective
  relay.
  Broadcast frames coming in from the upper_dev get
  flooded to all macvlan interfaces in VEPA mode.
  We never deliver any frames locally.

MACVLAN_BRIDGE:
  We provide the behavior of a simple bridge between
  different macvlan interfaces on the same port. Frames
  from one interface to another one get delivered directly
  and are not sent out externally. Broadcast frames get
  flooded to all other bridge ports and to the external
  interface, but when they come back from a reflective
  relay, we don't deliver them again.
  Since we know all the MAC addresses, the macvlan bridge
  mode does not require learning or STP like the bridge
  module does.

Based on an earlier patch "macvlan: Reflect macvlan packets
meant for other macvlan devices" by Eric Biederman.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Cc: Eric Biederman <ebiederm@xmission.com>
---
 drivers/net/macvlan.c |   80 ++++++++++++++++++++++++++++++++++++++++++++-----
 1 files changed, 72 insertions(+), 8 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 1e7faf9..d6bd843 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -29,9 +29,16 @@
 #include <linux/if_link.h>
 #include <linux/if_macvlan.h>
 #include <net/rtnetlink.h>
+#include <net/xfrm.h>
 
 #define MACVLAN_HASH_SIZE	(1 << BITS_PER_BYTE)
 
+enum macvlan_mode {
+	MACVLAN_MODE_PRIVATE	= 1,
+	MACVLAN_MODE_VEPA	= 2,
+	MACVLAN_MODE_BRIDGE	= 4,
+};
+
 struct macvlan_port {
 	struct net_device	*dev;
 	struct hlist_head	vlan_hash[MACVLAN_HASH_SIZE];
@@ -59,6 +66,7 @@ struct macvlan_dev {
 	struct macvlan_port	*port;
 	struct net_device	*lowerdev;
 	struct macvlan_rx_stats *rx_stats;
+	enum macvlan_mode	mode;
 };
 
 
@@ -134,11 +142,14 @@ static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
 }
 
 static int macvlan_broadcast_one(struct sk_buff *skb, struct net_device *dev,
-				 const struct ethhdr *eth)
+				 const struct ethhdr *eth, bool local)
 {
 	if (!skb)
 		return NET_RX_DROP;
 
+	if (local)
+		return dev_forward_skb(dev, skb);
+
 	skb->dev = dev;
 	if (!compare_ether_addr_64bits(eth->h_dest,
 				       dev->broadcast))
@@ -150,7 +161,9 @@ static int macvlan_broadcast_one(struct sk_buff *skb, struct net_device *dev,
 }
 
 static void macvlan_broadcast(struct sk_buff *skb,
-			      const struct macvlan_port *port)
+			      const struct macvlan_port *port,
+			      struct net_device *src,
+			      enum macvlan_mode mode)
 {
 	const struct ethhdr *eth = eth_hdr(skb);
 	const struct macvlan_dev *vlan;
@@ -164,8 +177,12 @@ static void macvlan_broadcast(struct sk_buff *skb,
 
 	for (i = 0; i < MACVLAN_HASH_SIZE; i++) {
 		hlist_for_each_entry_rcu(vlan, n, &port->vlan_hash[i], hlist) {
+			if (vlan->dev == src || !(vlan->mode & mode))
+				continue;
+
 			nskb = skb_clone(skb, GFP_ATOMIC);
-			err = macvlan_broadcast_one(nskb, vlan->dev, eth);
+			err = macvlan_broadcast_one(nskb, vlan->dev, eth,
+					 mode == MACVLAN_MODE_BRIDGE);
 			macvlan_count_rx(vlan, skb->len + ETH_HLEN,
 					 err == NET_RX_SUCCESS, 1);
 		}
@@ -178,6 +195,7 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
 	const struct ethhdr *eth = eth_hdr(skb);
 	const struct macvlan_port *port;
 	const struct macvlan_dev *vlan;
+	const struct macvlan_dev *src;
 	struct net_device *dev;
 	unsigned int len;
 
@@ -186,7 +204,25 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
 		return skb;
 
 	if (is_multicast_ether_addr(eth->h_dest)) {
-		macvlan_broadcast(skb, port);
+		src = macvlan_hash_lookup(port, eth->h_source);
+		if (!src)
+			/* frame comes from an external address */
+			macvlan_broadcast(skb, port, NULL,
+					  MACVLAN_MODE_PRIVATE |
+					  MACVLAN_MODE_VEPA    |
+					  MACVLAN_MODE_BRIDGE);
+		else if (src->mode == MACVLAN_MODE_VEPA)
+			/* flood to everyone except source */
+			macvlan_broadcast(skb, port, src->dev,
+					  MACVLAN_MODE_VEPA |
+					  MACVLAN_MODE_BRIDGE);
+		else if (src->mode == MACVLAN_MODE_BRIDGE)
+			/*
+			 * flood only to VEPA ports, bridge ports
+			 * already saw the frame on the way out.
+			 */
+			macvlan_broadcast(skb, port, src->dev,
+					  MACVLAN_MODE_VEPA);
 		return skb;
 	}
 
@@ -212,18 +248,46 @@ static struct sk_buff *macvlan_handle_frame(struct sk_buff *skb)
 	return NULL;
 }
 
+static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
+{
+	const struct macvlan_dev *vlan = netdev_priv(dev);
+	const struct macvlan_port *port = vlan->port;
+	const struct macvlan_dev *dest;
+
+	if (vlan->mode == MACVLAN_MODE_BRIDGE) {
+		const struct ethhdr *eth = (void *)skb->data;
+
+		/* send to other bridge ports directly */
+		if (is_multicast_ether_addr(eth->h_dest)) {
+			macvlan_broadcast(skb, port, dev, MACVLAN_MODE_BRIDGE);
+			goto xmit_world;
+		}
+
+		dest = macvlan_hash_lookup(port, eth->h_dest);
+		if (dest && dest->mode == MACVLAN_MODE_BRIDGE) {
+			unsigned int length = skb->len + ETH_HLEN;
+			int ret = dev_forward_skb(dest->dev, skb);
+			macvlan_count_rx(dest, length,
+					 ret == NET_RX_SUCCESS, 0);
+
+			return NET_XMIT_SUCCESS;
+		}
+	}
+
+xmit_world:
+	skb->dev = vlan->lowerdev;
+	return dev_queue_xmit(skb);
+}
+
 static netdev_tx_t macvlan_start_xmit(struct sk_buff *skb,
 				      struct net_device *dev)
 {
 	int i = skb_get_queue_mapping(skb);
 	struct netdev_queue *txq = netdev_get_tx_queue(dev, i);
-	const struct macvlan_dev *vlan = netdev_priv(dev);
 	unsigned int len = skb->len;
 	int ret;
 
-	skb->dev = vlan->lowerdev;
-	ret = dev_queue_xmit(skb);
-
+	ret = macvlan_queue_xmit(skb, dev);
 	if (likely(ret == NET_XMIT_SUCCESS)) {
 		txq->tx_packets++;
 		txq->tx_bytes += len;
-- 
1.6.3.3


^ permalink raw reply related

* [PATCHv3 0/4] macvlan: add vepa and bridge mode
From: Arnd Bergmann @ 2009-11-26 16:07 UTC (permalink / raw)
  To: netdev
  Cc: Herbert Xu, Eric Dumazet, Anna Fischer, bridge, linux-kernel,
	virtualization, Mark Smith, Gerhard Stenzel, Arnd Bergmann,
	Eric W. Biederman, Jens Osterkamp, Patrick Mullaney,
	Stephen Hemminger, David Miller, Patrick McHardy

Not many changes this time, just integrated a bug fix
and all the coding style feedback from Eric Dumazet
and Patrick McHardy.

I'll keep the patch for network namespaces on the tx
path out of this series for now, because the discussion
is still ongoing and it addresses an unrelated issue.

---

Version 2 description:
The patch to iproute2 has not changed, so I'm not including
it this time. Patch 4/4 (the netlink interface) is basically
unchanged as well but included for completeness.

The other changes have moved forward a bit, to the point where
I find them a lot cleaner and am more confident in the code
being ready for inclusion. The implementation hardly resembles
Erics original patch now, so I've dropped his signed-off-by.

Please take a look and ack if you are happy so we can get it
into 2.6.33.

---

Version 1 description:
This is based on an earlier patch from Eric Biederman adding
forwarding between macvlans. I extended his approach to
allow the administrator to choose the mode for each macvlan,
and to implement a functional VEPA between macvlan.

Still missing from this is support for communication between
the lower device that the macvlans are based on. This would
be extremely useful but as others have found out before me
requires significant changes not only to macvlan but also
to the common transmit path.

I've tested VEPA operation with the hairpin support
added to the bridge driver by Anna Fischer.

---
Arnd Bergmann (4):
  veth: move loopback logic to common location
  macvlan: cleanup rx statistics
  macvlan: implement bridge, VEPA and private mode
  macvlan: export macvlan mode through netlink

 drivers/net/macvlan.c     |  188 +++++++++++++++++++++++++++++++++++++--------
 drivers/net/veth.c        |   17 +----
 include/linux/if_link.h   |   15 ++++
 include/linux/netdevice.h |    2 +
 net/core/dev.c            |   40 ++++++++++
 5 files changed, 214 insertions(+), 48 deletions(-)


^ permalink raw reply

* [PATCHv3 4/4] macvlan: export macvlan mode through netlink
From: Arnd Bergmann @ 2009-11-26 16:07 UTC (permalink / raw)
  To: netdev
  Cc: Herbert Xu, Eric Dumazet, Anna Fischer, bridge, linux-kernel,
	virtualization, Mark Smith, Gerhard Stenzel, Arnd Bergmann,
	Eric W. Biederman, Jens Osterkamp, Patrick Mullaney,
	Stephen Hemminger, David Miller, Patrick McHardy
In-Reply-To: <1259251631-11617-1-git-send-email-arnd@arndb.de>

In order to support all three modes of macvlan at
runtime, extend the existing netlink protocol
to allow choosing the mode per macvlan slave
interface.

This depends on a matching patch to iproute2
in order to become accessible in user land.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/macvlan.c   |   56 +++++++++++++++++++++++++++++++++++++++++-----
 include/linux/if_link.h |   15 ++++++++++++
 2 files changed, 65 insertions(+), 6 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index d6bd843..322112c 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -33,12 +33,6 @@
 
 #define MACVLAN_HASH_SIZE	(1 << BITS_PER_BYTE)
 
-enum macvlan_mode {
-	MACVLAN_MODE_PRIVATE	= 1,
-	MACVLAN_MODE_VEPA	= 2,
-	MACVLAN_MODE_BRIDGE	= 4,
-};
-
 struct macvlan_port {
 	struct net_device	*dev;
 	struct hlist_head	vlan_hash[MACVLAN_HASH_SIZE];
@@ -614,6 +608,17 @@ static int macvlan_validate(struct nlattr *tb[], struct nlattr *data[])
 		if (!is_valid_ether_addr(nla_data(tb[IFLA_ADDRESS])))
 			return -EADDRNOTAVAIL;
 	}
+
+	if (data && data[IFLA_MACVLAN_MODE]) {
+		switch (nla_get_u32(data[IFLA_MACVLAN_MODE])) {
+		case MACVLAN_MODE_PRIVATE:
+		case MACVLAN_MODE_VEPA:
+		case MACVLAN_MODE_BRIDGE:
+			break;
+		default:
+			return -EINVAL;
+		}
+	}
 	return 0;
 }
 
@@ -678,6 +683,10 @@ static int macvlan_newlink(struct net *src_net, struct net_device *dev,
 	vlan->dev      = dev;
 	vlan->port     = port;
 
+	vlan->mode     = MACVLAN_MODE_VEPA;
+	if (data && data[IFLA_MACVLAN_MODE])
+		vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]);
+
 	err = register_netdevice(dev);
 	if (err < 0)
 		return err;
@@ -699,6 +708,36 @@ static void macvlan_dellink(struct net_device *dev, struct list_head *head)
 		macvlan_port_destroy(port->dev);
 }
 
+static int macvlan_changelink(struct net_device *dev,
+		struct nlattr *tb[], struct nlattr *data[])
+{
+	struct macvlan_dev *vlan = netdev_priv(dev);
+	if (data && data[IFLA_MACVLAN_MODE])
+		vlan->mode = nla_get_u32(data[IFLA_MACVLAN_MODE]);
+	return 0;
+}
+
+static size_t macvlan_get_size(const struct net_device *dev)
+{
+	return nla_total_size(4);
+}
+
+static int macvlan_fill_info(struct sk_buff *skb,
+				const struct net_device *dev)
+{
+	struct macvlan_dev *vlan = netdev_priv(dev);
+
+	NLA_PUT_U32(skb, IFLA_MACVLAN_MODE, vlan->mode);
+	return 0;
+
+nla_put_failure:
+	return -EMSGSIZE;
+}
+
+static const struct nla_policy macvlan_policy[IFLA_MACVLAN_MAX + 1] = {
+	[IFLA_MACVLAN_MODE] = { .type = NLA_U32 },
+};
+
 static struct rtnl_link_ops macvlan_link_ops __read_mostly = {
 	.kind		= "macvlan",
 	.priv_size	= sizeof(struct macvlan_dev),
@@ -707,6 +746,11 @@ static struct rtnl_link_ops macvlan_link_ops __read_mostly = {
 	.validate	= macvlan_validate,
 	.newlink	= macvlan_newlink,
 	.dellink	= macvlan_dellink,
+	.maxtype	= IFLA_MACVLAN_MAX,
+	.policy		= macvlan_policy,
+	.changelink	= macvlan_changelink,
+	.get_size	= macvlan_get_size,
+	.fill_info	= macvlan_fill_info,
 };
 
 static int macvlan_device_event(struct notifier_block *unused,
diff --git a/include/linux/if_link.h b/include/linux/if_link.h
index 1d3b242..6674791 100644
--- a/include/linux/if_link.h
+++ b/include/linux/if_link.h
@@ -181,4 +181,19 @@ struct ifla_vlan_qos_mapping {
 	__u32 to;
 };
 
+/* MACVLAN section */
+enum {
+	IFLA_MACVLAN_UNSPEC,
+	IFLA_MACVLAN_MODE,
+	__IFLA_MACVLAN_MAX,
+};
+
+#define IFLA_MACVLAN_MAX (__IFLA_MACVLAN_MAX - 1)
+
+enum macvlan_mode {
+	MACVLAN_MODE_PRIVATE = 1, /* don't talk to other macvlans */
+	MACVLAN_MODE_VEPA    = 2, /* talk to other ports through ext bridge */
+	MACVLAN_MODE_BRIDGE  = 4, /* talk to bridge ports directly */
+};
+
 #endif /* _LINUX_IF_LINK_H */
-- 
1.6.3.3

^ permalink raw reply related

* [PATCHv3 1/4] veth: move loopback logic to common location
From: Arnd Bergmann @ 2009-11-26 16:07 UTC (permalink / raw)
  To: netdev
  Cc: Herbert Xu, Eric Dumazet, Anna Fischer, bridge, linux-kernel,
	virtualization, Mark Smith, Gerhard Stenzel, Arnd Bergmann,
	Eric W. Biederman, Jens Osterkamp, Patrick Mullaney,
	Stephen Hemminger, David Miller, Patrick McHardy
In-Reply-To: <1259251631-11617-1-git-send-email-arnd@arndb.de>

The veth driver contains code to forward an skb
from the start_xmit function of one network
device into the receive path of another device.

Moving that code into a common location lets us
reuse the code for direct forwarding of data
between macvlan ports, and possibly in other
drivers.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/net/veth.c        |   17 +++--------------
 include/linux/netdevice.h |    2 ++
 net/core/dev.c            |   40 ++++++++++++++++++++++++++++++++++++++++
 3 files changed, 45 insertions(+), 14 deletions(-)

diff --git a/drivers/net/veth.c b/drivers/net/veth.c
index 2d657f2..6c4b5a2 100644
--- a/drivers/net/veth.c
+++ b/drivers/net/veth.c
@@ -155,8 +155,6 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
 	struct veth_net_stats *stats, *rcv_stats;
 	int length, cpu;
 
-	skb_orphan(skb);
-
 	priv = netdev_priv(dev);
 	rcv = priv->peer;
 	rcv_priv = netdev_priv(rcv);
@@ -168,20 +166,12 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
 	if (!(rcv->flags & IFF_UP))
 		goto tx_drop;
 
-	if (skb->len > (rcv->mtu + MTU_PAD))
-		goto rx_drop;
-
-        skb->tstamp.tv64 = 0;
-	skb->pkt_type = PACKET_HOST;
-	skb->protocol = eth_type_trans(skb, rcv);
 	if (dev->features & NETIF_F_NO_CSUM)
 		skb->ip_summed = rcv_priv->ip_summed;
 
-	skb->mark = 0;
-	secpath_reset(skb);
-	nf_reset(skb);
-
-	length = skb->len;
+	length = skb->len + ETH_HLEN;
+	if (dev_forward_skb(rcv, skb) != NET_RX_SUCCESS)
+		goto rx_drop;
 
 	stats->tx_bytes += length;
 	stats->tx_packets++;
@@ -189,7 +179,6 @@ static netdev_tx_t veth_xmit(struct sk_buff *skb, struct net_device *dev)
 	rcv_stats->rx_bytes += length;
 	rcv_stats->rx_packets++;
 
-	netif_rx(skb);
 	return NETDEV_TX_OK;
 
 tx_drop:
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 97873e3..9428793 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1562,6 +1562,8 @@ extern int		dev_set_mac_address(struct net_device *,
 extern int		dev_hard_start_xmit(struct sk_buff *skb,
 					    struct net_device *dev,
 					    struct netdev_queue *txq);
+extern int		dev_forward_skb(struct net_device *dev,
+					struct sk_buff *skb);
 
 extern int		netdev_budget;
 
diff --git a/net/core/dev.c b/net/core/dev.c
index ccefa24..f8baa15 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -105,6 +105,7 @@
 #include <net/dst.h>
 #include <net/pkt_sched.h>
 #include <net/checksum.h>
+#include <net/xfrm.h>
 #include <linux/highmem.h>
 #include <linux/init.h>
 #include <linux/kmod.h>
@@ -1419,6 +1420,45 @@ static inline void net_timestamp(struct sk_buff *skb)
 		skb->tstamp.tv64 = 0;
 }
 
+/**
+ * dev_forward_skb - loopback an skb to another netif
+ *
+ * @dev: destination network device
+ * @skb: buffer to forward
+ *
+ * return values:
+ *	NET_RX_SUCCESS	(no congestion)
+ *	NET_RX_DROP     (packet was dropped)
+ *
+ * dev_forward_skb can be used for injecting an skb from the
+ * start_xmit function of one device into the receive queue
+ * of another device.
+ *
+ * The receiving device may be in another namespace, so
+ * we have to clear all information in the skb that could
+ * impact namespace isolation.
+ */
+int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
+{
+	skb_orphan(skb);
+
+	if (!(dev->flags & IFF_UP))
+		return NET_RX_DROP;
+
+	if (skb->len > (dev->mtu + dev->hard_header_len))
+		return NET_RX_DROP;
+
+	skb_dst_drop(skb);
+	skb->tstamp.tv64 = 0;
+	skb->pkt_type = PACKET_HOST;
+	skb->protocol = eth_type_trans(skb, dev);
+	skb->mark = 0;
+	secpath_reset(skb);
+	nf_reset(skb);
+	return netif_rx(skb);
+}
+EXPORT_SYMBOL_GPL(dev_forward_skb);
+
 /*
  *	Support routine. Sends outgoing frames to any network
  *	taps currently in use.
-- 
1.6.3.3

^ permalink raw reply related

* Re: [PATCH 1/4] veth: move loopback logic to common location
From: Patrick McHardy @ 2009-11-26 15:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: David Miller, Eric W. Biederman, virtualization, Herbert Xu,
	Eric Dumazet, Anna Fischer, netdev, bridge, linux-kernel,
	Mark Smith, Gerhard Stenzel, Jens Osterkamp, Patrick Mullaney,
	Stephen Hemminger
In-Reply-To: <200911261621.28298.arnd@arndb.de>

Arnd Bergmann wrote:
> On Tuesday 24 November 2009, Patrick McHardy wrote:
>> Eric W. Biederman wrote:
>>> I don't quite follow what you intend with dev_queue_xmit when the macvlan
>>> is in one namespace and the real physical device is in another.  Are
>>> you mentioning that the packet classifier runs in the namespace where
>>> the primary device lives with packets from a different namespace?
>> Exactly. And I think we should make sure that the namespace of
>> the macvlan device can't (deliberately or accidentally) cause
>> misclassification.
> 
> This is independent of my series and a preexisting problem, right?

Correct.

> Which fields do you think need to be reset to maintain namespace
> isolation for the outbound path in macvlan?

In addition to those already handled, I'd say

- priority: affects qdisc classification, may refer to classes of the
  old namespace
- ipvs_property: might cause packets to incorrectly skip netfilter hooks
- nf_trace: might trigger packet tracing
- nf_bridge: contains references to network devices in the old NS,
  also indicates packet was bridged
- iif: index is only valid in the originating namespace
- tc_index: classification result, should only be set in the namespace
  of the classifier
- tc_verd: RTTL etc. should begin at zero again
- probably secmark.

^ permalink raw reply

* Re: [PATCH 1/4] veth: move loopback logic to common location
From: Arnd Bergmann @ 2009-11-26 15:21 UTC (permalink / raw)
  To: Patrick McHardy, David Miller
  Cc: Eric W. Biederman, virtualization, Herbert Xu, Eric Dumazet,
	Anna Fischer, netdev, bridge, linux-kernel, Mark Smith,
	Gerhard Stenzel, Jens Osterkamp, Patrick Mullaney,
	Stephen Hemminger
In-Reply-To: <4B0C2824.5010502@trash.net>

On Tuesday 24 November 2009, Patrick McHardy wrote:
> Eric W. Biederman wrote:
> > I don't quite follow what you intend with dev_queue_xmit when the macvlan
> > is in one namespace and the real physical device is in another.  Are
> > you mentioning that the packet classifier runs in the namespace where
> > the primary device lives with packets from a different namespace?
> 
> Exactly. And I think we should make sure that the namespace of
> the macvlan device can't (deliberately or accidentally) cause
> misclassification.

This is independent of my series and a preexisting problem, right?

Which fields do you think need to be reset to maintain namespace
isolation for the outbound path in macvlan?
---
net: maintain namespace isolation between vlan and real device

In the vlan and macvlan drivers, the start_xmit function forwards
data to the dev_queue_xmit function for another device, which may
potentially belong to a different namespace.

To make sure that classification stays within a single namespace,
this resets the potentially critical fields.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>

---
 drivers/net/macvlan.c     |    2 +-
 include/linux/netdevice.h |    9 +++++++++
 net/8021q/vlan_dev.c      |    2 +-
 net/core/dev.c            |   26 ++++++++++++++++++++++----
 4 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 322112c..edcebf1 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -269,7 +269,7 @@ static int macvlan_queue_xmit(struct sk_buff *skb, struct net_device *dev)
 	}
 
 xmit_world:
-	skb->dev = vlan->lowerdev;
+	skb_set_dev(skb, vlan->lowerdev);
 	return dev_queue_xmit(skb);
 }
 
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 9428793..fdf4a1a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1009,6 +1009,15 @@ static inline bool netdev_uses_dsa_tags(struct net_device *dev)
 	return 0;
 }
 
+#ifdef CONFIG_NET_NS
+static inline void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
+{
+	skb->dev = dev;
+}
+#else /* CONFIG_NET_NS */
+void skb_set_dev(struct sk_buff *skb, struct net_device *dev);
+#endif
+
 static inline bool netdev_uses_trailer_tags(struct net_device *dev)
 {
 #ifdef CONFIG_NET_DSA_TAG_TRAILER
diff --git a/net/8021q/vlan_dev.c b/net/8021q/vlan_dev.c
index de0dc6b..51fcfff 100644
--- a/net/8021q/vlan_dev.c
+++ b/net/8021q/vlan_dev.c
@@ -323,7 +323,7 @@ static netdev_tx_t vlan_dev_hard_start_xmit(struct sk_buff *skb,
 	}
 
 
-	skb->dev = vlan_dev_info(dev)->real_dev;
+	skb_set_dev(skb, vlan_dev_info(dev)->real_dev);
 	len = skb->len;
 	ret = dev_queue_xmit(skb);
 
diff --git a/net/core/dev.c b/net/core/dev.c
index f8baa15..7179b58 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1448,13 +1448,10 @@ int dev_forward_skb(struct net_device *dev, struct sk_buff *skb)
 	if (skb->len > (dev->mtu + dev->hard_header_len))
 		return NET_RX_DROP;
 
-	skb_dst_drop(skb);
+	skb_set_dev(skb, dev);
 	skb->tstamp.tv64 = 0;
 	skb->pkt_type = PACKET_HOST;
 	skb->protocol = eth_type_trans(skb, dev);
-	skb->mark = 0;
-	secpath_reset(skb);
-	nf_reset(skb);
 	return netif_rx(skb);
 }
 EXPORT_SYMBOL_GPL(dev_forward_skb);
@@ -1614,6 +1611,27 @@ static bool dev_can_checksum(struct net_device *dev, struct sk_buff *skb)
 	return false;
 }
 
+/**
+ * skb_dev_set -- assign a buffer to a new device
+ * @skb: buffer for the new device
+ * @dev: network device
+ *
+ * If an skb is owned by a device already, we have to reset
+ * all data private to the namespace a device belongs to
+ * before assigning it a new device.
+ */
+void skb_set_dev(struct sk_buff *skb, struct net_device *dev)
+{
+	if (skb->dev && !net_eq(dev_net(skb->dev), dev_net(dev))) {
+		secpath_reset(skb);
+		skb_dst_drop(skb);
+		nf_reset(skb);
+		skb->mark = 0;
+	}
+	skb->dev = dev;
+}
+EXPORT_SYMBOL(skb_set_dev);
+
 /*
  * Invalidate hardware checksum when packet is to be mangled, and
  * complete checksum manually on outgoing path.

^ permalink raw reply related

* Re: Diagnostic Monitoring Interface Monitoring (DOM) PATCH 0/5 for net-next-2.6
From: robert @ 2009-11-26 15:11 UTC (permalink / raw)
  To: Joe Perches; +Cc: robert, Jeff Kirsher, David Miller, netdev
In-Reply-To: <1259181525.29779.69.camel@Joe-Laptop.home>



Joe Perches writes:
 > Here's another attempt as a complete patch.

 Thanks a lot Joe!
 Yes much nicer... and gives the same result.

 Signed-off-by: Robert Olsson <robert.olsson@its.uu.se>

 Cheers
					--ro


 > 
 > Differences from Robert's original:
 > 
 > Whitespace cleanups
 > Changed presumed coding error from:
 > 	if (type & DOM_TYPE_DOM & DOM_TYPE_ADDR_CHNGE) {
 > to:
 > 	if (type & DOM_TYPE_ADDR_CHNGE)  {
 > Added read_phy_diag_u32 function
 > Refactored multiple sequential register reads to
 > for loop over struct array with register read
 > 
 > Functional difference from my original patch:
 > Fixed ARRAY_SIZE(basic) misuse
 > 
 > Reduces code size:
 > 
 > was:
 > $ size drivers/net/igb/igb_ethtool.o drivers/net/ixgbe/ixgbe_ethtool.o
 >    text    data     bss     dec     hex filename
 >   26466    1544    8584   36594    8ef2 drivers/net/igb/igb_ethtool.o
 >   31726    2980    9128   43834    ab3a drivers/net/ixgbe/ixgbe_ethtool.o
 > 
 > is:
 > $ size drivers/net/igb/igb_ethtool.o drivers/net/ixgbe/ixgbe_ethtool.o
 >    text	   data	    bss	    dec	    hex	filename
 >   24642	   1544	   8008	  34194	   8592	drivers/net/igb/igb_ethtool.o
 >   29922	   2980	   8560	  41462	   a1f6	drivers/net/ixgbe/ixgbe_ethtool.o
 > 
 > Signed-off-by: Joe Perches <joe@perches.com>
 > 
 >  Documentation/networking/dom.txt  |   41 ++++++++
 >  drivers/net/igb/igb_ethtool.c     |  191 +++++++++++++++++++++++++++++++++++++
 >  drivers/net/ixgbe/ixgbe_ethtool.c |  171 +++++++++++++++++++++++++++++++++-
 >  include/linux/ethtool.h           |   49 ++++++++++
 >  include/net/dom.h                 |  109 +++++++++++++++++++++
 >  net/core/ethtool.c                |   18 ++++
 >  6 files changed, 578 insertions(+), 1 deletions(-)
 > 
 > diff --git a/Documentation/networking/dom.txt b/Documentation/networking/dom.txt
 > new file mode 100644
 > index 0000000..4bf24de
 > --- /dev/null
 > +++ b/Documentation/networking/dom.txt
 > @@ -0,0 +1,41 @@
 > +Diagnostic Monitoring Interface Monitoring also called DOM is a specification
 > +for optical transceivers to allow link and other diagnostics related to the
 > +transceiver's to standardized and communicated. For communication the I2C
 > +bus is used. The SFF specifications is available at ftp://ftp.seagate.com/
 > +Specification is generic and should work for many types of optical modules
 > +as GBIC, SFP, SFp+, XFP etc
 > +
 > +In short DOM spec adds a memory page where the diagnostics's is kept (address
 > +0xA2 bytes 66 to 105) but there are lot's of option's and variants. For example
 > +alarm and warnings are optional. See example below.
 > +
 > +Not all SFP's (SFP is for GIGE) have DOM support normally long range supports
 > +DOM. And of course your board and driver needs this support too.
 > +For SFP+ (10G) DOM is mandatory.
 > +
 > +Linux kernel support is via ethertool.
 > +
 > +include/net/dom.h        # Basic definitions
 > +net/core/ethtool.c       # adds ethtool_phy_diag()
 > +include/linux/ethtool.h  # adds ETHTOOL_GPHYDIAG
 > +
 > +And drivers hooks exists currently in igb and ixgbe driver
 > +
 > +Usage example: ethtool -D eth5
 > +
 > +Ext-Calbr: Avr RX-Power: Alarm & Warn: RX_LOS: 	Wavelength: 1310 nm
 > +Alarms, warnings in beginning of line, Ie. AH = Alarm High, WL == Warn Low etc
 > +	Temp:  35.9 C			Thresh: Lo: -12.0/-8.0   Hi: 103.0/110.0 C
 > +	Vcc:  3.33 V			Thresh: Lo:   3.0/3.0    Hi:   3.7/4.0   V
 > +	Tx-Bias:  13.4 mA		Thresh: Lo:   2.0/4.0    Hi:  70.0/84.0  mA
 > +ALWL	TX-pwr:  -5.9 dBm ( 0.26 mW)	Thresh: Lo:  -4.0/-2.0   Hi:   7.0/8.2   dBm
 > +AHWH	RX-pwr:  -5.0 dBm ( 0.31 mW) 	Thresh: Lo: -35.2/-28.0  Hi:  -8.2/-6.0  dBm
 > +
 > +
 > +First line shows the options supported by the module. As we see this module
 > +supports Alarms and warnings as a consequence thresholds are printed. As example
 > +RX-pwr: -35.2 < no_alarm < -6.0 dBm and -28.0 < no_warning < -8.2 dBm. (dBm yields
 > +1 mW == 0 dBm)
 > +
 > +In the example above we see both warnings for both TX-pwr (low) and RX-Pwr high.
 > +The Rx side would need some attenuation.
 > diff --git a/drivers/net/igb/igb_ethtool.c b/drivers/net/igb/igb_ethtool.c
 > index ac9d527..63a297d 100644
 > --- a/drivers/net/igb/igb_ethtool.c
 > +++ b/drivers/net/igb/igb_ethtool.c
 > @@ -34,6 +34,7 @@
 >  #include <linux/interrupt.h>
 >  #include <linux/if_ether.h>
 >  #include <linux/ethtool.h>
 > +#include <net/dom.h>
 >  #include <linux/sched.h>
 >  
 >  #include "igb.h"
 > @@ -2063,6 +2064,195 @@ static void igb_get_strings(struct net_device *netdev, u32 stringset, u8 *data)
 >  	}
 >  }
 >  
 > +static s32 read_phy_diag(struct e1000_hw *hw, u8 page, u8 offset, u16 *data)
 > +{
 > +	u32 i, i2ccmd = 0;
 > +
 > +	if (offset > E1000_MAX_SGMII_PHY_REG_ADDR) {
 > +		hw_dbg("DOM Register Address %u is out of range\n", offset);
 > +		return -E1000_ERR_PARAM;
 > +	}
 > +
 > +	/*
 > +	 * Set up Op-code, Phy Address, and register address in the I2CCMD
 > +	 * register.  The MAC will take care of interfacing with the
 > +	 * PHY to retrieve the desired data.
 > +	 */
 > +
 > +	i2ccmd = (E1000_I2CCMD_OPCODE_READ) |
 > +		 (page << E1000_I2CCMD_PHY_ADDR_SHIFT) |
 > +		 (offset << E1000_I2CCMD_REG_ADDR_SHIFT);
 > +
 > +	wr32(E1000_I2CCMD, i2ccmd);
 > +
 > +	/* Poll the ready bit to see if the I2C read completed */
 > +	for (i = 0; i < E1000_I2CCMD_PHY_TIMEOUT; i++) {
 > +		udelay(50);
 > +		i2ccmd = rd32(E1000_I2CCMD);
 > +		//printk("DATA i2ccmd=0x%x\n", i2ccmd);
 > +		if (i2ccmd & E1000_I2CCMD_READY)
 > +			break;
 > +	}
 > +	if (!(i2ccmd & E1000_I2CCMD_READY)) {
 > +		hw_dbg("I2CCMD Read did not complete\n");
 > +		return -E1000_ERR_PHY;
 > +	}
 > +	if (i2ccmd & E1000_I2CCMD_ERROR) {
 > +		hw_dbg("I2CCMD Error bit set\n");
 > +		return -E1000_ERR_PHY;
 > +	}
 > +
 > +	/* Need to byte-swap the 16-bit value. */
 > +	*data = ((i2ccmd >> 8) & 0x00FF) | ((i2ccmd << 8) & 0xFF00);
 > +	return 0;
 > +}
 > +
 > +static s32 read_phy_diag_u32(struct e1000_hw *hw, u8 page, u8 offset, u32 *data)
 > +{
 > +	u16 p1;
 > +	u16 p2;
 > +	s32 res;
 > +
 > +	res = read_phy_diag(hw, page, offset, &p1);
 > +	if (res)
 > +		goto out;
 > +
 > +	res = read_phy_diag(hw, page, offset + 2, &p2);
 > +	if (res)
 > +		goto out;
 > +
 > +	*data = ((u32)p1) << 16 | p2;
 > +
 > +out:
 > +	return res;
 > +}
 > +
 > +struct reg_offset {
 > +	int reg;
 > +	size_t offset;
 > +};
 > +
 > +#define REG_OFFSET(a, b) \
 > +	{ .reg = a, .offset = offsetof(struct ethtool_phy_diag, b) }
 > +
 > +int igb_get_phy_diag(struct net_device *netdev, struct ethtool_phy_diag *pd)
 > +{
 > +	struct igb_adapter *adapter = netdev_priv(netdev);
 > +	struct e1000_hw *hw = &adapter->hw;
 > +	int res;
 > +	u8 type, eo;
 > +	int i;
 > +
 > +	static const struct reg_offset basic[] = {
 > +		REG_OFFSET(DOM_A2_TEMP, temp),
 > +		REG_OFFSET(DOM_A2_TEMP_SLOPE, temp_slope),
 > +		REG_OFFSET(DOM_A2_TEMP_OFFSET, temp_offset),
 > +		REG_OFFSET(DOM_A2_VCC, vcc),
 > +		REG_OFFSET(DOM_A2_VCC_SLOPE, vcc_slope),
 > +		REG_OFFSET(DOM_A2_VCC_OFFSET, vcc_offset),
 > +		REG_OFFSET(DOM_A2_TX_BIAS, tx_bias),
 > +		REG_OFFSET(DOM_A2_TX_I_SLOPE, tx_bias_slope),
 > +		REG_OFFSET(DOM_A2_TX_I_OFFSET, tx_bias_offset),
 > +		REG_OFFSET(DOM_A2_TX_PWR, tx_pwr),
 > +		REG_OFFSET(DOM_A2_TX_PWR_SLOPE, tx_pwr_slope),
 > +		REG_OFFSET(DOM_A2_TX_PWR_OFFSET, tx_pwr_offset),
 > +		REG_OFFSET(DOM_A2_RX_PWR, rx_pwr),
 > +	};
 > +
 > +	static const struct reg_offset power[] = {
 > +		REG_OFFSET(DOM_A2_RX_PWR_0, rx_pwr_cal[0]),
 > +		REG_OFFSET(DOM_A2_RX_PWR_1, rx_pwr_cal[1]),
 > +		REG_OFFSET(DOM_A2_RX_PWR_2, rx_pwr_cal[2]),
 > +		REG_OFFSET(DOM_A2_RX_PWR_3, rx_pwr_cal[3]),
 > +		REG_OFFSET(DOM_A2_RX_PWR_4, rx_pwr_cal[4]),
 > +	};
 > +
 > +	static const struct reg_offset aw[] = {
 > +		REG_OFFSET(DOM_A2_TEMP_AHT, temp_aht),
 > +		REG_OFFSET(DOM_A2_TEMP_ALT, temp_alt),
 > +		REG_OFFSET(DOM_A2_TEMP_WHT, temp_wht),
 > +		REG_OFFSET(DOM_A2_TEMP_WLT, temp_wlt),
 > +		REG_OFFSET(DOM_A2_VCC_AHT, vcc_aht),
 > +		REG_OFFSET(DOM_A2_VCC_ALT, vcc_alt),
 > +		REG_OFFSET(DOM_A2_VCC_WHT, vcc_wht),
 > +		REG_OFFSET(DOM_A2_VCC_WLT, vcc_wlt),
 > +		REG_OFFSET(DOM_A2_TX_BIAS_AHT, tx_bias_aht),
 > +		REG_OFFSET(DOM_A2_TX_BIAS_ALT, tx_bias_alt),
 > +		REG_OFFSET(DOM_A2_TX_BIAS_WHT, tx_bias_wht),
 > +		REG_OFFSET(DOM_A2_TX_BIAS_WLT, tx_bias_wlt),
 > +		REG_OFFSET(DOM_A2_TX_PWR_AHT, tx_pwr_aht),
 > +		REG_OFFSET(DOM_A2_TX_PWR_ALT, tx_pwr_alt),
 > +		REG_OFFSET(DOM_A2_TX_PWR_WHT, tx_pwr_wht),
 > +		REG_OFFSET(DOM_A2_TX_PWR_WLT, tx_pwr_wlt),
 > +		REG_OFFSET(DOM_A2_RX_PWR_AHT, rx_pwr_aht),
 > +		REG_OFFSET(DOM_A2_RX_PWR_ALT, rx_pwr_alt),
 > +		REG_OFFSET(DOM_A2_RX_PWR_WHT, rx_pwr_wht),
 > +		REG_OFFSET(DOM_A2_RX_PWR_WLT, rx_pwr_wlt),
 > +	};
 > +
 > +	res = read_phy_diag(hw, 0x0, DOM_A0_DOM_TYPE, &pd->type);
 > +	if (res)
 > +		goto out;
 > +
 > +	type = pd->type >> 8;
 > +
 > +	if ((~type & DOM_TYPE_DOM) || (type & DOM_TYPE_LEGAGY_DOM))
 > +		goto out;
 > +
 > +	if (type & DOM_TYPE_ADDR_CHNGE) {
 > +		hw_dbg("DOM module not supported (Address change)\n");
 > +		goto out;
 > +	}
 > +
 > +	eo = pd->type & 0xFF;
 > +
 > +	res = read_phy_diag(hw, 0x0, DOM_A0_WAVELENGTH, &pd->wavelength);
 > +	if (res)
 > +		goto out;
 > +
 > +	/* If supported. Read alarms and Warnings first*/
 > +	if (eo & DOM_EO_AW) {
 > +		res = read_phy_diag(hw, 0x1, DOM_A2_ALARM, &pd->alarm);
 > +		if (res)
 > +			goto out;
 > +		res = read_phy_diag(hw, 0x1, DOM_A2_WARNING, &pd->warning);
 > +		if (res)
 > +			goto out;
 > +	}
 > +
 > +	/* Basic diag */
 > +
 > +	for (i = 0; i < ARRAY_SIZE(basic); i++) {
 > +		res = read_phy_diag(hw, 0x1, basic[i].reg,
 > +				    (u16 *)((char *)pd + basic[i].offset));
 > +		if (res)
 > +			goto out;
 > +	}
 > +
 > +	/* Power */
 > +
 > +	for (i = 0; i < ARRAY_SIZE(power); i++) {
 > +		res = read_phy_diag_u32(hw, 0x1, power[i].reg,
 > +					(u32 *)((char *)pd + power[i].offset));
 > +		if (res)
 > +			goto out;
 > +	}
 > +
 > +	/* Thresholds for Alarms and Warnings */
 > +
 > +	if (eo & DOM_EO_AW) {
 > +		for (i = 0; i < ARRAY_SIZE(aw); i++) {
 > +			res = read_phy_diag(hw, 0x1, aw[i].reg,
 > +					    (u16 *)((char *)pd + aw[i].offset));
 > +			if (res)
 > +				goto out;
 > +		}
 > +	}
 > +
 > +out:
 > +	return res;
 > +}
 > +
 >  static const struct ethtool_ops igb_ethtool_ops = {
 >  	.get_settings           = igb_get_settings,
 >  	.set_settings           = igb_set_settings,
 > @@ -2097,6 +2287,7 @@ static const struct ethtool_ops igb_ethtool_ops = {
 >  	.get_ethtool_stats      = igb_get_ethtool_stats,
 >  	.get_coalesce           = igb_get_coalesce,
 >  	.set_coalesce           = igb_set_coalesce,
 > +	.get_phy_diag           = igb_get_phy_diag,
 >  };
 >  
 >  void igb_set_ethtool_ops(struct net_device *netdev)
 > diff --git a/drivers/net/ixgbe/ixgbe_ethtool.c b/drivers/net/ixgbe/ixgbe_ethtool.c
 > index 84ab4db..8435cd7 100644
 > --- a/drivers/net/ixgbe/ixgbe_ethtool.c
 > +++ b/drivers/net/ixgbe/ixgbe_ethtool.c
 > @@ -34,9 +34,11 @@
 >  #include <linux/ethtool.h>
 >  #include <linux/vmalloc.h>
 >  #include <linux/uaccess.h>
 > +#include <net/dom.h>
 >  
 >  #include "ixgbe.h"
 > -
 > +#include "ixgbe_phy.h"
 > +#include "ixgbe_common.h"
 >  
 >  #define IXGBE_ALL_RAR_ENTRIES 16
 >  
 > @@ -2106,6 +2108,172 @@ static int ixgbe_set_flags(struct net_device *netdev, u32 data)
 >  
 >  }
 >  
 > +static s32 read_phy_diag(struct ixgbe_hw *hw, u8 page, u8 offset, u16 *data)
 > +{
 > +	s32 status;
 > +	u8 hi, lo;
 > +
 > +	status = ixgbe_read_i2c_byte_generic(hw, page, offset, &hi);
 > +	if (status)
 > +		goto out;
 > +
 > +	status = ixgbe_read_i2c_byte_generic(hw, page, offset, &lo);
 > +	if (status)
 > +		goto out;
 > +
 > +	*data = (((u16)hi) << 8) | lo;
 > +
 > +out:
 > +	return status;
 > +}
 > +
 > +static s32 read_phy_diag_u32(struct ixgbe_hw *hw, u8 page, u8 offset, u32 *data)
 > +{
 > +	u16 p1;
 > +	u16 p2;
 > +	s32 res;
 > +
 > +	res = read_phy_diag(hw, page, offset, &p1);
 > +	if (res)
 > +		goto out;
 > +
 > +	res = read_phy_diag(hw, page, offset + 2, &p2);
 > +	if (res)
 > +		goto out;
 > +
 > +	*data = ((u32)p1) << 16 | p2;
 > +
 > +out:
 > +	return res;
 > +}
 > +
 > +struct reg_offset {
 > +	int reg;
 > +	size_t offset;
 > +};
 > +
 > +#define REG_OFFSET(a, b) \
 > +	{ .reg = a, .offset = offsetof(struct ethtool_phy_diag, b) }
 > +
 > +int ixgb_get_phy_diag(struct net_device *netdev, struct ethtool_phy_diag *pd)
 > +{
 > +	struct ixgbe_adapter *adapter = netdev_priv(netdev);
 > +	struct ixgbe_hw *hw = &adapter->hw;
 > +	int res;
 > +	u8 type, eo;
 > +	int i;
 > +
 > +	static const struct reg_offset basic[] = {
 > +		REG_OFFSET(DOM_A2_TEMP, temp),
 > +		REG_OFFSET(DOM_A2_TEMP_SLOPE, temp_slope),
 > +		REG_OFFSET(DOM_A2_TEMP_OFFSET, temp_offset),
 > +		REG_OFFSET(DOM_A2_VCC, vcc),
 > +		REG_OFFSET(DOM_A2_VCC_SLOPE, vcc_slope),
 > +		REG_OFFSET(DOM_A2_VCC_OFFSET, vcc_offset),
 > +		REG_OFFSET(DOM_A2_TX_BIAS, tx_bias),
 > +		REG_OFFSET(DOM_A2_TX_I_SLOPE, tx_bias_slope),
 > +		REG_OFFSET(DOM_A2_TX_I_OFFSET, tx_bias_offset),
 > +		REG_OFFSET(DOM_A2_TX_PWR, tx_pwr),
 > +		REG_OFFSET(DOM_A2_TX_PWR_SLOPE, tx_pwr_slope),
 > +		REG_OFFSET(DOM_A2_TX_PWR_OFFSET, tx_pwr_offset),
 > +		REG_OFFSET(DOM_A2_RX_PWR, rx_pwr),
 > +	};
 > +
 > +	static const struct reg_offset power[] = {
 > +		REG_OFFSET(DOM_A2_RX_PWR_0, rx_pwr_cal[0]),
 > +		REG_OFFSET(DOM_A2_RX_PWR_1, rx_pwr_cal[1]),
 > +		REG_OFFSET(DOM_A2_RX_PWR_2, rx_pwr_cal[2]),
 > +		REG_OFFSET(DOM_A2_RX_PWR_3, rx_pwr_cal[3]),
 > +		REG_OFFSET(DOM_A2_RX_PWR_4, rx_pwr_cal[4]),
 > +	};
 > +
 > +	static const struct reg_offset aw[] = {
 > +		REG_OFFSET(DOM_A2_TEMP_AHT, temp_aht),
 > +		REG_OFFSET(DOM_A2_TEMP_ALT, temp_alt),
 > +		REG_OFFSET(DOM_A2_TEMP_WHT, temp_wht),
 > +		REG_OFFSET(DOM_A2_TEMP_WLT, temp_wlt),
 > +		REG_OFFSET(DOM_A2_VCC_AHT, vcc_aht),
 > +		REG_OFFSET(DOM_A2_VCC_ALT, vcc_alt),
 > +		REG_OFFSET(DOM_A2_VCC_WHT, vcc_wht),
 > +		REG_OFFSET(DOM_A2_VCC_WLT, vcc_wlt),
 > +		REG_OFFSET(DOM_A2_TX_BIAS_AHT, tx_bias_aht),
 > +		REG_OFFSET(DOM_A2_TX_BIAS_ALT, tx_bias_alt),
 > +		REG_OFFSET(DOM_A2_TX_BIAS_WHT, tx_bias_wht),
 > +		REG_OFFSET(DOM_A2_TX_BIAS_WLT, tx_bias_wlt),
 > +		REG_OFFSET(DOM_A2_TX_PWR_AHT, tx_pwr_aht),
 > +		REG_OFFSET(DOM_A2_TX_PWR_ALT, tx_pwr_alt),
 > +		REG_OFFSET(DOM_A2_TX_PWR_WHT, tx_pwr_wht),
 > +		REG_OFFSET(DOM_A2_TX_PWR_WLT, tx_pwr_wlt),
 > +		REG_OFFSET(DOM_A2_RX_PWR_AHT, rx_pwr_aht),
 > +		REG_OFFSET(DOM_A2_RX_PWR_ALT, rx_pwr_alt),
 > +		REG_OFFSET(DOM_A2_RX_PWR_WHT, rx_pwr_wht),
 > +		REG_OFFSET(DOM_A2_RX_PWR_WLT, rx_pwr_wlt),
 > +	};
 > +
 > +	res = read_phy_diag(hw, 0x0, DOM_A0_DOM_TYPE, &pd->type);
 > +	if (res)
 > +		goto out;
 > +
 > +	type = pd->type >> 8;
 > +
 > +	if ((~type & DOM_TYPE_DOM) || (type & DOM_TYPE_LEGAGY_DOM))
 > +		goto out;
 > +
 > +	if (type & DOM_TYPE_ADDR_CHNGE)  {
 > +		hw_dbg(hw, "DOM module not supported (Address change)\n");
 > +		goto out;
 > +	}
 > +
 > +	eo = pd->type & 0xFF;
 > +
 > +	res = read_phy_diag(hw, 0x0, DOM_A0_WAVELENGTH, &pd->wavelength);
 > +	if (res)
 > +		goto out;
 > +
 > +	/* If supported. Read alarms and Warnings first*/
 > +	if (eo & DOM_EO_AW) {
 > +		res = read_phy_diag(hw, 0x1, DOM_A2_ALARM, &pd->alarm);
 > +		if (res)
 > +			goto out;
 > +
 > +		res = read_phy_diag(hw, 0x1, DOM_A2_WARNING, &pd->warning);
 > +		if (res)
 > +			goto out;
 > +	}
 > +
 > +	/* Basic diag */
 > +
 > +	for (i = 0; i < ARRAY_SIZE(basic); i++) {
 > +		res = read_phy_diag(hw, 0x1, basic[i].reg,
 > +				    (u16 *)((char *)pd + basic[i].offset));
 > +		if (res)
 > +			goto out;
 > +	}
 > +
 > +	/* Power */
 > +
 > +	for (i = 0; i < ARRAY_SIZE(power); i++) {
 > +		res = read_phy_diag_u32(hw, 0x1, power[i].reg,
 > +					(u32 *)((char *)pd + power[i].offset));
 > +		if (res)
 > +			goto out;
 > +	}
 > +
 > +	/* Thresholds for Alarms and Warnings */
 > +
 > +	if (eo & DOM_EO_AW) {
 > +		for (i = 0; i < ARRAY_SIZE(aw); i++) {
 > +			res = read_phy_diag(hw, 0x1, aw[i].reg,
 > +					    (u16 *)((char *)pd + aw[i].offset));
 > +			if (res)
 > +				goto out;
 > +		}
 > +	}
 > +
 > +out:
 > +	return res;
 > +}
 > +
 >  static const struct ethtool_ops ixgbe_ethtool_ops = {
 >  	.get_settings           = ixgbe_get_settings,
 >  	.set_settings           = ixgbe_set_settings,
 > @@ -2141,6 +2309,7 @@ static const struct ethtool_ops ixgbe_ethtool_ops = {
 >  	.set_coalesce           = ixgbe_set_coalesce,
 >  	.get_flags              = ethtool_op_get_flags,
 >  	.set_flags              = ixgbe_set_flags,
 > +	.get_phy_diag           = ixgb_get_phy_diag,
 >  };
 >  
 >  void ixgbe_set_ethtool_ops(struct net_device *netdev)
 > diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
 > index edd03b7..4e45a94 100644
 > --- a/include/linux/ethtool.h
 > +++ b/include/linux/ethtool.h
 > @@ -272,6 +272,53 @@ struct ethtool_stats {
 >  	__u64	data[0];
 >  };
 >  
 > +/* Diagmostic Monitoring Interface Data -- DOM */
 > +struct ethtool_phy_diag {
 > +	__u32 cmd;
 > +	/* A0 page */
 > +	__u16 type;
 > +	__u16 wavelength;
 > +	/* A2 page */
 > +	__u16 alarm;
 > +	__u16 warning;
 > +	__s16 temp;
 > +	__u16 temp_slope;
 > +	__s16 temp_offset;
 > +	__u16 vcc;
 > +	__u16 vcc_slope;
 > +	__s16 vcc_offset;
 > +	__u16 tx_bias;
 > +	__u16 tx_bias_slope;
 > +	__s16 tx_bias_offset;
 > +	__u16 tx_pwr;
 > +	__u16 tx_pwr_slope;
 > +	__s16 tx_pwr_offset;
 > +	__u16 rx_pwr;
 > +	__u32 rx_pwr_cal[5];
 > +
 > +	/* Thresholds */
 > +	__s16 temp_alt;
 > +	__s16 temp_aht;
 > +	__s16 temp_wlt;
 > +	__s16 temp_wht;
 > +	__u16 vcc_alt;
 > +	__u16 vcc_aht;
 > +	__u16 vcc_wlt;
 > +	__u16 vcc_wht;
 > +	__u16 tx_bias_alt;
 > +	__u16 tx_bias_aht;
 > +	__u16 tx_bias_wlt;
 > +	__u16 tx_bias_wht;
 > +	__u16 tx_pwr_alt;
 > +	__u16 tx_pwr_aht;
 > +	__u16 tx_pwr_wlt;
 > +	__u16 tx_pwr_wht;
 > +	__u16 rx_pwr_alt;
 > +	__u16 rx_pwr_aht;
 > +	__u16 rx_pwr_wlt;
 > +	__u16 rx_pwr_wht;
 > +};
 > +
 >  struct ethtool_perm_addr {
 >  	__u32	cmd;		/* ETHTOOL_GPERMADDR */
 >  	__u32	size;
 > @@ -499,6 +546,7 @@ struct ethtool_ops {
 >  	int	(*set_rxnfc)(struct net_device *, struct ethtool_rxnfc *);
 >  	int     (*flash_device)(struct net_device *, struct ethtool_flash *);
 >  	int	(*reset)(struct net_device *, u32 *);
 > +	int     (*get_phy_diag)(struct net_device *, struct ethtool_phy_diag *);
 >  };
 >  #endif /* __KERNEL__ */
 >  
 > @@ -557,6 +605,7 @@ struct ethtool_ops {
 >  #define	ETHTOOL_SRXCLSRLINS	0x00000032 /* Insert RX classification rule */
 >  #define	ETHTOOL_FLASHDEV	0x00000033 /* Flash firmware to device */
 >  #define	ETHTOOL_RESET		0x00000034 /* Reset hardware */
 > +#define	ETHTOOL_GPHYDIAG	0x00000035 /* Get PHY diagnostics */
 >  
 >  /* compatibility with older code */
 >  #define SPARC_ETH_GSET		ETHTOOL_GSET
 > diff --git a/include/net/dom.h b/include/net/dom.h
 > new file mode 100644
 > index 0000000..61540c3
 > --- /dev/null
 > +++ b/include/net/dom.h
 > @@ -0,0 +1,109 @@
 > +#ifndef _LINUX_DOM_H
 > +#define _LINUX_DOM_H
 > +
 > +/*
 > +   Diagnostic Monitoring Interface for Optical Tranceivers
 > +   SFF-8472 v. 10.4 (Jan 2009)
 > +   ftp://ftp.seagate.com/sff/SFF-8472.PDF
 > +
 > +   Licensce GPL. Copyright Robert Olsson robert@herjulf.net
 > +*/
 > +
 > +#define  DOM_A0_IDENTIFIER  0
 > +#define  DOM_A0_WAVELENGTH 60
 > +#define  DOM_A0_CC_BASE    63
 > +#define  DOM_A0_DOM_TYPE   92
 > +
 > +/* DOM_TYPE codings in DOM_A0_DOM_TYPE */
 > +#define     DOM_TYPE_LEGAGY_DOM     (1<<7)
 > +#define     DOM_TYPE_DOM            (1<<6)  /* Has DOM support */
 > +#define     DOM_TYPE_INT_CAL        (1<<5)  /* Internally calibrated */
 > +#define     DOM_TYPE_EXT_CAL        (1<<4)  /* Externally calibrated */
 > +#define     DOM_TYPE_RX_PWR         (1<<3)  /* Received Power OMA=0,  1=average */
 > +#define     DOM_TYPE_ADDR_CHNGE     (1<<2)  /* Address change required */
 > +
 > +#define  DOM_A0_EO   93                     /* Enhanced options */
 > +#define     DOM_EO_AW               (1<<7)  /* Alarm & Warnings */
 > +#define     DOM_EO_TX_DISABLE       (1<<6)
 > +#define     DOM_EO_TX_FAULT         (1<<5)
 > +#define     DOM_EO_RX_LOS           (1<<4)
 > +#define     DOM_EO_RATE_SELECT_MON  (1<<3)
 > +#define     DOM_EO_APP_SELECT       (1<<2)
 > +#define     DOM_EO_RATE_SELECT      (1<<1)
 > +
 > +#define  DOM_A0_CC_EXT     95
 > +
 > +#define  DOM_A2_TEMP_AHT    0  /* Temp alarm high threshold */
 > +#define  DOM_A2_TEMP_ALT    2
 > +#define  DOM_A2_TEMP_WHT    4  /* Temp warning high threshold */
 > +#define  DOM_A2_TEMP_WLT    6
 > +
 > +#define  DOM_A2_VCC_AHT    8  /* VCC alarm high threshold */
 > +#define  DOM_A2_VCC_ALT   10
 > +#define  DOM_A2_VCC_WHT   12  /* VCC warning high threshold */
 > +#define  DOM_A2_VCC_WLT   14
 > +
 > +#define  DOM_A2_TX_BIAS_AHT   16  /* TX_BIAS alarm high threshold */
 > +#define  DOM_A2_TX_BIAS_ALT   18
 > +#define  DOM_A2_TX_BIAS_WHT   20  /* TX_BIAS warning high threshold */
 > +#define  DOM_A2_TX_BIAS_WLT   22
 > +
 > +#define  DOM_A2_TX_PWR_AHT   24  /* TX_PWR alarm high threshold */
 > +#define  DOM_A2_TX_PWR_ALT   26
 > +#define  DOM_A2_TX_PWR_WHT   28  /* TX_PWR warning high threshold */
 > +#define  DOM_A2_TX_PWR_WLT   30
 > +
 > +#define  DOM_A2_RX_PWR_AHT   32  /* RX_PWR alarm high threshold */
 > +#define  DOM_A2_RX_PWR_ALT   34
 > +#define  DOM_A2_RX_PWR_WHT   36  /* RX_PWR warning high threshold */
 > +#define  DOM_A2_RX_PWR_WLT   38
 > +
 > +#define  DOM_A2_RX_PWR_4   56  /* 4 bytes  Calibration constants*/
 > +#define  DOM_A2_RX_PWR_3   60  /* 4 bytes */
 > +#define  DOM_A2_RX_PWR_2   64  /* 4 bytes */
 > +#define  DOM_A2_RX_PWR_1   68  /* 4 bytes */
 > +#define  DOM_A2_RX_PWR_0   72  /* 4 bytes */
 > +
 > +#define  DOM_A2_TX_I_SLOPE   76  /* 2 bytes */
 > +#define  DOM_A2_TX_I_OFFSET  78  /* 2 bytes */
 > +#define  DOM_A2_TX_PWR_SLOPE   80  /* 2 bytes */
 > +#define  DOM_A2_TX_PWR_OFFSET  82  /* 2 bytes */
 > +#define  DOM_A2_TEMP_SLOPE   84  /* 2 bytes */
 > +#define  DOM_A2_TEMP_OFFSET  86  /* 2 bytes */
 > +#define  DOM_A2_VCC_SLOPE   88  /* 2 bytes */
 > +#define  DOM_A2_VCC_OFFSET  90  /* 2 bytes */
 > +
 > +#define  DOM_A2_CC_DMI    95
 > +#define  DOM_A2_TEMP      96   /* 2 bytes */
 > +#define  DOM_A2_VCC       98   /* 2 bytes */
 > +#define  DOM_A2_TX_BIAS  100   /* 2 bytes */
 > +#define  DOM_A2_TX_PWR   102   /* 2 bytes */
 > +#define  DOM_A2_RX_PWR   104   /* 2 bytes */
 > +
 > +#define  DOM_A2_ALARM    112   /* 2 bytes */
 > +#define     DOM_TYPE_TEMP_AH       (1<<7)  /* Temp alarm high */
 > +#define     DOM_TYPE_TEMP_AL       (1<<6)  /* low */
 > +#define     DOM_TYPE_VCC_AH        (1<<5)
 > +#define     DOM_TYPE_VCC_AL        (1<<4)
 > +#define     DOM_TYPE_TX_BIAS_AH    (1<<3)
 > +#define     DOM_TYPE_TX_BIAS_AL    (1<<2)
 > +#define     DOM_TYPE_TX_PWR_AH     (1<<1)
 > +#define     DOM_TYPE_TX_PWR_AL     (1<<0)
 > +/* Next byte 113 */
 > +#define     DOM_TYPE_RX_PWR_AH     (1<<7)
 > +#define     DOM_TYPE_RX_PWR_AL     (1<<6)
 > +
 > +#define  DOM_A2_WARNING  116   /* 2 bytes */
 > +#define     DOM_TYPE_TEMP_WH       (1<<7)  /* Temp warning high */
 > +#define     DOM_TYPE_TEMP_WL       (1<<6)  /* low */
 > +#define     DOM_TYPE_VCC_WH        (1<<5)
 > +#define     DOM_TYPE_VCC_WL        (1<<4)
 > +#define     DOM_TYPE_TX_BIAS_WH    (1<<3)
 > +#define     DOM_TYPE_TX_BIAS_WL    (1<<2)
 > +#define     DOM_TYPE_TX_PWR_WH     (1<<1)
 > +#define     DOM_TYPE_TX_PWR_WL     (1<<0)
 > +/* Next byte 117 */
 > +#define     DOM_TYPE_RX_PWR_WH     (1<<7)
 > +#define     DOM_TYPE_RX_PWR_WL     (1<<6)
 > +
 > +#endif /* _LINUX_DOM_H */
 > diff --git a/net/core/ethtool.c b/net/core/ethtool.c
 > index d8aee58..756434a 100644
 > --- a/net/core/ethtool.c
 > +++ b/net/core/ethtool.c
 > @@ -893,6 +893,21 @@ static int ethtool_flash_device(struct net_device *dev, char __user *useraddr)
 >  	return dev->ethtool_ops->flash_device(dev, &efl);
 >  }
 >  
 > +static int ethtool_phy_diag(struct net_device *dev, void __user *useraddr)
 > +{
 > +	struct ethtool_phy_diag pd;
 > +
 > +	if (!dev->ethtool_ops->get_phy_diag)
 > +		return -EOPNOTSUPP;
 > +
 > +	dev->ethtool_ops->get_phy_diag(dev, &pd); /* FIXME */
 > +
 > +	if (copy_to_user(useraddr, &pd, sizeof(pd)))
 > +		 return -EFAULT;
 > +
 > +	return 0;
 > +}
 > +
 >  /* The main entry point in this file.  Called from net/core/dev.c */
 >  
 >  int dev_ethtool(struct net *net, struct ifreq *ifr)
 > @@ -1112,6 +1127,9 @@ int dev_ethtool(struct net *net, struct ifreq *ifr)
 >  	case ETHTOOL_RESET:
 >  		rc = ethtool_reset(dev, useraddr);
 >  		break;
 > +	case ETHTOOL_GPHYDIAG:
 > +		rc = ethtool_phy_diag(dev, useraddr);
 > +		break;
 >  	default:
 >  		rc = -EOPNOTSUPP;
 >  	}
 > 
 > 
 > --
 > To unsubscribe from this list: send the line "unsubscribe netdev" in
 > the body of a message to majordomo@vger.kernel.org
 > More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* [PATCH] e100: Use pci pool to work around GFP_ATOMIC order 5 memory allocation failure
From: Roger Oksanen @ 2009-11-26 14:49 UTC (permalink / raw)
  To: Jeff Kirsher, Jesse Brandeburg, Bruce Allan, PJ Waskiewicz, Joh
  Cc: e1000-devel, netdev, linux-kernel, Karol Lewandowski

e100: Use pci pool to work around GFP_ATOMIC order 5 memory allocation failure.

pci_alloc_consistent uses GFP_ATOMIC allocation that may fail on some systems
with limited memory (Bug #14265). pci_pool_alloc allows waiting with
GFP_KERNEL.

Tested-by: Karol Lewandowski <karol.k.lewandowski@gmail.com>
Signed-off-by: Roger Oksanen <roger.oksanen@cs.helsinki.fi>
---
 drivers/net/e100.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index 3c29a20..d269a68 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -157,6 +157,7 @@
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/dma-mapping.h>
+#include <linux/dmapool.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
 #include <linux/mii.h>
@@ -602,6 +603,7 @@ struct nic {
 	struct mem *mem;
 	dma_addr_t dma_addr;
 
+	struct pci_pool *cbs_pool;
 	dma_addr_t cbs_dma_addr;
 	u8 adaptive_ifs;
 	u8 tx_threshold;
@@ -1793,9 +1795,7 @@ static void e100_clean_cbs(struct nic *nic)
 			nic->cb_to_clean = nic->cb_to_clean->next;
 			nic->cbs_avail++;
 		}
-		pci_free_consistent(nic->pdev,
-			sizeof(struct cb) * nic->params.cbs.count,
-			nic->cbs, nic->cbs_dma_addr);
+		pci_pool_free(nic->cbs_pool, nic->cbs, nic->cbs_dma_addr);
 		nic->cbs = NULL;
 		nic->cbs_avail = 0;
 	}
@@ -1813,8 +1813,8 @@ static int e100_alloc_cbs(struct nic *nic)
 	nic->cb_to_use = nic->cb_to_send = nic->cb_to_clean = NULL;
 	nic->cbs_avail = 0;
 
-	nic->cbs = pci_alloc_consistent(nic->pdev,
-		sizeof(struct cb) * count, &nic->cbs_dma_addr);
+	nic->cbs = pci_pool_alloc(nic->cbs_pool, GFP_KERNEL,
+				  &nic->cbs_dma_addr);
 	if (!nic->cbs)
 		return -ENOMEM;
 
@@ -2841,7 +2841,11 @@ static int __devinit e100_probe(struct pci_dev *pdev,
 		DPRINTK(PROBE, ERR, "Cannot register net device, aborting.\n");
 		goto err_out_free;
 	}
-
+	nic->cbs_pool = pci_pool_create(netdev->name,
+			   nic->pdev,
+			   nic->params.cbs.count * sizeof(struct cb),
+			   sizeof(u32),
+			   0);
 	DPRINTK(PROBE, INFO, "addr 0x%llx, irq %d, MAC addr %pM\n",
 		(unsigned long long)pci_resource_start(pdev, use_io ? 1 : 0),
 		pdev->irq, netdev->dev_addr);
@@ -2871,6 +2875,7 @@ static void __devexit e100_remove(struct pci_dev *pdev)
 		unregister_netdev(netdev);
 		e100_free(nic);
 		pci_iounmap(pdev, nic->csr);
+		pci_pool_destroy(nic->cbs_pool);
 		free_netdev(netdev);
 		pci_release_regions(pdev);
 		pci_disable_device(pdev);

^ permalink raw reply related

* Re: ixgbe question
From: Badalian Vyacheslav @ 2009-11-26 14:10 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Peter P Waskiewicz Jr, robert@herjulf.net, Jesper Dangaard Brouer,
	Linux Netdev List
In-Reply-To: <4B0BADA6.7080602@gmail.com>

Eric Dumazet пишет:
> Peter P Waskiewicz Jr a écrit :
> 
>> You might have this elsewhere, but it sounds like you're connecting back
>> to back with another 82599 NIC.  Our optics in that NIC are dual-rate,
>> and the software mechanism that tries to "autoneg" link speed gets out
>> of sync easily in back-to-back setups.
>>
>> If it's really annoying, and you're willing to run with a local patch to
>> disable the autotry mechanism, try this:
>>
>> diff --git a/drivers/net/ixgbe/ixgbe_main.c
>> b/drivers/net/ixgbe/ixgbe_main.c
>> index a5036f7..62c0915 100644
>> --- a/drivers/net/ixgbe/ixgbe_main.c
>> +++ b/drivers/net/ixgbe/ixgbe_main.c
>> @@ -4670,6 +4670,10 @@ static void ixgbe_multispeed_fiber_task(struct
>> work_struct *work)
>>         autoneg = hw->phy.autoneg_advertised;
>>         if ((!autoneg) && (hw->mac.ops.get_link_capabilities))
>>                 hw->mac.ops.get_link_capabilities(hw, &autoneg,
>> &negotiation);
>> +
>> +       /* force 10G only */
>> +       autoneg = IXGBE_LINK_SPEED_10GB_FULL;
>> +
>>         if (hw->mac.ops.setup_link)
>>                 hw->mac.ops.setup_link(hw, autoneg, negotiation, true);
>>         adapter->flags |= IXGBE_FLAG_NEED_LINK_UPDATE;
> 
> Thanks ! This did the trick :)
> 
> If I am not mistaken, number of TX queues should be capped by number of possible cpus ?
> 
> Its currently a fixed 128 value, allocating 128*128 = 16384 bytes,
> and polluting "tc -s -d class show dev fiber0" output.
> 
> [PATCH net-next-2.6] ixgbe: Do not allocate too many netdev txqueues
> 
> Instead of allocating 128 struct netdev_queue per device, use the minimum
> value between 128 and number of possible cpus, to reduce ram usage and
> "tc -s -d class show dev ..." output
> 
> diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
> index ebcec30..ec2508d 100644
> --- a/drivers/net/ixgbe/ixgbe_main.c
> +++ b/drivers/net/ixgbe/ixgbe_main.c
> @@ -5582,7 +5583,10 @@ static int __devinit ixgbe_probe(struct pci_dev *pdev,
>  	pci_set_master(pdev);
>  	pci_save_state(pdev);
>  
> -	netdev = alloc_etherdev_mq(sizeof(struct ixgbe_adapter), MAX_TX_QUEUES);
> +	netdev = alloc_etherdev_mq(sizeof(struct ixgbe_adapter),
> +				   min_t(unsigned int,
> +					 MAX_TX_QUEUES,
> +					 num_possible_cpus()));
>  	if (!netdev) {
>  		err = -ENOMEM;
>  		goto err_alloc_etherdev;
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

This also fix log time loading TC rules for me

Tested-by: Badalian Vyacheslav <slavon.net@gmail.com>

^ permalink raw reply

* Re: linux-next: manual merge of the net tree with the wireless-current tree
From: John W. Linville @ 2009-11-26 13:01 UTC (permalink / raw)
  To: Johannes Berg
  Cc: Stephen Rothwell, David Miller, netdev, linux-next, linux-kernel,
	Jean Tourrilhes
In-Reply-To: <1259227989.32372.32.camel@johannes.local>

On Thu, Nov 26, 2009 at 10:33:09AM +0100, Johannes Berg wrote:
> On Thu, 2009-11-26 at 14:10 +1100, Stephen Rothwell wrote:
> > Hi all,
> > 
> > Today's linux-next merge of the net tree got a conflict in
> > net/wireless/wext.c between commit
> > 9fed059667d35fca9288460106e92dbb8ba35ea1 ("WE: Fix set events not
> > propagated") from the  tree and commit
> > 3d23e349d807177eaf519d444677cee86b1a04cf ("wext: refactor") from the net
> > tree.
> > 
> > The latter deleted the file that the former modified.  I just ignored the
> > wireless-current change and removed the file (which seems to have been
> > done in the latter change anyway).
> 
> The fix should probably have gone to wext-core.c instead?

Yes.  That's the way I did it in the merge-test branch of wireless-next-2.6.

Thanks,

John
--
John W. Linville
linville@tuxdriver.com

^ permalink raw reply

* Re: [PATCH] irq: Add node_affinity CPU masks for smarter irqbalance hints
From: Eric Dumazet @ 2009-11-26 11:43 UTC (permalink / raw)
  To: Andi Kleen
  Cc: David Miller, peter.p.waskiewicz.jr, peterz, arjan, yong.zhang0,
	linux-kernel, arjan, netdev
In-Reply-To: <20091125115019.GG29096@one.firstfloor.org>

Andi Kleen a écrit :

> That looks weird. It should have worked with CONFIG_NR_CPUS==16 too,
> because you only have 16 CPUs and the NR_CPUS should affect APIC
> ranges etc.
> 
> Something still fishy. I would properly report it.
> 
> BTW kernel should give some error message in any case when
> there are not enough CPUs I guess. 

Problem comes from acpi_numa_init(), calling

acpi_table_parse_srat(ACPI_SRAT_TYPE_CPU_AFFINITY, acpi_parse_processor_affinity, NR_CPUS);

But on this machine SRAT table contains 64 processor_affinity entries,
part of them enabled and other parts disabled

[8 ENABLED], [8 disabled], [8 ENABLED], [40 disabled]

So if NR_CPUS = 16, we 'see' only 8 enabled entries and 8 disabled entries.

# acpidump  -t SRAT >SRAT.dump
# acpixtract -a SRAT.dump
# iasl -d SRAT.dat
# cat SRAT.dsl
/*
 * Intel ACPI Component Architecture
 * AML Disassembler version 20090521
 *
 * Disassembly of SRAT.dat, Thu Nov 26 12:29:34 2009
 *
 * ACPI Data Table [SRAT]
 *
 * Format: [HexOffset DecimalOffset ByteLength]  FieldName : FieldValue
 */

[000h 0000  4]                    Signature : "SRAT"    /* System Resource Affinity Table */
[004h 0004  4]                 Table Length : 00000570
[008h 0008  1]                     Revision : 01
[009h 0009  1]                     Checksum : D9
[00Ah 0010  6]                       Oem ID : "HP    "
[010h 0016  8]                 Oem Table ID : "Proliant"
[018h 0024  4]                 Oem Revision : 00000001
[01Ch 0028  4]              Asl Compiler ID : "    "
[020h 0032  4]        Asl Compiler Revision : 0000162E

[024h 0036  4]               Table Revision : 00000001
[028h 0040  8]                     Reserved : 0000000000000000

[030h 0048  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[031h 0049  1]                       Length : 10

[032h 0050  1]      Proximity Domain Low(8) : 00
[033h 0051  1]                      Apic ID : 00
[034h 0052  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[038h 0056  1]              Local Sapic EID : 00
[039h 0057  3]    Proximity Domain High(24) : 000000
[03Ch 0060  4]                     Reserved : 00000000

[040h 0064  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[041h 0065  1]                       Length : 10

[042h 0066  1]      Proximity Domain Low(8) : 00
[043h 0067  1]                      Apic ID : 01
[044h 0068  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[048h 0072  1]              Local Sapic EID : 00
[049h 0073  3]    Proximity Domain High(24) : 000000
[04Ch 0076  4]                     Reserved : 00000000

[050h 0080  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[051h 0081  1]                       Length : 10

[052h 0082  1]      Proximity Domain Low(8) : 00
[053h 0083  1]                      Apic ID : 02
[054h 0084  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[058h 0088  1]              Local Sapic EID : 00
[059h 0089  3]    Proximity Domain High(24) : 000000
[05Ch 0092  4]                     Reserved : 00000000

[060h 0096  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[061h 0097  1]                       Length : 10

[062h 0098  1]      Proximity Domain Low(8) : 00
[063h 0099  1]                      Apic ID : 03
[064h 0100  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[068h 0104  1]              Local Sapic EID : 00
[069h 0105  3]    Proximity Domain High(24) : 000000
[06Ch 0108  4]                     Reserved : 00000000

[070h 0112  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[071h 0113  1]                       Length : 10

[072h 0114  1]      Proximity Domain Low(8) : 00
[073h 0115  1]                      Apic ID : 04
[074h 0116  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[078h 0120  1]              Local Sapic EID : 00
[079h 0121  3]    Proximity Domain High(24) : 000000
[07Ch 0124  4]                     Reserved : 00000000

[080h 0128  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[081h 0129  1]                       Length : 10

[082h 0130  1]      Proximity Domain Low(8) : 00
[083h 0131  1]                      Apic ID : 05
[084h 0132  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[088h 0136  1]              Local Sapic EID : 00
[089h 0137  3]    Proximity Domain High(24) : 000000
[08Ch 0140  4]                     Reserved : 00000000

[090h 0144  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[091h 0145  1]                       Length : 10

[092h 0146  1]      Proximity Domain Low(8) : 00
[093h 0147  1]                      Apic ID : 06
[094h 0148  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[098h 0152  1]              Local Sapic EID : 00
[099h 0153  3]    Proximity Domain High(24) : 000000
[09Ch 0156  4]                     Reserved : 00000000

[0A0h 0160  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[0A1h 0161  1]                       Length : 10

[0A2h 0162  1]      Proximity Domain Low(8) : 00
[0A3h 0163  1]                      Apic ID : 07
[0A4h 0164  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[0A8h 0168  1]              Local Sapic EID : 00
[0A9h 0169  3]    Proximity Domain High(24) : 000000
[0ACh 0172  4]                     Reserved : 00000000

[0B0h 0176  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[0B1h 0177  1]                       Length : 10

[0B2h 0178  1]      Proximity Domain Low(8) : 00
[0B3h 0179  1]                      Apic ID : 08
[0B4h 0180  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[0B8h 0184  1]              Local Sapic EID : 00
[0B9h 0185  3]    Proximity Domain High(24) : 000000
[0BCh 0188  4]                     Reserved : 00000000

[0C0h 0192  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[0C1h 0193  1]                       Length : 10

[0C2h 0194  1]      Proximity Domain Low(8) : 00
[0C3h 0195  1]                      Apic ID : 09
[0C4h 0196  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[0C8h 0200  1]              Local Sapic EID : 00
[0C9h 0201  3]    Proximity Domain High(24) : 000000
[0CCh 0204  4]                     Reserved : 00000000

[0D0h 0208  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[0D1h 0209  1]                       Length : 10

[0D2h 0210  1]      Proximity Domain Low(8) : 00
[0D3h 0211  1]                      Apic ID : 0A
[0D4h 0212  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[0D8h 0216  1]              Local Sapic EID : 00
[0D9h 0217  3]    Proximity Domain High(24) : 000000
[0DCh 0220  4]                     Reserved : 00000000

[0E0h 0224  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[0E1h 0225  1]                       Length : 10

[0E2h 0226  1]      Proximity Domain Low(8) : 00
[0E3h 0227  1]                      Apic ID : 0B
[0E4h 0228  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[0E8h 0232  1]              Local Sapic EID : 00
[0E9h 0233  3]    Proximity Domain High(24) : 000000
[0ECh 0236  4]                     Reserved : 00000000

[0F0h 0240  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[0F1h 0241  1]                       Length : 10

[0F2h 0242  1]      Proximity Domain Low(8) : 00
[0F3h 0243  1]                      Apic ID : 0C
[0F4h 0244  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[0F8h 0248  1]              Local Sapic EID : 00
[0F9h 0249  3]    Proximity Domain High(24) : 000000
[0FCh 0252  4]                     Reserved : 00000000

[100h 0256  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[101h 0257  1]                       Length : 10

[102h 0258  1]      Proximity Domain Low(8) : 00
[103h 0259  1]                      Apic ID : 0D
[104h 0260  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[108h 0264  1]              Local Sapic EID : 00
[109h 0265  3]    Proximity Domain High(24) : 000000
[10Ch 0268  4]                     Reserved : 00000000

[110h 0272  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[111h 0273  1]                       Length : 10

[112h 0274  1]      Proximity Domain Low(8) : 00
[113h 0275  1]                      Apic ID : 0E
[114h 0276  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[118h 0280  1]              Local Sapic EID : 00
[119h 0281  3]    Proximity Domain High(24) : 000000
[11Ch 0284  4]                     Reserved : 00000000

[120h 0288  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[121h 0289  1]                       Length : 10

[122h 0290  1]      Proximity Domain Low(8) : 00
[123h 0291  1]                      Apic ID : 0F
[124h 0292  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[128h 0296  1]              Local Sapic EID : 00
[129h 0297  3]    Proximity Domain High(24) : 000000
[12Ch 0300  4]                     Reserved : 00000000

[130h 0304  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[131h 0305  1]                       Length : 10

[132h 0306  1]      Proximity Domain Low(8) : 01
[133h 0307  1]                      Apic ID : 10
[134h 0308  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[138h 0312  1]              Local Sapic EID : 00
[139h 0313  3]    Proximity Domain High(24) : 000000
[13Ch 0316  4]                     Reserved : 00000000

[140h 0320  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[141h 0321  1]                       Length : 10

[142h 0322  1]      Proximity Domain Low(8) : 01
[143h 0323  1]                      Apic ID : 11
[144h 0324  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[148h 0328  1]              Local Sapic EID : 00
[149h 0329  3]    Proximity Domain High(24) : 000000
[14Ch 0332  4]                     Reserved : 00000000

[150h 0336  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[151h 0337  1]                       Length : 10

[152h 0338  1]      Proximity Domain Low(8) : 01
[153h 0339  1]                      Apic ID : 12
[154h 0340  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[158h 0344  1]              Local Sapic EID : 00
[159h 0345  3]    Proximity Domain High(24) : 000000
[15Ch 0348  4]                     Reserved : 00000000

[160h 0352  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[161h 0353  1]                       Length : 10

[162h 0354  1]      Proximity Domain Low(8) : 01
[163h 0355  1]                      Apic ID : 13
[164h 0356  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[168h 0360  1]              Local Sapic EID : 00
[169h 0361  3]    Proximity Domain High(24) : 000000
[16Ch 0364  4]                     Reserved : 00000000

[170h 0368  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[171h 0369  1]                       Length : 10

[172h 0370  1]      Proximity Domain Low(8) : 01
[173h 0371  1]                      Apic ID : 14
[174h 0372  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[178h 0376  1]              Local Sapic EID : 00
[179h 0377  3]    Proximity Domain High(24) : 000000
[17Ch 0380  4]                     Reserved : 00000000

[180h 0384  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[181h 0385  1]                       Length : 10

[182h 0386  1]      Proximity Domain Low(8) : 01
[183h 0387  1]                      Apic ID : 15
[184h 0388  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[188h 0392  1]              Local Sapic EID : 00
[189h 0393  3]    Proximity Domain High(24) : 000000
[18Ch 0396  4]                     Reserved : 00000000

[190h 0400  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[191h 0401  1]                       Length : 10

[192h 0402  1]      Proximity Domain Low(8) : 01
[193h 0403  1]                      Apic ID : 16
[194h 0404  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[198h 0408  1]              Local Sapic EID : 00
[199h 0409  3]    Proximity Domain High(24) : 000000
[19Ch 0412  4]                     Reserved : 00000000

[1A0h 0416  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[1A1h 0417  1]                       Length : 10

[1A2h 0418  1]      Proximity Domain Low(8) : 01
[1A3h 0419  1]                      Apic ID : 17
[1A4h 0420  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
[1A8h 0424  1]              Local Sapic EID : 00
[1A9h 0425  3]    Proximity Domain High(24) : 000000
[1ACh 0428  4]                     Reserved : 00000000

[1B0h 0432  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[1B1h 0433  1]                       Length : 10

[1B2h 0434  1]      Proximity Domain Low(8) : 00
[1B3h 0435  1]                      Apic ID : 18
[1B4h 0436  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[1B8h 0440  1]              Local Sapic EID : 00
[1B9h 0441  3]    Proximity Domain High(24) : 000000
[1BCh 0444  4]                     Reserved : 00000000

[1C0h 0448  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[1C1h 0449  1]                       Length : 10

[1C2h 0450  1]      Proximity Domain Low(8) : 00
[1C3h 0451  1]                      Apic ID : 19
[1C4h 0452  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[1C8h 0456  1]              Local Sapic EID : 00
[1C9h 0457  3]    Proximity Domain High(24) : 000000
[1CCh 0460  4]                     Reserved : 00000000

[1D0h 0464  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[1D1h 0465  1]                       Length : 10

[1D2h 0466  1]      Proximity Domain Low(8) : 00
[1D3h 0467  1]                      Apic ID : 1A
[1D4h 0468  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[1D8h 0472  1]              Local Sapic EID : 00
[1D9h 0473  3]    Proximity Domain High(24) : 000000
[1DCh 0476  4]                     Reserved : 00000000

[1E0h 0480  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[1E1h 0481  1]                       Length : 10

[1E2h 0482  1]      Proximity Domain Low(8) : 00
[1E3h 0483  1]                      Apic ID : 1B
[1E4h 0484  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[1E8h 0488  1]              Local Sapic EID : 00
[1E9h 0489  3]    Proximity Domain High(24) : 000000
[1ECh 0492  4]                     Reserved : 00000000

[1F0h 0496  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[1F1h 0497  1]                       Length : 10

[1F2h 0498  1]      Proximity Domain Low(8) : 00
[1F3h 0499  1]                      Apic ID : 1C
[1F4h 0500  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[1F8h 0504  1]              Local Sapic EID : 00
[1F9h 0505  3]    Proximity Domain High(24) : 000000
[1FCh 0508  4]                     Reserved : 00000000

[200h 0512  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[201h 0513  1]                       Length : 10

[202h 0514  1]      Proximity Domain Low(8) : 00
[203h 0515  1]                      Apic ID : 1D
[204h 0516  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[208h 0520  1]              Local Sapic EID : 00
[209h 0521  3]    Proximity Domain High(24) : 000000
[20Ch 0524  4]                     Reserved : 00000000

[210h 0528  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[211h 0529  1]                       Length : 10

[212h 0530  1]      Proximity Domain Low(8) : 00
[213h 0531  1]                      Apic ID : 1E
[214h 0532  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[218h 0536  1]              Local Sapic EID : 00
[219h 0537  3]    Proximity Domain High(24) : 000000
[21Ch 0540  4]                     Reserved : 00000000

[220h 0544  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[221h 0545  1]                       Length : 10

[222h 0546  1]      Proximity Domain Low(8) : 00
[223h 0547  1]                      Apic ID : 1F
[224h 0548  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[228h 0552  1]              Local Sapic EID : 00
[229h 0553  3]    Proximity Domain High(24) : 000000
[22Ch 0556  4]                     Reserved : 00000000

[230h 0560  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[231h 0561  1]                       Length : 10

[232h 0562  1]      Proximity Domain Low(8) : 00
[233h 0563  1]                      Apic ID : 20
[234h 0564  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[238h 0568  1]              Local Sapic EID : 00
[239h 0569  3]    Proximity Domain High(24) : 000000
[23Ch 0572  4]                     Reserved : 00000000

[240h 0576  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[241h 0577  1]                       Length : 10

[242h 0578  1]      Proximity Domain Low(8) : 00
[243h 0579  1]                      Apic ID : 21
[244h 0580  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[248h 0584  1]              Local Sapic EID : 00
[249h 0585  3]    Proximity Domain High(24) : 000000
[24Ch 0588  4]                     Reserved : 00000000

[250h 0592  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[251h 0593  1]                       Length : 10

[252h 0594  1]      Proximity Domain Low(8) : 00
[253h 0595  1]                      Apic ID : 22
[254h 0596  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[258h 0600  1]              Local Sapic EID : 00
[259h 0601  3]    Proximity Domain High(24) : 000000
[25Ch 0604  4]                     Reserved : 00000000

[260h 0608  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[261h 0609  1]                       Length : 10

[262h 0610  1]      Proximity Domain Low(8) : 00
[263h 0611  1]                      Apic ID : 23
[264h 0612  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[268h 0616  1]              Local Sapic EID : 00
[269h 0617  3]    Proximity Domain High(24) : 000000
[26Ch 0620  4]                     Reserved : 00000000

[270h 0624  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[271h 0625  1]                       Length : 10

[272h 0626  1]      Proximity Domain Low(8) : 00
[273h 0627  1]                      Apic ID : 24
[274h 0628  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[278h 0632  1]              Local Sapic EID : 00
[279h 0633  3]    Proximity Domain High(24) : 000000
[27Ch 0636  4]                     Reserved : 00000000

[280h 0640  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[281h 0641  1]                       Length : 10

[282h 0642  1]      Proximity Domain Low(8) : 00
[283h 0643  1]                      Apic ID : 25
[284h 0644  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[288h 0648  1]              Local Sapic EID : 00
[289h 0649  3]    Proximity Domain High(24) : 000000
[28Ch 0652  4]                     Reserved : 00000000

[290h 0656  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[291h 0657  1]                       Length : 10

[292h 0658  1]      Proximity Domain Low(8) : 00
[293h 0659  1]                      Apic ID : 26
[294h 0660  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[298h 0664  1]              Local Sapic EID : 00
[299h 0665  3]    Proximity Domain High(24) : 000000
[29Ch 0668  4]                     Reserved : 00000000

[2A0h 0672  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[2A1h 0673  1]                       Length : 10

[2A2h 0674  1]      Proximity Domain Low(8) : 00
[2A3h 0675  1]                      Apic ID : 27
[2A4h 0676  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[2A8h 0680  1]              Local Sapic EID : 00
[2A9h 0681  3]    Proximity Domain High(24) : 000000
[2ACh 0684  4]                     Reserved : 00000000

[2B0h 0688  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[2B1h 0689  1]                       Length : 10

[2B2h 0690  1]      Proximity Domain Low(8) : 00
[2B3h 0691  1]                      Apic ID : 28
[2B4h 0692  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[2B8h 0696  1]              Local Sapic EID : 00
[2B9h 0697  3]    Proximity Domain High(24) : 000000
[2BCh 0700  4]                     Reserved : 00000000

[2C0h 0704  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[2C1h 0705  1]                       Length : 10

[2C2h 0706  1]      Proximity Domain Low(8) : 00
[2C3h 0707  1]                      Apic ID : 29
[2C4h 0708  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[2C8h 0712  1]              Local Sapic EID : 00
[2C9h 0713  3]    Proximity Domain High(24) : 000000
[2CCh 0716  4]                     Reserved : 00000000

[2D0h 0720  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[2D1h 0721  1]                       Length : 10

[2D2h 0722  1]      Proximity Domain Low(8) : 00
[2D3h 0723  1]                      Apic ID : 2A
[2D4h 0724  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[2D8h 0728  1]              Local Sapic EID : 00
[2D9h 0729  3]    Proximity Domain High(24) : 000000
[2DCh 0732  4]                     Reserved : 00000000

[2E0h 0736  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[2E1h 0737  1]                       Length : 10

[2E2h 0738  1]      Proximity Domain Low(8) : 00
[2E3h 0739  1]                      Apic ID : 2B
[2E4h 0740  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[2E8h 0744  1]              Local Sapic EID : 00
[2E9h 0745  3]    Proximity Domain High(24) : 000000
[2ECh 0748  4]                     Reserved : 00000000

[2F0h 0752  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[2F1h 0753  1]                       Length : 10

[2F2h 0754  1]      Proximity Domain Low(8) : 00
[2F3h 0755  1]                      Apic ID : 2C
[2F4h 0756  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[2F8h 0760  1]              Local Sapic EID : 00
[2F9h 0761  3]    Proximity Domain High(24) : 000000
[2FCh 0764  4]                     Reserved : 00000000

[300h 0768  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[301h 0769  1]                       Length : 10

[302h 0770  1]      Proximity Domain Low(8) : 00
[303h 0771  1]                      Apic ID : 2D
[304h 0772  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[308h 0776  1]              Local Sapic EID : 00
[309h 0777  3]    Proximity Domain High(24) : 000000
[30Ch 0780  4]                     Reserved : 00000000

[310h 0784  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[311h 0785  1]                       Length : 10

[312h 0786  1]      Proximity Domain Low(8) : 00
[313h 0787  1]                      Apic ID : 2E
[314h 0788  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[318h 0792  1]              Local Sapic EID : 00
[319h 0793  3]    Proximity Domain High(24) : 000000
[31Ch 0796  4]                     Reserved : 00000000

[320h 0800  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[321h 0801  1]                       Length : 10

[322h 0802  1]      Proximity Domain Low(8) : 00
[323h 0803  1]                      Apic ID : 2F
[324h 0804  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[328h 0808  1]              Local Sapic EID : 00
[329h 0809  3]    Proximity Domain High(24) : 000000
[32Ch 0812  4]                     Reserved : 00000000

[330h 0816  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[331h 0817  1]                       Length : 10

[332h 0818  1]      Proximity Domain Low(8) : 00
[333h 0819  1]                      Apic ID : 30
[334h 0820  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[338h 0824  1]              Local Sapic EID : 00
[339h 0825  3]    Proximity Domain High(24) : 000000
[33Ch 0828  4]                     Reserved : 00000000

[340h 0832  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[341h 0833  1]                       Length : 10

[342h 0834  1]      Proximity Domain Low(8) : 00
[343h 0835  1]                      Apic ID : 31
[344h 0836  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[348h 0840  1]              Local Sapic EID : 00
[349h 0841  3]    Proximity Domain High(24) : 000000
[34Ch 0844  4]                     Reserved : 00000000

[350h 0848  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[351h 0849  1]                       Length : 10

[352h 0850  1]      Proximity Domain Low(8) : 00
[353h 0851  1]                      Apic ID : 32
[354h 0852  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[358h 0856  1]              Local Sapic EID : 00
[359h 0857  3]    Proximity Domain High(24) : 000000
[35Ch 0860  4]                     Reserved : 00000000

[360h 0864  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[361h 0865  1]                       Length : 10

[362h 0866  1]      Proximity Domain Low(8) : 00
[363h 0867  1]                      Apic ID : 33
[364h 0868  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[368h 0872  1]              Local Sapic EID : 00
[369h 0873  3]    Proximity Domain High(24) : 000000
[36Ch 0876  4]                     Reserved : 00000000

[370h 0880  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[371h 0881  1]                       Length : 10

[372h 0882  1]      Proximity Domain Low(8) : 00
[373h 0883  1]                      Apic ID : 34
[374h 0884  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[378h 0888  1]              Local Sapic EID : 00
[379h 0889  3]    Proximity Domain High(24) : 000000
[37Ch 0892  4]                     Reserved : 00000000

[380h 0896  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[381h 0897  1]                       Length : 10

[382h 0898  1]      Proximity Domain Low(8) : 00
[383h 0899  1]                      Apic ID : 35
[384h 0900  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[388h 0904  1]              Local Sapic EID : 00
[389h 0905  3]    Proximity Domain High(24) : 000000
[38Ch 0908  4]                     Reserved : 00000000

[390h 0912  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[391h 0913  1]                       Length : 10

[392h 0914  1]      Proximity Domain Low(8) : 00
[393h 0915  1]                      Apic ID : 36
[394h 0916  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[398h 0920  1]              Local Sapic EID : 00
[399h 0921  3]    Proximity Domain High(24) : 000000
[39Ch 0924  4]                     Reserved : 00000000

[3A0h 0928  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[3A1h 0929  1]                       Length : 10

[3A2h 0930  1]      Proximity Domain Low(8) : 00
[3A3h 0931  1]                      Apic ID : 37
[3A4h 0932  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[3A8h 0936  1]              Local Sapic EID : 00
[3A9h 0937  3]    Proximity Domain High(24) : 000000
[3ACh 0940  4]                     Reserved : 00000000

[3B0h 0944  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[3B1h 0945  1]                       Length : 10

[3B2h 0946  1]      Proximity Domain Low(8) : 00
[3B3h 0947  1]                      Apic ID : 38
[3B4h 0948  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[3B8h 0952  1]              Local Sapic EID : 00
[3B9h 0953  3]    Proximity Domain High(24) : 000000
[3BCh 0956  4]                     Reserved : 00000000

[3C0h 0960  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[3C1h 0961  1]                       Length : 10

[3C2h 0962  1]      Proximity Domain Low(8) : 00
[3C3h 0963  1]                      Apic ID : 39
[3C4h 0964  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[3C8h 0968  1]              Local Sapic EID : 00
[3C9h 0969  3]    Proximity Domain High(24) : 000000
[3CCh 0972  4]                     Reserved : 00000000

[3D0h 0976  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[3D1h 0977  1]                       Length : 10

[3D2h 0978  1]      Proximity Domain Low(8) : 00
[3D3h 0979  1]                      Apic ID : 3A
[3D4h 0980  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[3D8h 0984  1]              Local Sapic EID : 00
[3D9h 0985  3]    Proximity Domain High(24) : 000000
[3DCh 0988  4]                     Reserved : 00000000

[3E0h 0992  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[3E1h 0993  1]                       Length : 10

[3E2h 0994  1]      Proximity Domain Low(8) : 00
[3E3h 0995  1]                      Apic ID : 3B
[3E4h 0996  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[3E8h 1000  1]              Local Sapic EID : 00
[3E9h 1001  3]    Proximity Domain High(24) : 000000
[3ECh 1004  4]                     Reserved : 00000000

[3F0h 1008  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[3F1h 1009  1]                       Length : 10

[3F2h 1010  1]      Proximity Domain Low(8) : 00
[3F3h 1011  1]                      Apic ID : 3C
[3F4h 1012  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[3F8h 1016  1]              Local Sapic EID : 00
[3F9h 1017  3]    Proximity Domain High(24) : 000000
[3FCh 1020  4]                     Reserved : 00000000

[400h 1024  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[401h 1025  1]                       Length : 10

[402h 1026  1]      Proximity Domain Low(8) : 00
[403h 1027  1]                      Apic ID : 3D
[404h 1028  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[408h 1032  1]              Local Sapic EID : 00
[409h 1033  3]    Proximity Domain High(24) : 000000
[40Ch 1036  4]                     Reserved : 00000000

[410h 1040  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[411h 1041  1]                       Length : 10

[412h 1042  1]      Proximity Domain Low(8) : 00
[413h 1043  1]                      Apic ID : 3E
[414h 1044  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[418h 1048  1]              Local Sapic EID : 00
[419h 1049  3]    Proximity Domain High(24) : 000000
[41Ch 1052  4]                     Reserved : 00000000

[420h 1056  1]                Subtable Type : 00 <Processor Local APIC/SAPIC Affinity>
[421h 1057  1]                       Length : 10

[422h 1058  1]      Proximity Domain Low(8) : 00
[423h 1059  1]                      Apic ID : 3F
[424h 1060  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
[428h 1064  1]              Local Sapic EID : 00
[429h 1065  3]    Proximity Domain High(24) : 000000
[42Ch 1068  4]                     Reserved : 00000000

[430h 1072  1]                Subtable Type : 01 <Memory Affinity>
[431h 1073  1]                       Length : 28

[432h 1074  4]             Proximity Domain : 00000000
[436h 1078  2]                     Reserved : 0000
[438h 1080  8]                 Base Address : 0000000000000000
[440h 1088  8]               Address Length : 00000000E0000000
[448h 1096  4]                     Reserved : 00000000
[44Ch 1100  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
                              Hot Pluggable : 0
                               Non-Volatile : 0
[450h 1104  8]                     Reserved : 0000000000000000

[458h 1112  1]                Subtable Type : 01 <Memory Affinity>
[459h 1113  1]                       Length : 28

[45Ah 1114  4]             Proximity Domain : 00000000
[45Eh 1118  2]                     Reserved : 0000
[460h 1120  8]                 Base Address : 00000000E0000000
[468h 1128  8]               Address Length : 0000000020000000
[470h 1136  4]                     Reserved : 00000000
[474h 1140  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
                              Hot Pluggable : 0
                               Non-Volatile : 0
[478h 1144  8]                     Reserved : 0000000000000000

[480h 1152  1]                Subtable Type : 01 <Memory Affinity>
[481h 1153  1]                       Length : 28

[482h 1154  4]             Proximity Domain : 00000000
[486h 1158  2]                     Reserved : 0000
[488h 1160  8]                 Base Address : 0000000100000000
[490h 1168  8]               Address Length : 0000000120000000
[498h 1176  4]                     Reserved : 00000000
[49Ch 1180  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
                              Hot Pluggable : 0
                               Non-Volatile : 0
[4A0h 1184  8]                     Reserved : 0000000000000000

[4A8h 1192  1]                Subtable Type : 01 <Memory Affinity>
[4A9h 1193  1]                       Length : 28

[4AAh 1194  4]             Proximity Domain : 00000001
[4AEh 1198  2]                     Reserved : 0000
[4B0h 1200  8]                 Base Address : 0000000220000000
[4B8h 1208  8]               Address Length : 0000000200000000
[4C0h 1216  4]                     Reserved : 00000000
[4C4h 1220  4]        Flags (decoded below) : 00000001
                                    Enabled : 1
                              Hot Pluggable : 0
                               Non-Volatile : 0
[4C8h 1224  8]                     Reserved : 0000000000000000

[4D0h 1232  1]                Subtable Type : 01 <Memory Affinity>
[4D1h 1233  1]                       Length : 28

[4D2h 1234  4]             Proximity Domain : 00000000
[4D6h 1238  2]                     Reserved : 0000
[4D8h 1240  8]                 Base Address : 0000000420000000
[4E0h 1248  8]               Address Length : 0000000000000000
[4E8h 1256  4]                     Reserved : 00000000
[4ECh 1260  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
                              Hot Pluggable : 0
                               Non-Volatile : 0
[4F0h 1264  8]                     Reserved : 0000000000000000

[4F8h 1272  1]                Subtable Type : 01 <Memory Affinity>
[4F9h 1273  1]                       Length : 28

[4FAh 1274  4]             Proximity Domain : 00000000
[4FEh 1278  2]                     Reserved : 0000
[500h 1280  8]                 Base Address : 0000000420000000
[508h 1288  8]               Address Length : 0000000000000000
[510h 1296  4]                     Reserved : 00000000
[514h 1300  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
                              Hot Pluggable : 0
                               Non-Volatile : 0
[518h 1304  8]                     Reserved : 0000000000000000

[520h 1312  1]                Subtable Type : 01 <Memory Affinity>
[521h 1313  1]                       Length : 28

[522h 1314  4]             Proximity Domain : 00000000
[526h 1318  2]                     Reserved : 0000
[528h 1320  8]                 Base Address : 0000000420000000
[530h 1328  8]               Address Length : 0000000000000000
[538h 1336  4]                     Reserved : 00000000
[53Ch 1340  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
                              Hot Pluggable : 0
                               Non-Volatile : 0
[540h 1344  8]                     Reserved : 0000000000000000

[548h 1352  1]                Subtable Type : 01 <Memory Affinity>
[549h 1353  1]                       Length : 28

[54Ah 1354  4]             Proximity Domain : 00000000
[54Eh 1358  2]                     Reserved : 0000
[550h 1360  8]                 Base Address : 0000000420000000
[558h 1368  8]               Address Length : 0000000000000000
[560h 1376  4]                     Reserved : 00000000
[564h 1380  4]        Flags (decoded below) : 00000000
                                    Enabled : 0
                              Hot Pluggable : 0
                               Non-Volatile : 0
[568h 1384  8]                     Reserved : 0000000000000000

Raw Table Data

  0000: 53 52 41 54 70 05 00 00 01 D9 48 50 20 20 20 20  SRATp.....HP    
  0010: 50 72 6F 6C 69 61 6E 74 01 00 00 00 20 20 20 20  Proliant....    
  0020: 2E 16 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0030: 00 10 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0040: 00 10 00 01 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0050: 00 10 00 02 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0060: 00 10 00 03 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0070: 00 10 00 04 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0080: 00 10 00 05 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0090: 00 10 00 06 01 00 00 00 00 00 00 00 00 00 00 00  ................
  00A0: 00 10 00 07 01 00 00 00 00 00 00 00 00 00 00 00  ................
  00B0: 00 10 00 08 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00C0: 00 10 00 09 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00D0: 00 10 00 0A 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00E0: 00 10 00 0B 00 00 00 00 00 00 00 00 00 00 00 00  ................
  00F0: 00 10 00 0C 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0100: 00 10 00 0D 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0110: 00 10 00 0E 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0120: 00 10 00 0F 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0130: 00 10 01 10 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0140: 00 10 01 11 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0150: 00 10 01 12 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0160: 00 10 01 13 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0170: 00 10 01 14 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0180: 00 10 01 15 01 00 00 00 00 00 00 00 00 00 00 00  ................
  0190: 00 10 01 16 01 00 00 00 00 00 00 00 00 00 00 00  ................
  01A0: 00 10 01 17 01 00 00 00 00 00 00 00 00 00 00 00  ................
  01B0: 00 10 00 18 00 00 00 00 00 00 00 00 00 00 00 00  ................
  01C0: 00 10 00 19 00 00 00 00 00 00 00 00 00 00 00 00  ................
  01D0: 00 10 00 1A 00 00 00 00 00 00 00 00 00 00 00 00  ................
  01E0: 00 10 00 1B 00 00 00 00 00 00 00 00 00 00 00 00  ................
  01F0: 00 10 00 1C 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0200: 00 10 00 1D 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0210: 00 10 00 1E 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0220: 00 10 00 1F 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0230: 00 10 00 20 00 00 00 00 00 00 00 00 00 00 00 00  ... ............
  0240: 00 10 00 21 00 00 00 00 00 00 00 00 00 00 00 00  ...!............
  0250: 00 10 00 22 00 00 00 00 00 00 00 00 00 00 00 00  ..."............
  0260: 00 10 00 23 00 00 00 00 00 00 00 00 00 00 00 00  ...#............
  0270: 00 10 00 24 00 00 00 00 00 00 00 00 00 00 00 00  ...$............
  0280: 00 10 00 25 00 00 00 00 00 00 00 00 00 00 00 00  ...%............
  0290: 00 10 00 26 00 00 00 00 00 00 00 00 00 00 00 00  ...&............
  02A0: 00 10 00 27 00 00 00 00 00 00 00 00 00 00 00 00  ...'............
  02B0: 00 10 00 28 00 00 00 00 00 00 00 00 00 00 00 00  ...(............
  02C0: 00 10 00 29 00 00 00 00 00 00 00 00 00 00 00 00  ...)............
  02D0: 00 10 00 2A 00 00 00 00 00 00 00 00 00 00 00 00  ...*............
  02E0: 00 10 00 2B 00 00 00 00 00 00 00 00 00 00 00 00  ...+............
  02F0: 00 10 00 2C 00 00 00 00 00 00 00 00 00 00 00 00  ...,............
  0300: 00 10 00 2D 00 00 00 00 00 00 00 00 00 00 00 00  ...-............
  0310: 00 10 00 2E 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0320: 00 10 00 2F 00 00 00 00 00 00 00 00 00 00 00 00  .../............
  0330: 00 10 00 30 00 00 00 00 00 00 00 00 00 00 00 00  ...0............
  0340: 00 10 00 31 00 00 00 00 00 00 00 00 00 00 00 00  ...1............
  0350: 00 10 00 32 00 00 00 00 00 00 00 00 00 00 00 00  ...2............
  0360: 00 10 00 33 00 00 00 00 00 00 00 00 00 00 00 00  ...3............
  0370: 00 10 00 34 00 00 00 00 00 00 00 00 00 00 00 00  ...4............
  0380: 00 10 00 35 00 00 00 00 00 00 00 00 00 00 00 00  ...5............
  0390: 00 10 00 36 00 00 00 00 00 00 00 00 00 00 00 00  ...6............
  03A0: 00 10 00 37 00 00 00 00 00 00 00 00 00 00 00 00  ...7............
  03B0: 00 10 00 38 00 00 00 00 00 00 00 00 00 00 00 00  ...8............
  03C0: 00 10 00 39 00 00 00 00 00 00 00 00 00 00 00 00  ...9............
  03D0: 00 10 00 3A 00 00 00 00 00 00 00 00 00 00 00 00  ...:............
  03E0: 00 10 00 3B 00 00 00 00 00 00 00 00 00 00 00 00  ...;............
  03F0: 00 10 00 3C 00 00 00 00 00 00 00 00 00 00 00 00  ...<............
  0400: 00 10 00 3D 00 00 00 00 00 00 00 00 00 00 00 00  ...=............
  0410: 00 10 00 3E 00 00 00 00 00 00 00 00 00 00 00 00  ...>............
  0420: 00 10 00 3F 00 00 00 00 00 00 00 00 00 00 00 00  ...?............
  0430: 01 28 00 00 00 00 00 00 00 00 00 00 00 00 00 00  .(..............
  0440: 00 00 00 E0 00 00 00 00 00 00 00 00 01 00 00 00  ................
  0450: 00 00 00 00 00 00 00 00 01 28 00 00 00 00 00 00  .........(......
  0460: 00 00 00 E0 00 00 00 00 00 00 00 20 00 00 00 00  ........... ....
  0470: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0480: 01 28 00 00 00 00 00 00 00 00 00 00 01 00 00 00  .(..............
  0490: 00 00 00 20 01 00 00 00 00 00 00 00 01 00 00 00  ... ............
  04A0: 00 00 00 00 00 00 00 00 01 28 01 00 00 00 00 00  .........(......
  04B0: 00 00 00 20 02 00 00 00 00 00 00 00 02 00 00 00  ... ............
  04C0: 00 00 00 00 01 00 00 00 00 00 00 00 00 00 00 00  ................
  04D0: 01 28 00 00 00 00 00 00 00 00 00 20 04 00 00 00  .(......... ....
  04E0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  04F0: 00 00 00 00 00 00 00 00 01 28 00 00 00 00 00 00  .........(......
  0500: 00 00 00 20 04 00 00 00 00 00 00 00 00 00 00 00  ... ............
  0510: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0520: 01 28 00 00 00 00 00 00 00 00 00 20 04 00 00 00  .(......... ....
  0530: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................
  0540: 00 00 00 00 00 00 00 00 01 28 00 00 00 00 00 00  .........(......
  0550: 00 00 00 20 04 00 00 00 00 00 00 00 00 00 00 00  ... ............
  0560: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  ................



^ permalink raw reply

* [PATCH] additional update of dev_net(net) to struct *net in ip_fragment.c, NULL ptr OOPS
From: David Ford @ 2009-11-26 10:38 UTC (permalink / raw)
  To: netdev

ipv4 ip_frag_reasm(), fully replace 'dev_net(dev)' with 'net', defined
previously patched into 2.6.29.

--- linux-2.6.32-rc8/net/ipv4/ip_fragment.c.orig 2009-09-09
18:13:59.000000000 -0400
+++ linux-2.6.32-rc8/net/ipv4/ip_fragment.c      2009-11-26
05:02:43.000000000 -0500
@@ -563,7 +563,7 @@
                printk(KERN_INFO "Oversized IP packet from %pI4.\n",
                        &qp->saddr);
 out_fail:
-       IP_INC_STATS_BH(dev_net(dev), IPSTATS_MIB_REASMFAILS);
+       IP_INC_STATS_BH(net, IPSTATS_MIB_REASMFAILS);
        return err;
 }

Signed-off-by: David Ford <david@blue-labs.org>



Between 2.6.28.10 and 2.6.29, net/ipv4/ip_fragment.c was patched,
changing from dev_net(dev) to container_of(...).  Unfortunately the goto
section (out_fail) on oversized packets inside ip_frag_reasm() didn't
get touched up as well.  Oversized IP packets cause a NULL pointer
dereference and immediate hang.

I discovered this running openvasd and my previous email on this is
titled:  NULL pointer dereference at 2.6.32-rc8:net/ipv4/ip_fragment.c:566

-david



^ permalink raw reply

* Re: Strange CPU load when flushing route cache (kernel 2.6.31.6)
From: Eric Dumazet @ 2009-11-26 11:05 UTC (permalink / raw)
  To: Jesper Dangaard Brouer
  Cc: Jesper Dangaard Brouer, Linux Kernel Network Hackers,
	Robert Olsson
In-Reply-To: <1259232716.30983.101.camel@jdb-workstation>

Jesper Dangaard Brouer a écrit :
> On Mon, 2009-11-23 at 15:03 +0100, Eric Dumazet wrote:
>>> grep LowTotal /proc/meminfo
>>> LowTotal:         747080 kB
>>>
>>> What does that mean?  Is it bad? What should I run on a 32-bit
>>> system/kernel?
>> If you have more than 1GB of physical ram, and use your machine as a router, you might
>> compile a 2GB/2GB User/Kernel kernel, to get twice available RAM for kernel
>> and more IP route entries (if needed)
> 
> Can I still use this option if the machine "only" have 2G of physical
> RAM?  Most of my production machines have 2G RAM.
> 
> Just to verify: This is not an issue on 64-bit kernels right?


If your kernel is 32bit, and you have 2GB of ram, then selecting a 2G/2G split
allows your kernel to use more ram (This is called LOWMEM.

Yes, this not an issue on 64bits kernels : All RAM is LOWMEM :)


> 
>> make menuconfig
>> --> Processor type and features
>>   --> Memory split
>>     --> 2G/2G
> 
> For completeness sake, Memory split depends on "if EMBEDDED"
> 
> So I also needed to enable:
> 
>  make menuconfig
>   --> General setup
>      --> Configure standard kernel features (for small systems) 
> 
> 
>>> Can you recommend any other /proc/sys/ tuning options?
>> Really hard to say without exact context of use :)
> 
> The machines does Internet traffic routing, but with a VERY large
> iptables rulesets, e.g. on one production machine I have 18409 chains
> and 62916 iptables rules. (I did most of the scalability patches to
> iptables userspace to make this work...). And the machines also uses a
> very large HTB tree.  Basically I do, per customer, Access Control,
> Bandwidth limiting and Personal firewall.
> 
> Also note that I'm reserving extra vmalloc memory as iptables uses
> vmalloc'ed memory...


> 
> Okay I'll keep boot parameter then... or is it possible to resize the
> hash runtime?

Nope, we use RCU lookups, so a resize would be complex.


^ permalink raw reply

* Re: Strange CPU load when flushing route cache (kernel 2.6.31.6)
From: Jesper Dangaard Brouer @ 2009-11-26 10:51 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: Jesper Dangaard Brouer, Linux Kernel Network Hackers,
	Robert Olsson
In-Reply-To: <4B0A9631.2030705@gmail.com>

On Mon, 2009-11-23 at 15:03 +0100, Eric Dumazet wrote:
> > grep LowTotal /proc/meminfo
> > LowTotal:         747080 kB
> > 
> > What does that mean?  Is it bad? What should I run on a 32-bit
> > system/kernel?
> 
> If you have more than 1GB of physical ram, and use your machine as a router, you might
> compile a 2GB/2GB User/Kernel kernel, to get twice available RAM for kernel
> and more IP route entries (if needed)

Can I still use this option if the machine "only" have 2G of physical
RAM?  Most of my production machines have 2G RAM.

Just to verify: This is not an issue on 64-bit kernels right?

> make menuconfig
> --> Processor type and features
>   --> Memory split
>     --> 2G/2G

For completeness sake, Memory split depends on "if EMBEDDED"

So I also needed to enable:

 make menuconfig
  --> General setup
     --> Configure standard kernel features (for small systems) 


> > Can you recommend any other /proc/sys/ tuning options?
> 
> Really hard to say without exact context of use :)

The machines does Internet traffic routing, but with a VERY large
iptables rulesets, e.g. on one production machine I have 18409 chains
and 62916 iptables rules. (I did most of the scalability patches to
iptables userspace to make this work...). And the machines also uses a
very large HTB tree.  Basically I do, per customer, Access Control,
Bandwidth limiting and Personal firewall.

Also note that I'm reserving extra vmalloc memory as iptables uses
vmalloc'ed memory...

> > Does my kernel boot option rhash_entries=262143 make sense anymore?
> > Or do we adjust the hash bucket size dynamically these days?
> > 
> 
> Its not dynamic yet.

Okay I'll keep boot parameter then... or is it possible to resize the
hash runtime?


-- 
Med venlig hilsen / Best regards
  Jesper Brouer
  ComX Networks A/S
  Linux Network Kernel Developer
  Cand. Scient Datalog / MSc.CS
  Author of http://adsl-optimizer.dk
  LinkedIn: http://www.linkedin.com/in/brouer

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox