* [PATCH] bond: Don't set skb->queue_mapping in netpoll.
From: Tao Ma @ 2013-08-15 8:36 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, David S. Miller, Cong Wang, Eric Dumazet
From: Tao Ma <boyu.mt@taobao.com>
When we are using netpoll, we don't go through the normal
transmit process. In this case, bond_select_queue is not called
and qdisc_skb_cb(skb)->slave_dev_queue_mapping isn't set.
So when netpoll_send_skb_on_dev calls ndo_start_xmit and we
enter bond_dev_queue_xmit, we will set skb->queue_mapping to
an invalid value and in some cases cause the driver panic the
kernel(We meet with bnx2 panic because of a very large queue_mapping).
This patch skip skb->queue_mapping if we find we are in netpoll.
CC: "David S. Miller" <davem@davemloft.net>
CC: Cong Wang <amwang@redhat.com>
CC: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
---
drivers/net/bonding/bond_main.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/bonding/bond_main.c b/drivers/net/bonding/bond_main.c
index 07f257d..97b2f52 100644
--- a/drivers/net/bonding/bond_main.c
+++ b/drivers/net/bonding/bond_main.c
@@ -405,12 +405,13 @@ int bond_dev_queue_xmit(struct bonding *bond, struct sk_buff *skb,
BUILD_BUG_ON(sizeof(skb->queue_mapping) !=
sizeof(qdisc_skb_cb(skb)->slave_dev_queue_mapping));
- skb->queue_mapping = qdisc_skb_cb(skb)->slave_dev_queue_mapping;
if (unlikely(netpoll_tx_running(bond->dev)))
bond_netpoll_send_skb(bond_get_slave_by_dev(bond, slave_dev), skb);
- else
+ else {
+ skb->queue_mapping = qdisc_skb_cb(skb)->slave_dev_queue_mapping;
dev_queue_xmit(skb);
+ }
return 0;
}
--
1.7.0.4
^ permalink raw reply related
* Re: [PATCH] drivers/net/ethernet/via/via-velocity.c: update napi implementation
From: David Miller @ 2013-08-15 8:39 UTC (permalink / raw)
To: Julia.Lawall
Cc: romieu, roszenrami, dshwatrz, kernel-janitors, netdev,
linux-kernel, grant.likely, rob.herring
In-Reply-To: <1376490413-12067-1-git-send-email-Julia.Lawall@lip6.fr>
From: Julia Lawall <Julia.Lawall@lip6.fr>
Date: Wed, 14 Aug 2013 16:26:53 +0200
> From: Julia Lawall <Julia.Lawall@lip6.fr>
>
> Drivers supporting NAPI should use a NAPI-specific function for receiving
> packets. Hence netif_rx is changed to netif_receive_skb.
>
> Furthermore netif_napi_del should be used in the probe and remove function
> to clean up the NAPI resource information.
>
> Thanks to Francois Romieu, David Shwatrz and Rami Rosen for their help on
> this patch.
>
> Signed-off-by: Julia Lawall <Julia.Lawall@lip6.fr>
Applied, thanks.
^ permalink raw reply
* Re: [GIT net] Open vSwitch
From: David Miller @ 2013-08-15 8:41 UTC (permalink / raw)
To: jesse; +Cc: netdev, dev
In-Reply-To: <1376522347-39531-1-git-send-email-jesse@nicira.com>
From: Jesse Gross <jesse@nicira.com>
Date: Wed, 14 Aug 2013 16:19:04 -0700
> Three bug fixes that are fairly small either way but resolve obviously
> incorrect code. For net/3.11.
Pulled, thanks Jesse.
^ permalink raw reply
* Re: [Patch net-next] net: sync some IP headers with glibc
From: Cong Wang @ 2013-08-15 8:42 UTC (permalink / raw)
To: David Miller; +Cc: netdev, tmb, libc-alpha, yoshfuji, carlos
In-Reply-To: <20130814.134246.1152657041177088716.davem@davemloft.net>
On Wed, 2013-08-14 at 13:42 -0700, David Miller wrote:
> > -#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop
> options */
> > -#define IPPROTO_ROUTING 43 /* IPv6 routing
> header */
> > -#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation
> header */
> > -#define IPPROTO_ICMPV6 58 /*
> ICMPv6 */
> > -#define IPPROTO_NONE 59 /* IPv6 no next
> header */
> > -#define IPPROTO_DSTOPTS 60 /* IPv6 destination
> options */
> > -#define IPPROTO_MH 135 /* IPv6 mobility
> header */
> > +#if __UAPI_DEF_IPPROTO_V6
> > +enum {
> > + IPPROTO_HOPOPTS = 0, /* IPv6 hop-by-hop options
> */
>
> Again, do not reformat things, it's an unrelated change and makes
> this patch harder to review.
Hmm, for this one, the original format is hard to keep since this patch
changes macros to enum's. What this patch does here looks correct to me,
for reference, below is the original code:
#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options
*/
#define IPPROTO_ROUTING 43 /* IPv6 routing header
*/
#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header
*/
#define IPPROTO_ICMPV6 58 /* ICMPv6
*/
#define IPPROTO_NONE 59 /* IPv6 no next header
*/
#define IPPROTO_DSTOPTS 60 /* IPv6 destination options
*/
#define IPPROTO_MH 135 /* IPv6 mobility header
*/
and here is the code after patch:
#if __UAPI_DEF_IPPROTO_V6
enum {
IPPROTO_HOPOPTS = 0, /* IPv6 hop-by-hop options */
#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
IPPROTO_ROUTING = 43, /* IPv6 routing header */
#define IPPROTO_ROUTING IPPROTO_ROUTING
IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header */
#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
IPPROTO_ICMPV6 = 58, /* ICMPv6 */
#define IPPROTO_ICMPV6 IPPROTO_ICMPV6
IPPROTO_NONE = 59, /* IPv6 no next header */
#define IPPROTO_NONE IPPROTO_NONE
IPPROTO_DSTOPTS = 60, /* IPv6 destination options */
#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS
IPPROTO_MH = 135, /* IPv6 mobility header */
#define IPPROTO_MH IPPROTO_MH
};
#endif /* __UAPI_DEF_IPPROTO_V6 */
Or I don't get your point?
Thanks.
^ permalink raw reply
* Re: [PATCH] net_sched: restore "linklayer atm" handling
From: David Miller @ 2013-08-15 8:43 UTC (permalink / raw)
To: brouer; +Cc: dave.taht, netdev, shemminger
In-Reply-To: <20130814214711.23885.76734.stgit@dragon>
From: Jesper Dangaard Brouer <brouer@redhat.com>
Date: Wed, 14 Aug 2013 23:47:11 +0200
> commit 56b765b79 ("htb: improved accuracy at high rates")
> broke the "linklayer atm" handling.
>
> tc class add ... htb rate X ceil Y linklayer atm
>
> The linklayer setting is implemented by modifying the rate table
> which is send to the kernel. No direct parameter were
> transferred to the kernel indicating the linklayer setting.
>
> The commit 56b765b79 ("htb: improved accuracy at high rates")
> removed the use of the rate table system.
>
> To keep compatible with older iproute2 utils, this patch detects
> the linklayer by parsing the rate table. It also supports future
> versions of iproute2 to send this linklayer parameter to the
> kernel directly. This is done by using the __reserved field in
> struct tc_ratespec, to convey the choosen linklayer option, but
> only using the lower 4 bits of this field.
>
> Linklayer detection is limited to speeds below 100Mbit/s, because
> at high rates the rtab is gets too inaccurate, so bad that
> several fields contain the same values, this resembling the ATM
> detect. Fields even start to contain "0" time to send, e.g. at
> 1000Mbit/s sending a 96 bytes packet cost "0", thus the rtab have
> been more broken than we first realized.
>
> Signed-off-by: Jesper Dangaard Brouer <brouer@redhat.com>
Applied, thanks.
^ permalink raw reply
* Re: [Patch net-next] net: sync some IP headers with glibc
From: David Miller @ 2013-08-15 8:44 UTC (permalink / raw)
To: amwang; +Cc: netdev, tmb, libc-alpha, yoshfuji, carlos
In-Reply-To: <1376556163.2626.11.camel@cr0>
From: Cong Wang <amwang@redhat.com>
Date: Thu, 15 Aug 2013 16:42:43 +0800
> Hmm, for this one, the original format is hard to keep since this patch
> changes macros to enum's. What this patch does here looks correct to me,
> for reference, below is the original code:
Fair enough, please resubmit your patches.
^ permalink raw reply
* Re: [PATCH] net/mlx5_core: Support MANAGE_PAGES and QUERY_PAGES firmware command changes
From: David Miller @ 2013-08-15 8:48 UTC (permalink / raw)
To: moshel; +Cc: netdev, roland, ogerlitz, eli
In-Reply-To: <1376491608-3759-1-git-send-email-moshel@mellanox.com>
From: Moshe Lazer <moshel@mellanox.com>
Date: Wed, 14 Aug 2013 17:46:48 +0300
> In the previous QUERY_PAGES command version we used one command to get the
> required amount of boot, init and post init pages. The new version uses the
> op_mod field to specify whether the query is for the required amount of boot,
> init or post init pages. In addition the output field size for the required
> amount of pages increased from 16 to 32 bits.
>
> In MANAGE_PAGES command the input_num_entries and output_num_entries fields
> sizes changed from 16 to 32 bits and the PAS tables offset changed to 0x10.
>
> In the pages request event the num_pages field also changed to 32 bits.
>
> In the HCA-capabilities-layout the size and location of max_qp_mcg field has
> been changed to support 24 bits.
>
> This patch isn't compatible with firmware versions < 5; however, it turns out that the
> first GA firmware we will publish will not support previous versions so this should be OK.
>
> Signed-off-by: Moshe Lazer <moshel@mellanox.com>
> Signed-off-by: Eli Cohen <eli@mellanox.com>
You're going to have to explain a few things before I'm even going to consider
applying this.
What tree are you targetting 'net' or 'net-next'?
Next, does this break things for people using older firmware?
I don't see anything that verifies that the firmware is of a version
that uses the command data structures you're changing in this patch.
If you're not checking, this is terrible, and I find it utterly
unacceptable.
You can't just go "oh the latest firmware uses this new layout, so
we don't have to consider what the older firmware wants."
^ permalink raw reply
* Re: [PATCH] net/mlx5_core: Support MANAGE_PAGES and QUERY_PAGES firmware command changes
From: Or Gerlitz @ 2013-08-15 9:18 UTC (permalink / raw)
To: David Miller; +Cc: moshel, netdev, roland, eli
In-Reply-To: <20130815.014837.1103024579636450520.davem@davemloft.net>
On 15/08/2013 11:48, David Miller wrote:
> From: Moshe Lazer <moshel@mellanox.com>
> Date: Wed, 14 Aug 2013 17:46:48 +0300
>
>> In the previous QUERY_PAGES command version we used one command to get the
>> required amount of boot, init and post init pages. The new version uses the
>> op_mod field to specify whether the query is for the required amount of boot,
>> init or post init pages. In addition the output field size for the required
>> amount of pages increased from 16 to 32 bits.
>>
>> In MANAGE_PAGES command the input_num_entries and output_num_entries fields
>> sizes changed from 16 to 32 bits and the PAS tables offset changed to 0x10.
>>
>> In the pages request event the num_pages field also changed to 32 bits.
>>
>> In the HCA-capabilities-layout the size and location of max_qp_mcg field has
>> been changed to support 24 bits.
>>
>> This patch isn't compatible with firmware versions < 5; however, it turns out that the
>> first GA firmware we will publish will not support previous versions so this should be OK.
>>
>> Signed-off-by: Moshe Lazer <moshel@mellanox.com>
>> Signed-off-by: Eli Cohen <eli@mellanox.com>
> You're going to have to explain a few things before I'm even going to consider
> applying this.
Dave, sure, see below:
> What tree are you targetting 'net' or 'net-next'?
>
> Next, does this break things for people using older firmware?
>
> I don't see anything that verifies that the firmware is of a version
> that uses the command data structures you're changing in this patch.
>
> If you're not checking, this is terrible, and I find it utterly
> unacceptable.
>
> You can't just go "oh the latest firmware uses this new layout, so
> we don't have to consider what the older firmware wants."
>
YES, this is for net (3.11), sorry for the missing label in the [PATCH]
brackets part.
The mlx5 driver serves new hardware, of an HCA called ConnectIB for
which there was no GA firmware release yet, 3.11 is the first upstream
release that supports that HW.
So in that respect, for those users having firmware with Command IF Rev
< 5, the patch doesn't let them work, HOWEVER, they will get warning
from mlx5_cmd_init() which is called by the IB driver (who does
mlx5_dev_init() --> mlx5_cmd_init()) that the command revision isn't
supported and hence will realize the firmware needs to be upgraded, see
this code snippet:
cmd->cmdif_rev = ioread32be(&dev->iseg->cmdif_rev_fw_sub) >> 16;
if (cmd->cmdif_rev > CMD_IF_REV) {
dev_err(&dev->pdev->dev, "driver does not support command interface
version.[..]
The related code is present in the mlx5_core driver which is serving as
library for the IB driver and future transport (e.g Ethernet) drivers.
This commit fixes an issue (bug) which we find in testing done on the
code/firmware used for the initial merge, xxit happens, indeed. All in
all, we understand that moving forward, after the initial FW GA or the
release of 3.11, we will have to maintain FW/driver compatibility.
Or.
^ permalink raw reply
* Re: [PATCH RESEND 1/8] net: fsl_pq_mdio: use platform_{get,set}_drvdata()
From: Libo Chen @ 2013-08-15 9:27 UTC (permalink / raw)
To: Sergei Shtylyov; +Cc: David Miller, netdev, LKML, Li Zefan
In-Reply-To: <520BD275.5060004@cogentembedded.com>
On 2013/8/15 2:54, Sergei Shtylyov wrote:
> Hello.
>
> On 08/14/2013 07:39 AM, Libo Chen wrote:
>
>> We can use the wrapper functions platform_{get,set}_drvdata() instead of
>> dev_{get,set}_drvdata() with &pdev->dev, it is convenient for user.
>
>> Also, unnecessary dev_set_drvdata() is removed, because the driver core
>> clears the driver data to NULL after device_release or on probe failure.
>
> You misunderstood. That's a material for 2 separate patch sets (or maybe single patches, since multiple files can be collapsed in a single patch).
>
okay, thanks.
Libo
>> Signed-off-by: Libo Chen <libo.chen@huawei.com>
>
> WBR, Sergei
>
>
>
^ permalink raw reply
* [Patch net-next v2] net: sync some IP headers with glibc
From: Cong Wang @ 2013-08-15 9:28 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Thomas Backlund, libc-alpha, YOSHIFUJI Hideaki,
Carlos O'Donell, Cong Wang
From: Carlos O'Donell <carlos@redhat.com>
Solution:
=========
- Synchronize linux's `include/uapi/linux/in6.h'
with glibc's `inet/netinet/in.h'.
- Synchronize glibc's `inet/netinet/in.h with linux's
`include/uapi/linux/in6.h'.
- Allow including the headers in either other.
- First header included defines the structures and macros.
Details:
========
The kernel promises not to break the UAPI ABI so I don't
see why we can't just have the two userspace headers
coordinate?
If you include the kernel headers first you get those,
and if you include the glibc headers first you get those,
and the following patch arranges a coordination and
synchronization between the two.
Let's handle `include/uapi/linux/in6.h' from linux,
and `inet/netinet/in.h' from glibc and ensure they compile
in any order and preserve the required ABI.
These two patches pass the following compile tests:
cat >> test1.c <<EOF
#include <netinet/in.h>
#include <linux/in6.h>
int main (void) {
return 0;
}
EOF
gcc -c test1.c
cat >> test2.c <<EOF
#include <linux/in6.h>
#include <netinet/in.h>
int main (void) {
return 0;
}
EOF
gcc -c test2.c
One wrinkle is that the kernel has a different name for one of
the members in ipv6_mreq. In the kernel patch we create a macro
to cover the uses of the old name, and while that's not entirely
clean it's one of the best solutions (aside from an anonymous
union which has other issues).
I've reviewed the code and it looks to me like the ABI is
assured and everything matches on both sides.
Notes:
- You want netinet/in.h to include bits/in.h as early as possible,
but it needs in_addr so define in_addr early.
- You want bits/in.h included as early as possible so you can use
the linux specific code to define __USE_KERNEL_DEFS based on
the _UAPI_* macro definition and use those to cull in.h.
- glibc was missing IPPROTO_MH, added here.
Compile tested and inspected.
Reported-by: Thomas Backlund <tmb@mageia.org>
Cc: Thomas Backlund <tmb@mageia.org>
Cc: libc-alpha@sourceware.org
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: David S. Miller <davem@davemloft.net>
Tested-by: Cong Wang <amwang@redhat.com>
Signed-off-by: Carlos O'Donell <carlos@redhat.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
---
v2: reformat some comments
diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild
index 997f9f2..e7c94ee 100644
--- a/include/uapi/linux/Kbuild
+++ b/include/uapi/linux/Kbuild
@@ -227,6 +227,7 @@ header-y += kvm_para.h
endif
header-y += l2tp.h
+header-y += libc-compat.h
header-y += limits.h
header-y += llc.h
header-y += loop.h
diff --git a/include/uapi/linux/in.h b/include/uapi/linux/in.h
index 9edb441..f9e8e49 100644
--- a/include/uapi/linux/in.h
+++ b/include/uapi/linux/in.h
@@ -24,30 +24,53 @@
/* Standard well-defined IP protocols. */
enum {
IPPROTO_IP = 0, /* Dummy protocol for TCP */
+#define IPPROTO_IP IPPROTO_IP
IPPROTO_ICMP = 1, /* Internet Control Message Protocol */
+#define IPPROTO_ICMP IPPROTO_ICMP
IPPROTO_IGMP = 2, /* Internet Group Management Protocol */
+#define IPPROTO_IGMP IPPROTO_IGMP
IPPROTO_IPIP = 4, /* IPIP tunnels (older KA9Q tunnels use 94) */
+#define IPPROTO_IPIP IPPROTO_IPIP
IPPROTO_TCP = 6, /* Transmission Control Protocol */
+#define IPPROTO_TCP IPPROTO_TCP
IPPROTO_EGP = 8, /* Exterior Gateway Protocol */
+#define IPPROTO_EGP IPPROTO_EGP
IPPROTO_PUP = 12, /* PUP protocol */
+#define IPPROTO_PUP IPPROTO_PUP
IPPROTO_UDP = 17, /* User Datagram Protocol */
+#define IPPROTO_UDP IPPROTO_UDP
IPPROTO_IDP = 22, /* XNS IDP protocol */
+#define IPPROTO_IDP IPPROTO_IDP
+ IPPROTO_TP = 29, /* SO Transport Protocol Class 4 */
+#define IPPROTO_TP IPPROTO_TP
IPPROTO_DCCP = 33, /* Datagram Congestion Control Protocol */
- IPPROTO_RSVP = 46, /* RSVP protocol */
+#define IPPROTO_DCCP IPPROTO_DCCP
+ IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */
+#define IPPROTO_IPV6 IPPROTO_IPV6
+ IPPROTO_RSVP = 46, /* RSVP Protocol */
+#define IPPROTO_RSVP IPPROTO_RSVP
IPPROTO_GRE = 47, /* Cisco GRE tunnels (rfc 1701,1702) */
-
- IPPROTO_IPV6 = 41, /* IPv6-in-IPv4 tunnelling */
-
- IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */
- IPPROTO_AH = 51, /* Authentication Header protocol */
- IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */
- IPPROTO_PIM = 103, /* Protocol Independent Multicast */
-
- IPPROTO_COMP = 108, /* Compression Header protocol */
- IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
+#define IPPROTO_GRE IPPROTO_GRE
+ IPPROTO_ESP = 50, /* Encapsulation Security Payload protocol */
+#define IPPROTO_ESP IPPROTO_ESP
+ IPPROTO_AH = 51, /* Authentication Header protocol */
+#define IPPROTO_AH IPPROTO_AH
+ IPPROTO_MTP = 92, /* Multicast Transport Protocol */
+#define IPPROTO_MTP IPPROTO_MTP
+ IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET */
+#define IPPROTO_BEETPH IPPROTO_BEETPH
+ IPPROTO_ENCAP = 98, /* Encapsulation Header */
+#define IPPROTO_ENCAP IPPROTO_ENCAP
+ IPPROTO_PIM = 103, /* Protocol Independent Multicast */
+#define IPPROTO_PIM IPPROTO_PIM
+ IPPROTO_COMP = 108, /* Compression Header Protocol */
+#define IPPROTO_COMP IPPROTO_COMP
+ IPPROTO_SCTP = 132, /* Stream Control Transport Protocol */
+#define IPPROTO_SCTP IPPROTO_SCTP
IPPROTO_UDPLITE = 136, /* UDP-Lite (RFC 3828) */
-
- IPPROTO_RAW = 255, /* Raw IP packets */
+#define IPPROTO_UDPLITE IPPROTO_UDPLITE
+ IPPROTO_RAW = 255, /* Raw IP packets */
+#define IPPROTO_RAW IPPROTO_RAW
IPPROTO_MAX
};
diff --git a/include/uapi/linux/in6.h b/include/uapi/linux/in6.h
index 53b1d56..440d5c4 100644
--- a/include/uapi/linux/in6.h
+++ b/include/uapi/linux/in6.h
@@ -22,22 +22,30 @@
#define _UAPI_LINUX_IN6_H
#include <linux/types.h>
+#include <linux/libc-compat.h>
/*
* IPv6 address structure
*/
+#if __UAPI_DEF_IN6_ADDR
struct in6_addr {
union {
__u8 u6_addr8[16];
+#if __UAPI_DEF_IN6_ADDR_ALT
__be16 u6_addr16[8];
__be32 u6_addr32[4];
+#endif
} in6_u;
#define s6_addr in6_u.u6_addr8
+#if __UAPI_DEF_IN6_ADDR_ALT
#define s6_addr16 in6_u.u6_addr16
#define s6_addr32 in6_u.u6_addr32
+#endif
};
+#endif /* __UAPI_DEF_IN6_ADDR */
+#if __UAPI_DEF_SOCKADDR_IN6
struct sockaddr_in6 {
unsigned short int sin6_family; /* AF_INET6 */
__be16 sin6_port; /* Transport layer port # */
@@ -45,7 +53,9 @@ struct sockaddr_in6 {
struct in6_addr sin6_addr; /* IPv6 address */
__u32 sin6_scope_id; /* scope id (new in RFC2553) */
};
+#endif /* __UAPI_DEF_SOCKADDR_IN6 */
+#if __UAPI_DEF_IPV6_MREQ
struct ipv6_mreq {
/* IPv6 multicast address of group */
struct in6_addr ipv6mr_multiaddr;
@@ -53,6 +63,7 @@ struct ipv6_mreq {
/* local IPv6 address of interface */
int ipv6mr_ifindex;
};
+#endif /* __UAPI_DEF_IVP6_MREQ */
#define ipv6mr_acaddr ipv6mr_multiaddr
@@ -114,13 +125,24 @@ struct in6_flowlabel_req {
/*
* IPV6 extension headers
*/
-#define IPPROTO_HOPOPTS 0 /* IPv6 hop-by-hop options */
-#define IPPROTO_ROUTING 43 /* IPv6 routing header */
-#define IPPROTO_FRAGMENT 44 /* IPv6 fragmentation header */
-#define IPPROTO_ICMPV6 58 /* ICMPv6 */
-#define IPPROTO_NONE 59 /* IPv6 no next header */
-#define IPPROTO_DSTOPTS 60 /* IPv6 destination options */
-#define IPPROTO_MH 135 /* IPv6 mobility header */
+#if __UAPI_DEF_IPPROTO_V6
+enum {
+ IPPROTO_HOPOPTS = 0, /* IPv6 hop-by-hop options */
+#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
+ IPPROTO_ROUTING = 43, /* IPv6 routing header */
+#define IPPROTO_ROUTING IPPROTO_ROUTING
+ IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header */
+#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
+ IPPROTO_ICMPV6 = 58, /* ICMPv6 */
+#define IPPROTO_ICMPV6 IPPROTO_ICMPV6
+ IPPROTO_NONE = 59, /* IPv6 no next header */
+#define IPPROTO_NONE IPPROTO_NONE
+ IPPROTO_DSTOPTS = 60, /* IPv6 destination options */
+#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS
+ IPPROTO_MH = 135, /* IPv6 mobility header */
+#define IPPROTO_MH IPPROTO_MH
+};
+#endif /* __UAPI_DEF_IPPROTO_V6 */
/*
* IPv6 TLV options.
diff --git a/include/uapi/linux/libc-compat.h b/include/uapi/linux/libc-compat.h
new file mode 100644
index 0000000..335e8a7
--- /dev/null
+++ b/include/uapi/linux/libc-compat.h
@@ -0,0 +1,103 @@
+/*
+ * Compatibility interface for userspace libc header coordination:
+ *
+ * Define compatibility macros that are used to control the inclusion or
+ * exclusion of UAPI structures and definitions in coordination with another
+ * userspace C library.
+ *
+ * This header is intended to solve the problem of UAPI definitions that
+ * conflict with userspace definitions. If a UAPI header has such conflicting
+ * definitions then the solution is as follows:
+ *
+ * * Synchronize the UAPI header and the libc headers so either one can be
+ * used and such that the ABI is preserved. If this is not possible then
+ * no simple compatibility interface exists (you need to write translating
+ * wrappers and rename things) and you can't use this interface.
+ *
+ * Then follow this process:
+ *
+ * (a) Include libc-compat.h in the UAPI header.
+ * e.g. #include <linux/libc-compat.h>
+ * This include must be as early as possible.
+ *
+ * (b) In libc-compat.h add enough code to detect that the comflicting
+ * userspace libc header has been included first.
+ *
+ * (c) If the userspace libc header has been included first define a set of
+ * guard macros of the form __UAPI_DEF_FOO and set their values to 1, else
+ * set their values to 0.
+ *
+ * (d) Back in the UAPI header with the conflicting definitions, guard the
+ * definitions with:
+ * #if __UAPI_DEF_FOO
+ * ...
+ * #endif
+ *
+ * This fixes the situation where the linux headers are included *after* the
+ * libc headers. To fix the problem with the inclusion in the other order the
+ * userspace libc headers must be fixed like this:
+ *
+ * * For all definitions that conflict with kernel definitions wrap those
+ * defines in the following:
+ * #if !__UAPI_DEF_FOO
+ * ...
+ * #endif
+ *
+ * This prevents the redefinition of a construct already defined by the kernel.
+ */
+#ifndef _UAPI_LIBC_COMPAT_H
+#define _UAPI_LIBC_COMPAT_H
+
+/* We have included glibc headers... */
+#if defined(__GLIBC__)
+
+/* Coordinate with glibc netinet/in.h header. */
+#if defined(_NETINET_IN_H)
+
+/* GLIBC headers included first so don't define anything
+ * that would already be defined. */
+#define __UAPI_DEF_IN6_ADDR 0
+/* The exception is the in6_addr macros which must be defined
+ * if the glibc code didn't define them. This guard matches
+ * the guard in glibc/inet/netinet/in.h which defines the
+ * additional in6_addr macros e.g. s6_addr16, and s6_addr32. */
+#if defined(__USE_MISC) || defined (__USE_GNU)
+#define __UAPI_DEF_IN6_ADDR_ALT 0
+#else
+#define __UAPI_DEF_IN6_ADDR_ALT 1
+#endif
+#define __UAPI_DEF_SOCKADDR_IN6 0
+#define __UAPI_DEF_IPV6_MREQ 0
+#define __UAPI_DEF_IPPROTO_V6 0
+
+#else
+
+/* Linux headers included first, and we must define everything
+ * we need. The expectation is that glibc will check the
+ * __UAPI_DEF_* defines and adjust appropriately. */
+#define __UAPI_DEF_IN6_ADDR 1
+/* We unconditionally define the in6_addr macros and glibc must
+ * coordinate. */
+#define __UAPI_DEF_IN6_ADDR_ALT 1
+#define __UAPI_DEF_SOCKADDR_IN6 1
+#define __UAPI_DEF_IPV6_MREQ 1
+#define __UAPI_DEF_IPPROTO_V6 1
+
+#endif /* _NETINET_IN_H */
+
+
+/* If we did not see any headers from any supported C libraries,
+ * or we are being included in the kernel, then define everything
+ * that we need. */
+#else /* !defined(__GLIBC__) */
+
+/* Definitions for in6.h */
+#define __UAPI_DEF_IN6_ADDR 1
+#define __UAPI_DEF_IN6_ADDR_ALT 1
+#define __UAPI_DEF_SOCKADDR_IN6 1
+#define __UAPI_DEF_IPV6_MREQ 1
+#define __UAPI_DEF_IPPROTO_V6 1
+
+#endif /* __GLIBC__ */
+
+#endif /* _UAPI_LIBC_COMPAT_H */
^ permalink raw reply related
* [GLIBC Patch v2] inet: avoid redefinition of some structs in kernel
From: Cong Wang @ 2013-08-15 9:28 UTC (permalink / raw)
To: netdev
Cc: David S. Miller, Thomas Backlund, libc-alpha, YOSHIFUJI Hideaki,
Carlos O'Donell, Cong Wang
In-Reply-To: <1376558891-26221-1-git-send-email-amwang@redhat.com>
From: Carlos O'Donell <carlos@redhat.com>
- Synchronize linux's `include/uapi/linux/in6.h'
with glibc's `inet/netinet/in.h'.
- Synchronize glibc's `inet/netinet/in.h with linux's
`include/uapi/linux/in6.h'.
- Allow including the headers in either other.
- First header included defines the structures and macros.
Notes:
- You want netinet/in.h to include bits/in.h as early as possible,
but it needs in_addr so define in_addr early.
- You want bits/in.h included as early as possible so you can use
the linux specific code to define __USE_KERNEL_DEFS based on
the _UAPI_* macro definition and use those to cull in.h.
- glibc was missing IPPROTO_MH, added here.
Reported-by: Thomas Backlund <tmb@mageia.org>
Cc: Thomas Backlund <tmb@mageia.org>
Cc: libc-alpha@sourceware.org
Cc: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
Cc: David S. Miller <davem@davemloft.net>
Signed-off-by: Carlos O'Donell <carlos@redhat.com>
Tested-by: Cong Wang <amwang@redhat.com>
Signed-off-by: Cong Wang <amwang@redhat.com>
2013-08-13 Carlos O'Donell <carlos@redhat.com>
Cong Wang <amwang@redhat.com>
* sysdeps/unix/sysv/linux/bits/in.h
[_UAPI_LINUX_IN6_H]: Define __USE_KERNEL_IPV6_DEFS.
* inet/netinet/in.h: Move in_addr definition and bits/in.h inclusion
before __USE_KERNEL_IPV6_DEFS uses.
* inet/netinet/in.h [!__USE_KERNEL_IPV6_DEFS]: Define IPPROTO_MH, and
IPPROTO_BEETPH.
[__USE_KERNEL_IPV6_DEFS]: Don't define any of IPPROTO_*, in6_addr,
sockaddr_in6, or ipv6_mreq.
---
diff --git a/inet/netinet/in.h b/inet/netinet/in.h
index 89e3813..05c77e2 100644
--- a/inet/netinet/in.h
+++ b/inet/netinet/in.h
@@ -26,13 +26,21 @@
__BEGIN_DECLS
+/* Internet address. */
+typedef uint32_t in_addr_t;
+struct in_addr
+ {
+ in_addr_t s_addr;
+ };
+
+/* Get system-specific definitions. */
+#include <bits/in.h>
+
/* Standard well-defined IP protocols. */
enum
{
IPPROTO_IP = 0, /* Dummy protocol for TCP. */
#define IPPROTO_IP IPPROTO_IP
- IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */
-#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
IPPROTO_ICMP = 1, /* Internet Control Message Protocol. */
#define IPPROTO_ICMP IPPROTO_ICMP
IPPROTO_IGMP = 2, /* Internet Group Management Protocol. */
@@ -55,10 +63,6 @@ enum
#define IPPROTO_DCCP IPPROTO_DCCP
IPPROTO_IPV6 = 41, /* IPv6 header. */
#define IPPROTO_IPV6 IPPROTO_IPV6
- IPPROTO_ROUTING = 43, /* IPv6 routing header. */
-#define IPPROTO_ROUTING IPPROTO_ROUTING
- IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */
-#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
IPPROTO_RSVP = 46, /* Reservation Protocol. */
#define IPPROTO_RSVP IPPROTO_RSVP
IPPROTO_GRE = 47, /* General Routing Encapsulation. */
@@ -67,14 +71,10 @@ enum
#define IPPROTO_ESP IPPROTO_ESP
IPPROTO_AH = 51, /* authentication header. */
#define IPPROTO_AH IPPROTO_AH
- IPPROTO_ICMPV6 = 58, /* ICMPv6. */
-#define IPPROTO_ICMPV6 IPPROTO_ICMPV6
- IPPROTO_NONE = 59, /* IPv6 no next header. */
-#define IPPROTO_NONE IPPROTO_NONE
- IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */
-#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS
IPPROTO_MTP = 92, /* Multicast Transport Protocol. */
#define IPPROTO_MTP IPPROTO_MTP
+ IPPROTO_BEETPH = 94, /* IP option pseudo header for BEET. */
+#define IPPROTO_BEETPH IPPROTO_BEETPH
IPPROTO_ENCAP = 98, /* Encapsulation Header. */
#define IPPROTO_ENCAP IPPROTO_ENCAP
IPPROTO_PIM = 103, /* Protocol Independent Multicast. */
@@ -90,6 +90,28 @@ enum
IPPROTO_MAX
};
+/* If __USER_KERNEL_IPV6_DEFS is defined then the user has included the kernel
+ network headers first and we should use those ABI-identical definitions
+ instead of our own. */
+#ifndef __USE_KERNEL_IPV6_DEFS
+enum
+ {
+ IPPROTO_HOPOPTS = 0, /* IPv6 Hop-by-Hop options. */
+#define IPPROTO_HOPOPTS IPPROTO_HOPOPTS
+ IPPROTO_ROUTING = 43, /* IPv6 routing header. */
+#define IPPROTO_ROUTING IPPROTO_ROUTING
+ IPPROTO_FRAGMENT = 44, /* IPv6 fragmentation header. */
+#define IPPROTO_FRAGMENT IPPROTO_FRAGMENT
+ IPPROTO_ICMPV6 = 58, /* ICMPv6. */
+#define IPPROTO_ICMPV6 IPPROTO_ICMPV6
+ IPPROTO_NONE = 59, /* IPv6 no next header. */
+#define IPPROTO_NONE IPPROTO_NONE
+ IPPROTO_DSTOPTS = 60, /* IPv6 destination options. */
+#define IPPROTO_DSTOPTS IPPROTO_DSTOPTS
+ IPPROTO_MH = 135, /* IPv6 mobility header. */
+#define IPPROTO_MH IPPROTO_MH
+ };
+#endif /* !__USE_KERNEL_IPV6_DEFS */
/* Type to represent a port. */
typedef uint16_t in_port_t;
@@ -134,15 +156,6 @@ enum
IPPORT_USERRESERVED = 5000
};
-
-/* Internet address. */
-typedef uint32_t in_addr_t;
-struct in_addr
- {
- in_addr_t s_addr;
- };
-
-
/* Definitions of the bits in an Internet address integer.
On subnets, host and network parts are found according to
@@ -191,7 +204,7 @@ struct in_addr
#define INADDR_ALLRTRS_GROUP ((in_addr_t) 0xe0000002) /* 224.0.0.2 */
#define INADDR_MAX_LOCAL_GROUP ((in_addr_t) 0xe00000ff) /* 224.0.0.255 */
-
+#ifndef __USE_KERNEL_IPV6_DEFS
/* IPv6 address */
struct in6_addr
{
@@ -209,6 +222,7 @@ struct in6_addr
# define s6_addr32 __in6_u.__u6_addr32
#endif
};
+#endif /* !__USE_KERNEL_IPV6_DEFS */
extern const struct in6_addr in6addr_any; /* :: */
extern const struct in6_addr in6addr_loopback; /* ::1 */
@@ -233,6 +247,7 @@ struct sockaddr_in
sizeof (struct in_addr)];
};
+#ifndef __USE_KERNEL_IPV6_DEFS
/* Ditto, for IPv6. */
struct sockaddr_in6
{
@@ -242,7 +257,7 @@ struct sockaddr_in6
struct in6_addr sin6_addr; /* IPv6 address */
uint32_t sin6_scope_id; /* IPv6 scope-id */
};
-
+#endif /* !__USE_KERNEL_IPV6_DEFS */
#if defined __USE_MISC || defined __USE_GNU
/* IPv4 multicast request. */
@@ -268,7 +283,7 @@ struct ip_mreq_source
};
#endif
-
+#ifndef __USE_KERNEL_IPV6_DEFS
/* Likewise, for IPv6. */
struct ipv6_mreq
{
@@ -278,7 +293,7 @@ struct ipv6_mreq
/* local interface */
unsigned int ipv6mr_interface;
};
-
+#endif /* !__USE_KERNEL_IPV6_DEFS */
#if defined __USE_MISC || defined __USE_GNU
/* Multicast group request. */
@@ -349,10 +364,6 @@ struct group_filter
* sizeof (struct sockaddr_storage)))
#endif
-
-/* Get system-specific definitions. */
-#include <bits/in.h>
-
/* Functions to convert between host and network byte order.
Please note that these functions normally take `unsigned long int' or
diff --git a/sysdeps/unix/sysv/linux/bits/in.h b/sysdeps/unix/sysv/linux/bits/in.h
index e959b33..d763ce9 100644
--- a/sysdeps/unix/sysv/linux/bits/in.h
+++ b/sysdeps/unix/sysv/linux/bits/in.h
@@ -21,6 +21,18 @@
# error "Never use <bits/in.h> directly; include <netinet/in.h> instead."
#endif
+/* If the application has already included linux/in6.h from a linux-based
+ kernel then we will not define the IPv6 IPPROTO_* defines, in6_addr (nor the
+ defines), sockaddr_in6, or ipv6_mreq. The ABI used by the linux-kernel and
+ glibc match exactly. Neither the linux kernel nor glibc should break this
+ ABI without coordination. */
+#ifdef _UAPI_LINUX_IN6_H
+/* This is not quite the same API since the kernel always defines s6_addr16 and
+ s6_addr32. This is not a violation of POSIX since POSIX says "at least the
+ following member" and that holds true. */
+# define __USE_KERNEL_IPV6_DEFS
+#endif
+
/* Options for use with `getsockopt' and `setsockopt' at the IP level.
The first word in the comment at the right is the data type used;
"bool" means a boolean value stored in an `int'. */
^ permalink raw reply related
* Re: ethernet: ti: cpsw/mdio: suspend/resume
From: Mugunthan V N @ 2013-08-15 9:57 UTC (permalink / raw)
To: Daniel Mack; +Cc: Vaibhav Bedia, netdev, Sebastian Siewior
In-Reply-To: <520BECA2.90800@gmail.com>
On Thursday 15 August 2013 02:16 AM, Daniel Mack wrote:
> Hi Mugunthan,
>
> Vaibhav told me that you are working on a patch to add suspend/resume
> functions to the cpsw and davinci_mdio driver, but searching my archives
> didn't bring up anything.
>
> May I ask whether you have a link to your work, or can I help here in
> any way?
>
>
> Thanks,
> Daniel
Sorry for re-posting the same mail as my previous mail was in html format
Thanks for your helping hand. All my patches for CPSW suspend/resume had
already applied and with Dave Gerlach AM335x suspend/resume patches CPSW
suspend/resume works fine. Dave Gerlach has his branch published at
below link which I had already tested suspend.resume with CPSW ping traffic.
https://github.com/dgerlach/linux-pm/tree/am335x-3.11rc4-suspend-resume
Regards
Mugunthan V N
^ permalink raw reply
* Re: cpsw fails to come up once in a while
From: Mugunthan V N @ 2013-08-15 9:59 UTC (permalink / raw)
To: Sebastian Andrzej Siewior; +Cc: netdev
In-Reply-To: <20130814175439.GA13483@linutronix.de>
On Wednesday 14 August 2013 11:24 PM, Sebastian Andrzej Siewior wrote:
> Hi,
>
> So I have this test where my am335x-evm boots over NFS and once it
> completes it does it again. It works most of the time :) However once it
> like 100 attempts it does not. After the reset u-boot complains about
> ethernet timeout and linux has also no luck:
>
> | U-Boot 2013.04-00274-ga71d45d (May 27 2013 - 12:41:57)
> |
> |…
> | Net: Phy not found
> | PHY reset timed out
> | cpsw, usb_ether
> | Hit any key to stop autoboot: 1 ^H^H^H 0
> | link up on port 0, speed 1000, full duplex
> | Using cpsw device
> | TFTP from server 172.123.10.10; our IP address is 172.123.10.3
> | Filename 'am335x/zImage'.
> | Load address: 0x80200000
> | Loading: *^H#################################################################
> | #################################################################
> | #######################################
> | 509.8 KiB/s
>
> So the PHY was not found but somehow it managed to fetch the kernel over
> network and boot it. The linux driver did not want to continue:
>
> | omap_i2c 4802a000.i2c: bus 1 rev0.11 at 100 kHz
> | davinci_mdio 4a101000.mdio: davinci mdio revision 1.6
> | davinci_mdio 4a101000.mdio: no live phy, scanning all
> | davinci_mdio: probe of 4a101000.mdio failed with error -5
> | Random MACID = 16:74:44:51:f1:0f
> | gpio-keys volume_keys.6: Unable to claim irq 0; error -22
> | gpio-keys: probe of volume_keys.6 failed with error -22
> | omap_rtc 44e3e000.rtc: setting system clock to 2000-01-01 03:22:52 UTC (946696972)
> | net eth0: initializing cpsw version 1.12 (0)
> | libphy: PHY 4a101000.mdio:00 not found
> | net eth0: phy 4a101000.mdio:00 not found on slave 0
> | libphy: PHY 4a101000.mdio:01 not found
> | net eth0: phy 4a101000.mdio:01 not found on slave 1
> | Waiting up to 110 more seconds for network.
>
> so the driver also failed to find a PHY and gave up.
> Is this something known?
>
> Sebastian
This is a unknown issue. Will arrange a setup to test this scenario and
fix the issue.
Regards
Mugunthan V N
^ permalink raw reply
* Re: Fwd: RFC 6980 on Security Implications of IPv6 Fragmentation with IPv6 Neighbor Discovery
From: Hannes Frederic Sowa @ 2013-08-15 10:04 UTC (permalink / raw)
To: Fernando Gont; +Cc: netdev
In-Reply-To: <520C7519.1010000@gont.com.ar>
On Thu, Aug 15, 2013 at 03:28:41AM -0300, Fernando Gont wrote:
> Thanks so much for your timely response! -- Please find my comments
> in-line...
>
> On 08/14/2013 08:06 PM, Hannes Frederic Sowa wrote:
> > On Wed, Aug 14, 2013 at 05:19:13AM -0300, Fernando Gont wrote:
> >> Folks,
> >>
> >> FYI. -- this is an important piece when it comes to First Hop (i.e.,
> >> "local link") Security.
> >
> > Thanks for the heads-up, Fernando!
> >
> > I sketched up a patch to protect the receiving side. I still don't know if I
> > should make this behaviour default or configurable via a sysctl knob. I really
> > don't want to break existing installations.
>
> Make it the default behavior. If anything, provide a sysctl knob to
> override it.
>
> Note: In the specific case of NS/NA messages, it's impossible nowadays
> to find them fragmented in a real network (we don't even have options
> (other than padding) to make NS/NAs grow so large!).
Yes, I also do favour making this the default behavior.
> > As an extra plus, we now discard packets with nested fragment headers at once.
> > Those packets should never have been accepted.
>
> Is that the "goto fail_hdr" part in your patch?
Yes, still have to check if I should silently ignore them or generate a
parameter problem (that is the current behavior).
>
> P.S.: What about RS/RA messages?
ndisc_rcv, which does now silently discard fragmented packets, is called
for the following types:
case NDISC_ROUTER_SOLICITATION:
case NDISC_ROUTER_ADVERTISEMENT:
case NDISC_NEIGHBOUR_SOLICITATION:
case NDISC_NEIGHBOUR_ADVERTISEMENT:
case NDISC_REDIRECT:
So all packet types from RFC6980 should be covered (we do not support SEND,
yet).
Thanks,
Hannes
^ permalink raw reply
* Re: ethernet: ti: cpsw/mdio: suspend/resume
From: Daniel Mack @ 2013-08-15 10:04 UTC (permalink / raw)
To: Mugunthan V N; +Cc: Vaibhav Bedia, netdev, Sebastian Siewior
In-Reply-To: <520CA61F.3050802@ti.com>
On 15.08.2013 11:57, Mugunthan V N wrote:
> On Thursday 15 August 2013 02:16 AM, Daniel Mack wrote:
>> Vaibhav told me that you are working on a patch to add suspend/resume
>> functions to the cpsw and davinci_mdio driver, but searching my archives
>> didn't bring up anything.
>>
>> May I ask whether you have a link to your work, or can I help here in
>> any way?
>>
>>
>> Thanks,
>> Daniel
> Sorry for re-posting the same mail as my previous mail was in html format
>
> Thanks for your helping hand. All my patches for CPSW suspend/resume had
> already applied
You're talking about the pinctrl related patches, right?
> and with Dave Gerlach AM335x suspend/resume patches CPSW
> suspend/resume works fine. Dave Gerlach has his branch published at
> below link which I had already tested suspend.resume with CPSW ping traffic.
> https://github.com/dgerlach/linux-pm/tree/am335x-3.11rc4-suspend-resume
Hmm, I'm testing with this tree as well, and at least when mounting the
rootfs via NFS, ethernet is dead after resume. But I'll do more tests
soon and let you know. I just thought I'm missing some patch.
Thanks for the update,
Daniel
^ permalink raw reply
* Re: cpsw fails to come up once in a while
From: Sebastian Andrzej Siewior @ 2013-08-15 10:12 UTC (permalink / raw)
To: Mugunthan V N; +Cc: netdev
In-Reply-To: <520CA67F.4000902@ti.com>
On 08/15/2013 11:59 AM, Mugunthan V N wrote:
> This is a unknown issue. Will arrange a setup to test this scenario and
> fix the issue.
Ah, cool. Once in this state I tried various things but nothing helped.
I tried to reset the HW phy and see if this helped but it ended while I
looking for schematics and I though maybe it is easier to ask first.
One think I noticed in __davinci_mdio_reset() is that
data->access_time is set via usecs_to_jiffies() and then used by
msleep(). Since msleep() expects ms and not jiffies, this is wrong.
>
> Regards
> Mugunthan V N
Sebastian
^ permalink raw reply
* Re: Fwd: RFC 6980 on Security Implications of IPv6 Fragmentation with IPv6 Neighbor Discovery
From: Loganaden Velvindron @ 2013-08-15 10:14 UTC (permalink / raw)
To: Fernando Gont, netdev
In-Reply-To: <20130815100407.GA18564@order.stressinduktion.org>
On Thu, Aug 15, 2013 at 2:04 PM, Hannes Frederic Sowa
<hannes@stressinduktion.org> wrote:
>
> On Thu, Aug 15, 2013 at 03:28:41AM -0300, Fernando Gont wrote:
> > Thanks so much for your timely response! -- Please find my comments
> > in-line...
> >
> > On 08/14/2013 08:06 PM, Hannes Frederic Sowa wrote:
> > > On Wed, Aug 14, 2013 at 05:19:13AM -0300, Fernando Gont wrote:
> > >> Folks,
> > >>
> > >> FYI. -- this is an important piece when it comes to First Hop (i.e.,
> > >> "local link") Security.
> > >
> > > Thanks for the heads-up, Fernando!
> > >
> > > I sketched up a patch to protect the receiving side. I still don't know if I
> > > should make this behaviour default or configurable via a sysctl knob. I really
> > > don't want to break existing installations.
> >
> > Make it the default behavior. If anything, provide a sysctl knob to
> > override it.
> >
> > Note: In the specific case of NS/NA messages, it's impossible nowadays
> > to find them fragmented in a real network (we don't even have options
> > (other than padding) to make NS/NAs grow so large!).
>
> Yes, I also do favour making this the default behavior.
>
> > > As an extra plus, we now discard packets with nested fragment headers at once.
> > > Those packets should never have been accepted.
> >
> > Is that the "goto fail_hdr" part in your patch?
>
> Yes, still have to check if I should silently ignore them or generate a
> parameter problem (that is the current behavior).
>
I'm not sure if you got my previous mails, but I'd like to know a
couple of things:
1) How can I test this diff ?
2) It's developed against which git brach ? linux-next ?
3) What will/could break with this diff in a production environment ?
> >
> > P.S.: What about RS/RA messages?
>
>
> ndisc_rcv, which does now silently discard fragmented packets, is called
> for the following types:
>
> case NDISC_ROUTER_SOLICITATION:
> case NDISC_ROUTER_ADVERTISEMENT:
> case NDISC_NEIGHBOUR_SOLICITATION:
> case NDISC_NEIGHBOUR_ADVERTISEMENT:
> case NDISC_REDIRECT:
>
> So all packet types from RFC6980 should be covered (we do not support SEND,
> yet).
>
> Thanks,
>
> Hannes
>
> --
> 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 message is strictly personal and the opinions expressed do not
represent those of my employers, either past or present.
^ permalink raw reply
* Re: Fwd: RFC 6980 on Security Implications of IPv6 Fragmentation with IPv6 Neighbor Discovery
From: Hannes Frederic Sowa @ 2013-08-15 10:25 UTC (permalink / raw)
To: Loganaden Velvindron; +Cc: Fernando Gont, netdev
In-Reply-To: <CAOp4FwRx3c3deHXupWg3S0aWe4ZJnCT9ORKCWRvUUuxxt1gneQ@mail.gmail.com>
On Thu, Aug 15, 2013 at 02:14:46PM +0400, Loganaden Velvindron wrote:
> I'm not sure if you got my previous mails, but I'd like to know a
> couple of things:
Ah, you asked me off-list. So, for a wider audience, I copy & paste my answers
from the just answered mail. ;)
> 1) How can I test this diff ?
Actually, nothing should change at all.
Myself, I used scapy to construct some packets and send it to a system
with the patched kernel and had some printks sprinkeled in the source
while watching tcpdump.
> 2) It's developed against which git brach ? linux-next ?
Yes, I targeted linux-next. But it should apply to older kernels
without too much fuzz as well.
> 3) What will/could break with this diff in a production environment ?
RA messages could get fragmented if a speaker puts lots of options in it. I
hope all RA speakers already spread the options over multiple RAs, but I don't
know. In case the RA is fragmented it will now be dropped silently.
Thanks,
Hannes
^ permalink raw reply
* Re: [PATCH] bond: Don't set skb->queue_mapping in netpoll.
From: Cong Wang @ 2013-08-15 10:35 UTC (permalink / raw)
To: Tao Ma; +Cc: netdev, linux-kernel, David S. Miller, Eric Dumazet
In-Reply-To: <1376555808-6531-1-git-send-email-tm@tao.ma>
On Thu, 2013-08-15 at 16:36 +0800, Tao Ma wrote:
> From: Tao Ma <boyu.mt@taobao.com>
>
> When we are using netpoll, we don't go through the normal
> transmit process. In this case, bond_select_queue is not called
> and qdisc_skb_cb(skb)->slave_dev_queue_mapping isn't set.
>
Yes?
In netpoll_send_skb_on_dev() we have:
if (skb_queue_len(&npinfo->txq) == 0 && !
netpoll_owner_active(dev)) {
struct netdev_queue *txq;
txq = netdev_pick_tx(dev, skb);
...
where netdev_pick_tx() will call ->ndo_select_queue().
^ permalink raw reply
* Re: cpsw fails to come up once in a while
From: Mugunthan V N @ 2013-08-15 10:36 UTC (permalink / raw)
To: Sebastian Andrzej Siewior; +Cc: netdev
In-Reply-To: <520CA9A1.4050205@linutronix.de>
On Thursday 15 August 2013 03:42 PM, Sebastian Andrzej Siewior wrote:
> On 08/15/2013 11:59 AM, Mugunthan V N wrote:
>> This is a unknown issue. Will arrange a setup to test this scenario and
>> fix the issue.
> Ah, cool. Once in this state I tried various things but nothing helped.
> I tried to reset the HW phy and see if this helped but it ended while I
> looking for schematics and I though maybe it is easier to ask first.
In AM335x EVM, you need to probe a wire if you need to reset phy manually.
>
> One think I noticed in __davinci_mdio_reset() is that
> data->access_time is set via usecs_to_jiffies() and then used by
> msleep(). Since msleep() expects ms and not jiffies, this is wrong.
>
Yeah, just reviewed that code and you are correct. No need to convert as
it is already in ms value.
Regards
Mugunthan V N
^ permalink raw reply
* Re: [PATCH net] net: tg3: fix NULL pointer dereference in tg3_io_error_detected and tg3_io_slot_reset
From: Dmitry Kravkov @ 2013-08-15 10:57 UTC (permalink / raw)
To: David Miller
Cc: nsujir, netdev@vger.kernel.org, dborkman, shangw, Michael Chan
In-Reply-To: <20130815.010726.719593168454341579.davem@davemloft.net>
On Thu, Aug 15, 2013 at 11:07 AM, David Miller <davem@davemloft.net> wrote:
>
> From: "Nithin Nayak Sujir" <nsujir@broadcom.com>
> Date: Tue, 13 Aug 2013 11:45:13 -0700
>
> > From: Daniel Borkmann <dborkman@redhat.com>
> >
> > Commit d8af4dfd8 ("net/tg3: Fix kernel crash") introduced a possible
> > NULL pointer dereference in tg3 driver when !netdev || !netif_running(netdev)
> > condition is met and netdev is NULL. Then, the jump to the 'done' label
> > calls dev_close() with a netdevice that is NULL. Therefore, only call
> > dev_close() when we have a netdevice, but one that is not running.
> >
> > [ Add the same checks in tg3_io_slot_reset() per Gavin Shan - by Nithin
> > Nayak Sujir ]
> >
> > Reported-by: Dave Jones <davej@redhat.com>
> > Signed-off-by: Daniel Borkmann <dborkman@redhat.com>
> > Cc: Gavin Shan <shangw@linux.vnet.ibm.com>
> > Cc: Michael Chan <mchan@broadcom.com>
> > Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
>
> Can I get some reviews from the Broadcom folks?
>
> Thanks.
You already have:
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
^ permalink raw reply
* Re: [RFC][PATCH 2/2] bgmac: pass received packet to the netif instead of copying it
From: Rafał Miłecki @ 2013-08-15 11:36 UTC (permalink / raw)
To: Network Development, OpenWrt Development List, Hauke Mehrtens,
Florian Fainelli, Jonas Gorski, Robert Bradley
In-Reply-To: <1376243355-5740-2-git-send-email-zajec5@gmail.com>
2013/8/11 Rafał Miłecki <zajec5@gmail.com>:
> It makes more sense to allocate new (empty) skb and pass it to the
> hardware. That way we avoid copying whole packet into new skb which
> should result in better performance.
I did some testing of this patch using "perf" tool and iperf -s
running on the OpenWrt machine (with bgmac supported hardware).
There are the results:
No network usage:
64.93% [kernel] [k] arch_cpu_idle
16.10% [kernel] [k] arch_local_irq_restore
11.52% [kernel] [k] cpu_startup_entry
Running iperf on PC: iperf -c 192.168.1.1
23.57% [kernel] [k] __copy_user_common
10.57% [kernel] [k] csum_partial
8.87% [kernel] [k] arch_cpu_idle
4.74% [kernel] [k] arch_local_irq_restore
4.30% [ip_tables] [k] ipt_do_table
2.91% [nf_conntrack] [k] nf_conntrack_in
2.44% [kernel] [k] __netif_receive_skb_core
2.36% [kernel] [k] r4k_dma_cache_inv
2.33% [nf_conntrack] [k] nf_conntrack_proto_fini
With 0002-bgmac-pass-received-packet-to-the-netif-instead-of-c.patch
14.83% [kernel] [k] __copy_user_common
14.81% [kernel] [k] csum_partial
4.24% [ip_tables] [k] ipt_do_table
3.69% [kernel] [k] arch_local_irq_restore
3.54% [kernel] [k] __netif_receive_skb_core
3.38% [kernel] [k] r4k_dma_cache_inv
3.24% [nf_conntrack] [k] nf_conntrack_in
2.95% [xt_conntrack] [k] 0x0000018c
2.88% [nf_conntrack] [k] nf_conntrack_proto_fini
2.58% [iptable_nat] [k] 0x00000008
2.32% [bgmac] [k] 0x00000d9c
2.18% [nf_conntrack_ipv4] [k] need_ipv4_conntrack
So you can see that __copy_user_common usage has really decreased with
this patch!
Unfortunately it didn't result in better performance... no idea why :(
--
Rafał
^ permalink raw reply
* [PATCH net-next] net: proc_fs: trivial: print UIDs as unsigned int
From: Francesco Fusco @ 2013-08-15 11:42 UTC (permalink / raw)
To: davem; +Cc: netdev
UIDs are printed in the proc_fs as signed int, whereas
they are unsigned int.
Signed-off-by: Francesco Fusco <ffusco@redhat.com>
---
net/appletalk/atalk_proc.c | 2 +-
net/ipv4/ping.c | 2 +-
net/ipv4/raw.c | 2 +-
net/ipv4/tcp_ipv4.c | 4 ++--
net/ipv4/udp.c | 2 +-
net/ipv6/datagram.c | 2 +-
net/ipv6/tcp_ipv6.c | 4 ++--
net/ipx/ipx_proc.c | 2 +-
net/llc/llc_proc.c | 2 +-
net/phonet/socket.c | 2 +-
net/sctp/proc.c | 4 ++--
11 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/net/appletalk/atalk_proc.c b/net/appletalk/atalk_proc.c
index c30f3a0..af46bc4 100644
--- a/net/appletalk/atalk_proc.c
+++ b/net/appletalk/atalk_proc.c
@@ -178,7 +178,7 @@ static int atalk_seq_socket_show(struct seq_file *seq, void *v)
at = at_sk(s);
seq_printf(seq, "%02X %04X:%02X:%02X %04X:%02X:%02X %08X:%08X "
- "%02X %d\n",
+ "%02X %u\n",
s->sk_type, ntohs(at->src_net), at->src_node, at->src_port,
ntohs(at->dest_net), at->dest_node, at->dest_port,
sk_wmem_alloc_get(s),
diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c
index 746427c..d7d9882 100644
--- a/net/ipv4/ping.c
+++ b/net/ipv4/ping.c
@@ -1082,7 +1082,7 @@ static void ping_v4_format_sock(struct sock *sp, struct seq_file *f,
__u16 srcp = ntohs(inet->inet_sport);
seq_printf(f, "%5d: %08X:%04X %08X:%04X"
- " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %pK %d%n",
+ " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d%n",
bucket, src, srcp, dest, destp, sp->sk_state,
sk_wmem_alloc_get(sp),
sk_rmem_alloc_get(sp),
diff --git a/net/ipv4/raw.c b/net/ipv4/raw.c
index dd44e0a..41d8450 100644
--- a/net/ipv4/raw.c
+++ b/net/ipv4/raw.c
@@ -987,7 +987,7 @@ static void raw_sock_seq_show(struct seq_file *seq, struct sock *sp, int i)
srcp = inet->inet_num;
seq_printf(seq, "%4d: %08X:%04X %08X:%04X"
- " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %pK %d\n",
+ " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d\n",
i, src, srcp, dest, destp, sp->sk_state,
sk_wmem_alloc_get(sp),
sk_rmem_alloc_get(sp),
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index ec27028..05a3d45 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2608,7 +2608,7 @@ static void get_openreq4(const struct sock *sk, const struct request_sock *req,
long delta = req->expires - jiffies;
seq_printf(f, "%4d: %08X:%04X %08X:%04X"
- " %02X %08X:%08X %02X:%08lX %08X %5d %8d %u %d %pK%n",
+ " %02X %08X:%08X %02X:%08lX %08X %5u %8d %u %d %pK%n",
i,
ireq->loc_addr,
ntohs(inet_sk(sk)->inet_sport),
@@ -2666,7 +2666,7 @@ static void get_tcp4_sock(struct sock *sk, struct seq_file *f, int i, int *len)
rx_queue = max_t(int, tp->rcv_nxt - tp->copied_seq, 0);
seq_printf(f, "%4d: %08X:%04X %08X:%04X %02X %08X:%08X %02X:%08lX "
- "%08X %5d %8d %lu %d %pK %lu %lu %u %u %d%n",
+ "%08X %5u %8d %lu %d %pK %lu %lu %u %u %d%n",
i, src, srcp, dest, destp, sk->sk_state,
tp->write_seq - tp->snd_una,
rx_queue,
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 9e88af0..0b24508 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2159,7 +2159,7 @@ static void udp4_format_sock(struct sock *sp, struct seq_file *f,
__u16 srcp = ntohs(inet->inet_sport);
seq_printf(f, "%5d: %08X:%04X %08X:%04X"
- " %02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %pK %d%n",
+ " %02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d%n",
bucket, src, srcp, dest, destp, sp->sk_state,
sk_wmem_alloc_get(sp),
sk_rmem_alloc_get(sp),
diff --git a/net/ipv6/datagram.c b/net/ipv6/datagram.c
index 197e6f4..48b6bd2 100644
--- a/net/ipv6/datagram.c
+++ b/net/ipv6/datagram.c
@@ -890,7 +890,7 @@ void ip6_dgram_sock_seq_show(struct seq_file *seq, struct sock *sp,
src = &np->rcv_saddr;
seq_printf(seq,
"%5d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
- "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %pK %d\n",
+ "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %d\n",
bucket,
src->s6_addr32[0], src->s6_addr32[1],
src->s6_addr32[2], src->s6_addr32[3], srcp,
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index 38c196c..5bcfadf 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1731,7 +1731,7 @@ static void get_openreq6(struct seq_file *seq,
seq_printf(seq,
"%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
- "%02X %08X:%08X %02X:%08lX %08X %5d %8d %d %d %pK\n",
+ "%02X %08X:%08X %02X:%08lX %08X %5u %8d %d %d %pK\n",
i,
src->s6_addr32[0], src->s6_addr32[1],
src->s6_addr32[2], src->s6_addr32[3],
@@ -1782,7 +1782,7 @@ static void get_tcp6_sock(struct seq_file *seq, struct sock *sp, int i)
seq_printf(seq,
"%4d: %08X%08X%08X%08X:%04X %08X%08X%08X%08X:%04X "
- "%02X %08X:%08X %02X:%08lX %08X %5d %8d %lu %d %pK %lu %lu %u %u %d\n",
+ "%02X %08X:%08X %02X:%08lX %08X %5u %8d %lu %d %pK %lu %lu %u %u %d\n",
i,
src->s6_addr32[0], src->s6_addr32[1],
src->s6_addr32[2], src->s6_addr32[3], srcp,
diff --git a/net/ipx/ipx_proc.c b/net/ipx/ipx_proc.c
index 65e8833..e15c16a 100644
--- a/net/ipx/ipx_proc.c
+++ b/net/ipx/ipx_proc.c
@@ -213,7 +213,7 @@ static int ipx_seq_socket_show(struct seq_file *seq, void *v)
ntohs(ipxs->dest_addr.sock));
}
- seq_printf(seq, "%08X %08X %02X %03d\n",
+ seq_printf(seq, "%08X %08X %02X %03u\n",
sk_wmem_alloc_get(s),
sk_rmem_alloc_get(s),
s->sk_state,
diff --git a/net/llc/llc_proc.c b/net/llc/llc_proc.c
index 7b4799c..1a3c7e0 100644
--- a/net/llc/llc_proc.c
+++ b/net/llc/llc_proc.c
@@ -147,7 +147,7 @@ static int llc_seq_socket_show(struct seq_file *seq, void *v)
}
seq_printf(seq, "@%02X ", llc->sap->laddr.lsap);
llc_ui_format_mac(seq, llc->daddr.mac);
- seq_printf(seq, "@%02X %8d %8d %2d %3d %4d\n", llc->daddr.lsap,
+ seq_printf(seq, "@%02X %8d %8d %2d %3u %4d\n", llc->daddr.lsap,
sk_wmem_alloc_get(sk),
sk_rmem_alloc_get(sk) - llc->copied_seq,
sk->sk_state,
diff --git a/net/phonet/socket.c b/net/phonet/socket.c
index 1afd138..77e38f7 100644
--- a/net/phonet/socket.c
+++ b/net/phonet/socket.c
@@ -793,7 +793,7 @@ static int pn_res_seq_show(struct seq_file *seq, void *v)
struct sock **psk = v;
struct sock *sk = *psk;
- seq_printf(seq, "%02X %5d %lu%n",
+ seq_printf(seq, "%02X %5u %lu%n",
(int) (psk - pnres.sk),
from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)),
sock_i_ino(sk), &len);
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index 82432bf..0c06421 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -226,7 +226,7 @@ static int sctp_eps_seq_show(struct seq_file *seq, void *v)
sk = epb->sk;
if (!net_eq(sock_net(sk), seq_file_net(seq)))
continue;
- seq_printf(seq, "%8pK %8pK %-3d %-3d %-4d %-5d %5d %5lu ", ep, sk,
+ seq_printf(seq, "%8pK %8pK %-3d %-3d %-4d %-5d %5u %5lu ", ep, sk,
sctp_sk(sk)->type, sk->sk_state, hash,
epb->bind_addr.port,
from_kuid_munged(seq_user_ns(seq), sock_i_uid(sk)),
@@ -336,7 +336,7 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
continue;
seq_printf(seq,
"%8pK %8pK %-3d %-3d %-2d %-4d "
- "%4d %8d %8d %7d %5lu %-5d %5d ",
+ "%4d %8d %8d %7u %5lu %-5d %5d ",
assoc, sk, sctp_sk(sk)->type, sk->sk_state,
assoc->state, hash,
assoc->assoc_id,
--
1.8.3.1
^ permalink raw reply related
* Re: [RFC][PATCH 2/2] bgmac: pass received packet to the netif instead of copying it
From: Felix Fietkau @ 2013-08-15 11:47 UTC (permalink / raw)
To: OpenWrt Development List
Cc: Network Development, Jonas Gorski, Hauke Mehrtens
In-Reply-To: <CACna6rwtLw-Aiz3amMvTBwWsi0OWo5f2yMCF9e8DeCjKLOGDEA@mail.gmail.com>
On 2013-08-15 1:36 PM, Rafał Miłecki wrote:
> 2013/8/11 Rafał Miłecki <zajec5@gmail.com>:
>> It makes more sense to allocate new (empty) skb and pass it to the
>> hardware. That way we avoid copying whole packet into new skb which
>> should result in better performance.
>
> I did some testing of this patch using "perf" tool and iperf -s
> running on the OpenWrt machine (with bgmac supported hardware).
>
> So you can see that __copy_user_common usage has really decreased with
> this patch!
>
> Unfortunately it didn't result in better performance... no idea why :(
Running iperf on the router is not useful as an indicator of routing
performance. Please focus on tests where you only push traffic through
the router, not directly to it.
- Felix
_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel
^ permalink raw reply
* Re: [PATCH net-next v2 1/3] net/usb/r8152: support aggregation
From: Francois Romieu @ 2013-08-15 12:26 UTC (permalink / raw)
To: Hayes Wang; +Cc: netdev, nic_swsd, linux-kernel, linux-usb, David Miller
In-Reply-To: <1376484880-741-1-git-send-email-hayeswang@realtek.com>
Hayes Wang <hayeswang@realtek.com> :
[...]
> diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
> index 11c51f2..abb0b9f 100644
> --- a/drivers/net/usb/r8152.c
> +++ b/drivers/net/usb/r8152.c
[...]
> @@ -315,13 +318,34 @@ struct tx_desc {
> u32 opts2;
> };
>
> +struct rx_agg {
> + struct list_head list;
> + struct urb *urb;
> + void *context;
void * is not needed: context is always struct r8152 *.
> + void *buffer;
> + void *head;
> +};
> +
> +struct tx_agg {
> + struct list_head list;
> + struct urb *urb;
> + void *context;
void * is not needed: context is always struct r8152 *.
> + void *buffer;
> + void *head;
> + u32 skb_num;
> + u32 skb_len;
> +};
> +
> struct r8152 {
> unsigned long flags;
> struct usb_device *udev;
> struct tasklet_struct tl;
> struct net_device *netdev;
> - struct urb *rx_urb, *tx_urb;
> - struct sk_buff *tx_skb, *rx_skb;
> + struct tx_agg tx_info[RTL8152_MAX_TX];
> + struct rx_agg rx_info[RTL8152_MAX_RX];
> + struct list_head rx_done, tx_free;
> + struct sk_buff_head tx_queue;
> + spinlock_t rx_lock, tx_lock;
You may group rx data on one side and tx data on an other side to be
more cache friendly.
[...]
> @@ -686,6 +711,9 @@ static void ocp_reg_write(struct r8152 *tp, u16 addr, u16 data)
> ocp_write_word(tp, MCU_TYPE_PLA, ocp_index, data);
> }
>
> +static
> +int r8152_submit_rx(struct r8152 *tp, struct rx_agg *agg, gfp_t mem_flags);
> +
It's a new, less than 10 lines function without driver internal dependencies.
The forward declaration is not needed.
[...]
> @@ -743,129 +751,425 @@ static struct net_device_stats *rtl8152_get_stats(struct net_device *dev)
>
> static void read_bulk_callback(struct urb *urb)
No rtl8152_ prefix ?
> {
[...]
> - if (!netif_device_present(netdev))
> + if (!netif_carrier_ok(netdev))
> return;
How is it related to the subject of the patch ?
[...]
> +static void rx_bottom(struct r8152 *tp)
> +{
> + struct net_device_stats *stats;
> + struct net_device *netdev;
> + struct rx_agg *agg;
> + struct rx_desc *rx_desc;
> + unsigned long lockflags;
Idiom: 'flags'.
> + struct list_head *cursor, *next;
> + struct sk_buff *skb;
> + struct urb *urb;
> + unsigned pkt_len;
> + int len_used;
> + u8 *rx_data;
> + int ret;
The scope of these variables is needlessly wide.
> +
> + netdev = tp->netdev;
> +
> + stats = rtl8152_get_stats(netdev);
> +
> + spin_lock_irqsave(&tp->rx_lock, lockflags);
> + list_for_each_safe(cursor, next, &tp->rx_done) {
> + list_del_init(cursor);
> + spin_unlock_irqrestore(&tp->rx_lock, lockflags);
> +
> + agg = list_entry(cursor, struct rx_agg, list);
> + urb = agg->urb;
> + if (urb->actual_length < ETH_ZLEN) {
goto submit;
> + ret = r8152_submit_rx(tp, agg, GFP_ATOMIC);
> + spin_lock_irqsave(&tp->rx_lock, lockflags);
> + if (ret && ret != -ENODEV) {
> + list_add_tail(&agg->list, next);
> + tasklet_schedule(&tp->tl);
> + }
> + continue;
> + }
(remove the line above)
[...]
> + rx_data = rx_agg_align(rx_data + pkt_len + 4);
> + rx_desc = (struct rx_desc *)rx_data;
> + pkt_len = le32_to_cpu(rx_desc->opts1) & RX_LEN_MASK;
> + len_used = (int)(rx_data - (u8 *)agg->head);
> + len_used += sizeof(struct rx_desc) + pkt_len;
> + }
> +
submit:
> + ret = r8152_submit_rx(tp, agg, GFP_ATOMIC);
> + spin_lock_irqsave(&tp->rx_lock, lockflags);
> + if (ret && ret != -ENODEV) {
> + list_add_tail(&agg->list, next);
> + tasklet_schedule(&tp->tl);
> + }
> + }
> + spin_unlock_irqrestore(&tp->rx_lock, lockflags);
> +}
It should be possible to retrieve more items in the spinlocked section
so as to have a chance to batch more work. I have not thought too deeply
about it.
> +
> +static void tx_bottom(struct r8152 *tp)
> +{
> + struct net_device_stats *stats;
> + struct net_device *netdev;
> + struct tx_agg *agg;
> + unsigned long lockflags;
> + u32 remain, total;
> + u8 *tx_data;
> + int res;
> +
> + netdev = tp->netdev;
> +
> +next_agg:
Use a real for / while loop and split this function as you experience
line length problem.
[...]
> +static void bottom_half(unsigned long data)
> {
> struct r8152 *tp;
> - int status = urb->status;
>
> - tp = urb->context;
> - if (!tp)
> + tp = (struct r8152 *)data;
struct r8152 *tp = (struct r8152 *)data;
[...]
> - if (!netif_device_present(tp->netdev))
> +
> + if (!netif_carrier_ok(tp->netdev))
> return;
It deserves an explanation.
[...]
> @@ -923,33 +1227,44 @@ static netdev_tx_t rtl8152_start_xmit(struct sk_buff *skb,
> {
[...]
> + spin_lock_irqsave(&tp->tx_lock, lockflags);
> + if (!list_empty(&tp->tx_free) && skb_queue_empty(&tp->tx_queue)) {
> + struct list_head *cursor;
> +
> + cursor = tp->tx_free.next;
> + list_del_init(cursor);
> + agg = list_entry(cursor, struct tx_agg, list);
Duplicated in tx_bottom.
[...]
> @@ -999,17 +1313,18 @@ static inline u8 rtl8152_get_speed(struct r8152 *tp)
>
> static int rtl8152_enable(struct r8152 *tp)
> {
> - u32 ocp_data;
> + u32 ocp_data;
> + int i, ret;
> u8 speed;
>
> speed = rtl8152_get_speed(tp);
> - if (speed & _100bps) {
> + if (speed & _10bps) {
> ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR);
> - ocp_data &= ~EEEP_CR_EEEP_TX;
> + ocp_data |= EEEP_CR_EEEP_TX;
> ocp_write_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR, ocp_data);
> } else {
> ocp_data = ocp_read_word(tp, MCU_TYPE_PLA, PLA_EEEP_CR);
> - ocp_data |= EEEP_CR_EEEP_TX;
> + ocp_data &= ~EEEP_CR_EEEP_TX;
Call me "Mickey Mouse" if this is related to the subject of the patch.
[...]
> @@ -1631,10 +1965,12 @@ static int rtl8152_probe(struct usb_interface *intf,
> return -ENOMEM;
> }
>
> + SET_NETDEV_DEV(netdev, &intf->dev);
> tp = netdev_priv(netdev);
> + memset(tp, 0, sizeof(*tp));
Useless, see kzalloc in net/core/dev.c::alloc_netdev_mqs
--
Ueimor
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox