* Re: [PATCH] tcp: sysctl to disable TCP simultaneous connect
From: Eric W. Biederman @ 2013-02-15 7:10 UTC (permalink / raw)
To: Kees Cook
Cc: Stephen Hemminger, LKML, Rob Landley, David S. Miller,
Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
Patrick McHardy, Eric Dumazet, Neil Horman, Yuchung Cheng,
Shan Wei, linux-doc@vger.kernel.org, netdev, Willy Tarreau
In-Reply-To: <CAGXu5jJKQSDo61TD0Jgn9Gq8TL2rCUVbA=Kq4AvfeFUb2FdJMw@mail.gmail.com>
Kees Cook <keescook@chromium.org> writes:
> On Thu, Feb 14, 2013 at 9:30 PM, Eric W. Biederman
> <ebiederm@xmission.com> wrote:
>> Kees Cook <keescook@chromium.org> writes:
>>
>>> The patch would not break it -- it defaults the sysctl to staying enabled.
>>>
>>> If you mean the documentation should be updated, sure, that's easy to do.
>>>
>>> David: I know you aren't a fan of this patch, but I'd like to try to
>>> convince you. :) This leaves the feature enabled and add a toggle for
>>> systems (like Chrome OS) that don't want to risk this DoS at all.
>>> There are so very many other toggle, I don't see why this one would be
>>> a problem to add.
>>
>> Chrome OS has no plans to implement webrtc? Last I had read that
>> support had been added to the release versions of Chrome, and was in the
>> development builds of firefox. I really don't belive that there are
>> many systems that don't intend to run a web browser.
>
> I haven't looked at the internals of webrtc. Are you implying some
> feature in it relies on the TCP simultaneous connect?
I am saying that yes.
webrtc is built on ICE (interactivity connectivity establishment). ICE
support for TCP (RFC6544) uses TCP simultaneous connect. webrtc
supports tcp connections.
Eric
^ permalink raw reply
* Re: tuntap: Overload handling
From: Sebastian Pöhn @ 2013-02-15 7:04 UTC (permalink / raw)
To: Eric Dumazet; +Cc: Michael S. Tsirkin, netdev
In-Reply-To: <1360861290.6884.55.camel@edumazet-glaptop>
Ok, thanks. So if you think of tuntap as a virtual device (and that's
what it is) then the drop behavior is quite a valid way.
So I'll gonna try to use the "old" version with qdisc support and
extend it be the features I need.
On Thu, Feb 14, 2013 at 6:01 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2013-02-14 at 18:42 +0200, Michael S. Tsirkin wrote:
>
>> Hmm so ~1000 packets in the tun queue is not enough?
>> You always have the option to increase it some more ...
>>
>> > You should ask Michael S. Tsirkin, as he removed the flow control
>> > in commit 5d097109257c03a71845729f8db6b5770c4bbedc
>> > (tun: only queue packets on device)
>> >
>>
>> Eric in the past you said the following things
>> (http://lkml.indiana.edu/hypermail/linux/kernel/1204.1/00784.html)
>> > > In your case I would just not use qdisc at all, like other virtual
>> > > devices.
>> ...
>> > > Anyway, with a 500 packet limit in TUN queue itself, qdisc layer should
>> > > be always empty. Whats the point storing more than 500 packets for a
>> > > device ? Thats a latency killer.
>> you don't think this applies, anymore?
>>
>
> Users have the choice to setup a qdisc or not.
>
> Having no qdisc can help raw performance, at the expense of bufferbloat.
> Thats all I was saying.
>
> It seems tun.c has no longer the possibility to effectively use a qdisc,
> (allowing the queue to buildup at qdisc layer)
>
>
>
^ permalink raw reply
* linux-next: manual merge of the akpm tree with the net-next tree
From: Stephen Rothwell @ 2013-02-15 6:56 UTC (permalink / raw)
To: Andrew Morton
Cc: linux-next, linux-kernel, Sasha Levin, Vlad Yasevich,
David Miller, netdev
[-- Attachment #1: Type: text/plain, Size: 2462 bytes --]
Hi Andrew,
Today's linux-next merge of the akpm tree got a conflict in
net/bridge/br_fdb.c between commit 2ba071ecb6d4 ("bridge: Add vlan to
unicast fdb entries") from the net-next tree and commit "hlist: drop the
node parameter from iterators" from the akpm tree.
I fixed it up (see below) and can carry the fix as necessary (no action
is required).
--
Cheers,
Stephen Rothwell sfr@canb.auug.org.au
diff --cc net/bridge/br_fdb.c
index 8117900,4fb0461..0000000
--- a/net/bridge/br_fdb.c
+++ b/net/bridge/br_fdb.c
@@@ -263,16 -231,12 +263,15 @@@ void br_fdb_delete_by_port(struct net_b
/* No locking or refcounting, assumes caller has rcu_read_lock */
struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
- const unsigned char *addr)
+ const unsigned char *addr,
+ __u16 vid)
{
- struct hlist_node *h;
struct net_bridge_fdb_entry *fdb;
- hlist_for_each_entry_rcu(fdb, h,
- hlist_for_each_entry_rcu(fdb, &br->hash[br_mac_hash(addr)], hlist) {
- if (ether_addr_equal(fdb->addr.addr, addr)) {
++ hlist_for_each_entry_rcu(fdb,
+ &br->hash[br_mac_hash(addr, vid)], hlist) {
+ if (ether_addr_equal(fdb->addr.addr, addr) &&
+ fdb->vlan_id == vid) {
if (unlikely(has_expired(br, fdb)))
break;
return fdb;
@@@ -360,30 -323,24 +358,28 @@@ int br_fdb_fillbuf(struct net_bridge *b
}
static struct net_bridge_fdb_entry *fdb_find(struct hlist_head *head,
- const unsigned char *addr)
+ const unsigned char *addr,
+ __u16 vid)
{
- struct hlist_node *h;
struct net_bridge_fdb_entry *fdb;
- hlist_for_each_entry(fdb, h, head, hlist) {
+ hlist_for_each_entry(fdb, head, hlist) {
- if (ether_addr_equal(fdb->addr.addr, addr))
+ if (ether_addr_equal(fdb->addr.addr, addr) &&
+ fdb->vlan_id == vid)
return fdb;
}
return NULL;
}
static struct net_bridge_fdb_entry *fdb_find_rcu(struct hlist_head *head,
- const unsigned char *addr)
+ const unsigned char *addr,
+ __u16 vid)
{
- struct hlist_node *h;
struct net_bridge_fdb_entry *fdb;
- hlist_for_each_entry_rcu(fdb, h, head, hlist) {
+ hlist_for_each_entry_rcu(fdb, head, hlist) {
- if (ether_addr_equal(fdb->addr.addr, addr))
+ if (ether_addr_equal(fdb->addr.addr, addr) &&
+ fdb->vlan_id == vid)
return fdb;
}
return NULL;
[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply
* Re: [PATCH] tcp: sysctl to disable TCP simultaneous connect
From: Kees Cook @ 2013-02-15 6:41 UTC (permalink / raw)
To: Eric W. Biederman
Cc: Stephen Hemminger, LKML, Rob Landley, David S. Miller,
Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
Patrick McHardy, Eric Dumazet, Neil Horman, Yuchung Cheng,
Shan Wei, linux-doc@vger.kernel.org, netdev, Willy Tarreau
In-Reply-To: <87y5eq87pa.fsf@xmission.com>
On Thu, Feb 14, 2013 at 9:30 PM, Eric W. Biederman
<ebiederm@xmission.com> wrote:
> Kees Cook <keescook@chromium.org> writes:
>
>> The patch would not break it -- it defaults the sysctl to staying enabled.
>>
>> If you mean the documentation should be updated, sure, that's easy to do.
>>
>> David: I know you aren't a fan of this patch, but I'd like to try to
>> convince you. :) This leaves the feature enabled and add a toggle for
>> systems (like Chrome OS) that don't want to risk this DoS at all.
>> There are so very many other toggle, I don't see why this one would be
>> a problem to add.
>
> Chrome OS has no plans to implement webrtc? Last I had read that
> support had been added to the release versions of Chrome, and was in the
> development builds of firefox. I really don't belive that there are
> many systems that don't intend to run a web browser.
I haven't looked at the internals of webrtc. Are you implying some
feature in it relies on the TCP simultaneous connect?
-Kees
--
Kees Cook
Chrome OS Security
^ permalink raw reply
* Re: [PATCH] ipv4: Disallow non-namespace aware protocols to register.
From: Eric W. Biederman @ 2013-02-15 6:25 UTC (permalink / raw)
To: David Miller; +Cc: netdev
In-Reply-To: <20130205.144302.2065386693901345213.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
> All in-tree ipv4 protocol implementations are now namespace
> aware. Therefore all the run-time checks are superfluous.
>
> Reject registry of any non-namespace aware ipv4 protocol.
> Eventually we'll remove prot->netns_ok and this registry
> time check as well.
It has been a long time coming but this is very cool to see we have
finally made all of ipv4 network namespace aware.
Eric
^ permalink raw reply
* Re: [PATCH] tcp: sysctl to disable TCP simultaneous connect
From: Eric W. Biederman @ 2013-02-15 5:30 UTC (permalink / raw)
To: Kees Cook
Cc: Stephen Hemminger, LKML, Rob Landley, David S. Miller,
Alexey Kuznetsov, James Morris, Hideaki YOSHIFUJI,
Patrick McHardy, Eric Dumazet, Neil Horman, Yuchung Cheng,
Shan Wei, linux-doc@vger.kernel.org, netdev, Willy Tarreau
In-Reply-To: <CAGXu5jJiupzommJYPEYQnk-4i9FUKai0NcPnihLN-QpWV64jtQ@mail.gmail.com>
Kees Cook <keescook@chromium.org> writes:
> The patch would not break it -- it defaults the sysctl to staying enabled.
>
> If you mean the documentation should be updated, sure, that's easy to do.
>
> David: I know you aren't a fan of this patch, but I'd like to try to
> convince you. :) This leaves the feature enabled and add a toggle for
> systems (like Chrome OS) that don't want to risk this DoS at all.
> There are so very many other toggle, I don't see why this one would be
> a problem to add.
Chrome OS has no plans to implement webrtc? Last I had read that
support had been added to the release versions of Chrome, and was in the
development builds of firefox. I really don't belive that there are
many systems that don't intend to run a web browser.
Eric
^ permalink raw reply
* Re: [PATCH v2 1/1] eventfd: implementation of EFD_MASK flag
From: Andrew Morton @ 2013-02-15 5:24 UTC (permalink / raw)
To: Martin Sustrik
Cc: Alexander Viro, Sha Zhengju, linux-fsdevel, linux-kernel, netdev,
Michael Kerrisk, Davide Libenzi, Andy Lutomirski, Eric Wong
In-Reply-To: <511DAEA3.4080201@250bpm.com>
On Fri, 15 Feb 2013 04:42:27 +0100 Martin Sustrik <sustrik@250bpm.com> wrote:
> > This is a non-back-compatible userspace interface change. A procfs
> > file which previously displayed
> >
> > eventfd-count: nnnn
> >
> > can now also display
> >
> > eventfd-mask: nnnn
> >
> > So existing userspace could misbehave.
> >
> > Please fully describe the proposed interface change in the changelog.
> > That description should include the full pathname of the procfs file
> > and example before-and-after output and a discussion of whether and why
> > the risk to existing userspace is acceptable.
>
> I am not sure what the policy is here. Is not printing out the state of
> the object acceptable way to maintain backward compatibility? If not so,
> does new type of object require new procfs file, which, AFAIU, is the
> only way to retain full backward compatibility?
Adding a new file is the only way I can think of to preserve the API.
But from Andy's comment is sounds like we don't have to worry a lot
about back-compatibility.
^ permalink raw reply
* Re: [PATCH vringh 2/2] caif_virtio: Introduce caif over virtio
From: Rusty Russell @ 2013-02-15 4:35 UTC (permalink / raw)
To: Sjur Brændeland
Cc: Vikram ARV, Dmitry TARNYAGIN, netdev@vger.kernel.org,
Linus Walleij, Ido Yariv, linux-kernel@vger.kernel.org,
Erwan YVIN, virtualization@lists.linux-foundation.org,
David S. Miller
In-Reply-To: <CAJK669YQ+x5zXSZA1FQHkRrcCt+SgZP-M_ea-Ey8ziGLhq9cqQ@mail.gmail.com>
Sjur Brændeland <sjurbren@gmail.com> writes:
> How about supporting struct vringh_kiov and struct kvec as well?
> I currently get the following complaints with my V2 patch-set:
>
> drivers/net/caif/caif_virtio.c:486:2: warning: passing argument 1 of
> ‘vringh_iov_init’ from incompatible pointer type [enabled by default]
vringh_kiov_init()? Did I miss something else?
Cheers,
Rusty.
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization
^ permalink raw reply
* [PATCH net-next 3/3] v4 GRE: Add TCP segmentation offload for GRE
From: Pravin B Shelar @ 2013-02-15 0:02 UTC (permalink / raw)
To: netdev; +Cc: edumazet, jesse, bhutchings, mirqus, Pravin B Shelar
Following patch adds GRE protocol offload handler so that
skb_gso_segment() can segment GRE packets.
SKB GSO CB is added to keep track of total header length so that
skb_segment can push entire header. e.g. in case of GRE, skb_segment
need to push inner and outer headers to every segment.
New NETIF_F_GRE_GSO feature is added for devices which support HW
GRE TSO offload. Currently none of devices support it therefore GRE GSO
always fall backs to software GSO.
Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
---
Fixed according to comments from Jesse, Eric and Michał.
v3-v4:
- Remove ipv4-id selection.
- update error counter.
- simplified features.
v2-v3:
- Use device features to segment inner packet.
- Moved skb_mac_gso_segment to separate patch.
- simplified gre_gso_segment().
- Added NETIF_F_GRE_GSO feature.
v1-v2:
- Factored a MAC layer handler out of skb_gso_segment().
- Eliminated copy operation from gre_gso_segment().
- Refresh header pointer after pskb_may_pull().
---
include/linux/netdev_features.h | 3 +-
include/linux/skbuff.h | 17 ++++++
net/core/dev.c | 1 +
net/core/ethtool.c | 1 +
net/core/skbuff.c | 6 ++-
net/ipv4/af_inet.c | 1 +
net/ipv4/gre.c | 118 +++++++++++++++++++++++++++++++++++++++
net/ipv4/ip_gre.c | 81 ++++++++++++++++++++++++--
net/ipv4/tcp.c | 1 +
net/ipv4/udp.c | 3 +-
net/ipv6/ip6_offload.c | 1 +
net/ipv6/udp_offload.c | 3 +-
12 files changed, 225 insertions(+), 11 deletions(-)
diff --git a/include/linux/netdev_features.h b/include/linux/netdev_features.h
index 5ac3212..3dd3934 100644
--- a/include/linux/netdev_features.h
+++ b/include/linux/netdev_features.h
@@ -41,7 +41,7 @@ enum {
NETIF_F_TSO_ECN_BIT, /* ... TCP ECN support */
NETIF_F_TSO6_BIT, /* ... TCPv6 segmentation */
NETIF_F_FSO_BIT, /* ... FCoE segmentation */
- NETIF_F_GSO_RESERVED1, /* ... free (fill GSO_MASK to 8 bits) */
+ NETIF_F_GSO_GRE_BIT, /* ... GRE with TSO */
/**/NETIF_F_GSO_LAST, /* [can't be last bit, see GSO_MASK] */
NETIF_F_GSO_RESERVED2 /* ... free (fill GSO_MASK to 8 bits) */
= NETIF_F_GSO_LAST,
@@ -102,6 +102,7 @@ enum {
#define NETIF_F_VLAN_CHALLENGED __NETIF_F(VLAN_CHALLENGED)
#define NETIF_F_RXFCS __NETIF_F(RXFCS)
#define NETIF_F_RXALL __NETIF_F(RXALL)
+#define NETIF_F_GRE_GSO __NETIF_F(GSO_GRE)
/* Features valid for ethtool to change */
/* = all defined minus driver/device-class-related */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ca6ee7d..821c7f4 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -314,6 +314,8 @@ enum {
SKB_GSO_TCPV6 = 1 << 4,
SKB_GSO_FCOE = 1 << 5,
+
+ SKB_GSO_GRE = 1 << 6,
};
#if BITS_PER_LONG > 32
@@ -2732,6 +2734,21 @@ static inline struct sec_path *skb_sec_path(struct sk_buff *skb)
}
#endif
+/* Keeps track of mac header offset relative to skb->head.
+ * It is useful for TSO of Tunneling protocol. e.g. GRE.
+ * For non-tunnel skb it points to skb_mac_header() and for
+ * tunnel skb it points to outer mac header. */
+struct skb_gso_cb {
+ int mac_offset;
+};
+#define SKB_GSO_CB(skb) ((struct skb_gso_cb *)(skb)->cb)
+
+static inline int skb_tnl_header_len(const struct sk_buff *inner_skb)
+{
+ return (skb_mac_header(inner_skb) - inner_skb->head) -
+ SKB_GSO_CB(inner_skb)->mac_offset;
+}
+
static inline bool skb_is_gso(const struct sk_buff *skb)
{
return skb_shinfo(skb)->gso_size;
diff --git a/net/core/dev.c b/net/core/dev.c
index 5425e41..4cf2be8 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -2413,6 +2413,7 @@ struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
return ERR_PTR(err);
}
+ SKB_GSO_CB(skb)->mac_offset = skb_headroom(skb);
skb_reset_mac_header(skb);
skb->mac_len = skb->network_header - skb->mac_header;
diff --git a/net/core/ethtool.c b/net/core/ethtool.c
index d9d5520..3e9b2c3 100644
--- a/net/core/ethtool.c
+++ b/net/core/ethtool.c
@@ -77,6 +77,7 @@ static const char netdev_features_strings[NETDEV_FEATURE_COUNT][ETH_GSTRING_LEN]
[NETIF_F_TSO_ECN_BIT] = "tx-tcp-ecn-segmentation",
[NETIF_F_TSO6_BIT] = "tx-tcp6-segmentation",
[NETIF_F_FSO_BIT] = "tx-fcoe-segmentation",
+ [NETIF_F_GSO_GRE_BIT] = "tx-gre-segmentation",
[NETIF_F_FCOE_CRC_BIT] = "tx-checksum-fcoe-crc",
[NETIF_F_SCTP_CSUM_BIT] = "tx-checksum-sctp",
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 6c1ad09..2a3ca33 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -2738,6 +2738,7 @@ struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features)
unsigned int mss = skb_shinfo(skb)->gso_size;
unsigned int doffset = skb->data - skb_mac_header(skb);
unsigned int offset = doffset;
+ unsigned int tnl_hlen = skb_tnl_header_len(skb);
unsigned int headroom;
unsigned int len;
int sg = !!(features & NETIF_F_SG);
@@ -2814,7 +2815,10 @@ struct sk_buff *skb_segment(struct sk_buff *skb, netdev_features_t features)
skb_set_network_header(nskb, skb->mac_len);
nskb->transport_header = (nskb->network_header +
skb_network_header_len(skb));
- skb_copy_from_linear_data(skb, nskb->data, doffset);
+
+ skb_copy_from_linear_data_offset(skb, -tnl_hlen,
+ nskb->data - tnl_hlen,
+ doffset + tnl_hlen);
if (fskb != skb_shinfo(skb)->frag_list)
continue;
diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index e6e5d85..e225a4e 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -1287,6 +1287,7 @@ static struct sk_buff *inet_gso_segment(struct sk_buff *skb,
SKB_GSO_UDP |
SKB_GSO_DODGY |
SKB_GSO_TCP_ECN |
+ SKB_GSO_GRE |
0)))
goto out;
diff --git a/net/ipv4/gre.c b/net/ipv4/gre.c
index 42a4910..7a4c710 100644
--- a/net/ipv4/gre.c
+++ b/net/ipv4/gre.c
@@ -19,6 +19,7 @@
#include <linux/in.h>
#include <linux/ip.h>
#include <linux/netdevice.h>
+#include <linux/if_tunnel.h>
#include <linux/spinlock.h>
#include <net/protocol.h>
#include <net/gre.h>
@@ -26,6 +27,11 @@
static const struct gre_protocol __rcu *gre_proto[GREPROTO_MAX] __read_mostly;
static DEFINE_SPINLOCK(gre_proto_lock);
+struct gre_base_hdr {
+ __be16 flags;
+ __be16 protocol;
+};
+#define GRE_HEADER_SECTION 4
int gre_add_protocol(const struct gre_protocol *proto, u8 version)
{
@@ -112,12 +118,117 @@ static void gre_err(struct sk_buff *skb, u32 info)
rcu_read_unlock();
}
+static struct sk_buff *gre_gso_segment(struct sk_buff *skb,
+ netdev_features_t features)
+{
+ struct sk_buff *segs = ERR_PTR(-EINVAL);
+ netdev_features_t enc_features;
+ int ghl = GRE_HEADER_SECTION;
+ struct gre_base_hdr *greh;
+ int mac_len = skb->mac_len;
+ int tnl_hlen;
+ bool csum;
+
+ if (unlikely(skb_shinfo(skb)->gso_type &
+ ~(SKB_GSO_TCPV4 |
+ SKB_GSO_TCPV6 |
+ SKB_GSO_UDP |
+ SKB_GSO_DODGY |
+ SKB_GSO_TCP_ECN |
+ SKB_GSO_GRE)))
+ goto out;
+
+ if (unlikely(!pskb_may_pull(skb, sizeof(*greh))))
+ goto out;
+
+ greh = (struct gre_base_hdr *)skb_transport_header(skb);
+
+ if (greh->flags & GRE_KEY)
+ ghl += GRE_HEADER_SECTION;
+ if (greh->flags & GRE_SEQ)
+ ghl += GRE_HEADER_SECTION;
+ if (greh->flags & GRE_CSUM) {
+ ghl += GRE_HEADER_SECTION;
+ csum = true;
+ } else
+ csum = false;
+
+ /* setup inner skb. */
+ if (greh->protocol == htons(ETH_P_TEB)) {
+ struct ethhdr *eth = eth_hdr(skb);
+ skb->protocol = eth->h_proto;
+ } else {
+ skb->protocol = greh->protocol;
+ }
+
+ skb->encapsulation = 0;
+
+ if (unlikely(!pskb_may_pull(skb, ghl)))
+ goto out;
+ __skb_pull(skb, ghl);
+ skb_reset_mac_header(skb);
+ skb_set_network_header(skb, skb_inner_network_offset(skb));
+ skb->mac_len = skb_inner_network_offset(skb);
+
+ /* segment inner packet. */
+ enc_features = skb->dev->hw_enc_features & netif_skb_features(skb);
+ segs = skb_mac_gso_segment(skb, enc_features);
+ if (!segs || IS_ERR(segs))
+ goto out;
+
+ skb = segs;
+ tnl_hlen = skb_tnl_header_len(skb);
+ do {
+ __skb_push(skb, ghl);
+ if (csum) {
+ __be32 *pcsum;
+
+ if (skb_has_shared_frag(skb)) {
+ int err;
+
+ err = __skb_linearize(skb);
+ if (err) {
+ kfree_skb(segs);
+ segs = ERR_PTR(err);
+ goto out;
+ }
+ }
+
+ greh = (struct gre_base_hdr *)(skb->data);
+ pcsum = (__be32 *)(greh + 1);
+ *pcsum = 0;
+ *(__sum16 *)pcsum = csum_fold(skb_checksum(skb, 0, skb->len, 0));
+ }
+ __skb_push(skb, tnl_hlen - ghl);
+
+ skb_reset_mac_header(skb);
+ skb_set_network_header(skb, mac_len);
+ skb->mac_len = mac_len;
+ } while ((skb = skb->next));
+out:
+ return segs;
+}
+
+static int gre_gso_send_check(struct sk_buff *skb)
+{
+ if (!skb->encapsulation)
+ return -EINVAL;
+ return 0;
+}
+
static const struct net_protocol net_gre_protocol = {
.handler = gre_rcv,
.err_handler = gre_err,
.netns_ok = 1,
};
+static const struct net_offload gre_offload = {
+ .callbacks = {
+ .gso_send_check = gre_gso_send_check,
+ .gso_segment = gre_gso_segment,
+ },
+};
+
static int __init gre_init(void)
{
pr_info("GRE over IPv4 demultiplexor driver\n");
@@ -127,11 +238,18 @@ static int __init gre_init(void)
return -EAGAIN;
}
+ if (inet_add_offload(&gre_offload, IPPROTO_GRE)) {
+ pr_err("can't add protocol offload\n");
+ inet_del_protocol(&net_gre_protocol, IPPROTO_GRE);
+ return -EAGAIN;
+ }
+
return 0;
}
static void __exit gre_exit(void)
{
+ inet_del_offload(&gre_offload, IPPROTO_GRE);
inet_del_protocol(&net_gre_protocol, IPPROTO_GRE);
}
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
index 00a14b9..fe66977 100644
--- a/net/ipv4/ip_gre.c
+++ b/net/ipv4/ip_gre.c
@@ -735,8 +735,33 @@ drop:
return 0;
}
+static struct sk_buff *handle_offloads(struct sk_buff *skb)
+{
+ int err;
+
+ if (skb_is_gso(skb)) {
+ err = skb_unclone(skb, GFP_ATOMIC);
+ if (unlikely(err))
+ goto error;
+ skb_shinfo(skb)->gso_type |= SKB_GSO_GRE;
+ return skb;
+ } else if (skb->ip_summed == CHECKSUM_PARTIAL) {
+ err = skb_checksum_help(skb);
+ if (unlikely(err))
+ goto error;
+ }
+ skb->ip_summed = CHECKSUM_NONE;
+
+ return skb;
+
+error:
+ kfree_skb(skb);
+ return ERR_PTR(err);
+}
+
static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev)
{
+ struct pcpu_tstats *tstats = this_cpu_ptr(dev->tstats);
struct ip_tunnel *tunnel = netdev_priv(dev);
const struct iphdr *old_iph;
const struct iphdr *tiph;
@@ -751,10 +776,18 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
__be32 dst;
int mtu;
u8 ttl;
+ int err;
- if (skb->ip_summed == CHECKSUM_PARTIAL &&
- skb_checksum_help(skb))
- goto tx_error;
+ skb = handle_offloads(skb);
+ if (IS_ERR(skb)) {
+ dev->stats.tx_dropped++;
+ return NETDEV_TX_OK;
+ }
+
+ if (!skb->encapsulation) {
+ skb_reset_inner_headers(skb);
+ skb->encapsulation = 1;
+ }
old_iph = ip_hdr(skb);
@@ -855,7 +888,8 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
if (skb->protocol == htons(ETH_P_IP)) {
df |= (old_iph->frag_off&htons(IP_DF));
- if ((old_iph->frag_off&htons(IP_DF)) &&
+ if (!skb_is_gso(skb) &&
+ (old_iph->frag_off&htons(IP_DF)) &&
mtu < ntohs(old_iph->tot_len)) {
icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(mtu));
ip_rt_put(rt);
@@ -875,7 +909,9 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
}
}
- if (mtu >= IPV6_MIN_MTU && mtu < skb->len - tunnel->hlen + gre_hlen) {
+ if (!skb_is_gso(skb) &&
+ mtu >= IPV6_MIN_MTU &&
+ mtu < skb->len - tunnel->hlen + gre_hlen) {
icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
ip_rt_put(rt);
goto tx_error;
@@ -936,6 +972,7 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
iph->daddr = fl4.daddr;
iph->saddr = fl4.saddr;
iph->ttl = ttl;
+ iph->id = 0;
if (ttl == 0) {
if (skb->protocol == htons(ETH_P_IP))
@@ -964,9 +1001,19 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
*ptr = tunnel->parms.o_key;
ptr--;
}
- if (tunnel->parms.o_flags&GRE_CSUM) {
+ /* Skip GRE checksum if skb is getting offloaded. */
+ if (!(skb_shinfo(skb)->gso_type & SKB_GSO_GRE) &&
+ (tunnel->parms.o_flags&GRE_CSUM)) {
int offset = skb_transport_offset(skb);
+ if (skb_has_shared_frag(skb)) {
+ err = __skb_linearize(skb);
+ if (err) {
+ ip_rt_put(rt);
+ goto tx_error;
+ }
+ }
+
*ptr = 0;
*(__sum16 *)ptr = csum_fold(skb_checksum(skb, offset,
skb->len - offset,
@@ -974,7 +1021,19 @@ static netdev_tx_t ipgre_tunnel_xmit(struct sk_buff *skb, struct net_device *dev
}
}
- iptunnel_xmit(skb, dev);
+ nf_reset(skb);
+
+ err = ip_local_out(skb);
+ if (likely(net_xmit_eval(err) == 0)) {
+ int pkt_len = skb->len - skb_transport_offset(skb);
+ u64_stats_update_begin(&tstats->syncp);
+ tstats->tx_bytes += pkt_len;
+ tstats->tx_packets++;
+ u64_stats_update_end(&tstats->syncp);
+ } else {
+ dev->stats.tx_errors++;
+ dev->stats.tx_aborted_errors++;
+ }
return NETDEV_TX_OK;
#if IS_ENABLED(CONFIG_IPV6)
@@ -1044,6 +1103,11 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
mtu = 68;
tunnel->hlen = addend;
+ /* TCP offload with GRE SEQ is not supported. */
+ if (!(tunnel->parms.o_flags & GRE_SEQ)) {
+ dev->features |= NETIF_F_GSO_SOFTWARE;
+ dev->hw_features |= NETIF_F_GSO_SOFTWARE;
+ }
return mtu;
}
@@ -1593,6 +1657,9 @@ static void ipgre_tap_setup(struct net_device *dev)
dev->iflink = 0;
dev->features |= NETIF_F_NETNS_LOCAL;
+
+ dev->features |= GRE_FEATURES;
+ dev->hw_features |= GRE_FEATURES;
}
static int ipgre_newlink(struct net *src_net, struct net_device *dev, struct nlattr *tb[],
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 1f0bedb..7a5ba48 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3043,6 +3043,7 @@ struct sk_buff *tcp_tso_segment(struct sk_buff *skb,
SKB_GSO_DODGY |
SKB_GSO_TCP_ECN |
SKB_GSO_TCPV6 |
+ SKB_GSO_GRE |
0) ||
!(type & (SKB_GSO_TCPV4 | SKB_GSO_TCPV6))))
goto out;
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 6791aac..39a5e7a 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -2305,7 +2305,8 @@ struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
/* Packet is from an untrusted source, reset gso_segs. */
int type = skb_shinfo(skb)->gso_type;
- if (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY) ||
+ if (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY |
+ SKB_GSO_GRE) ||
!(type & (SKB_GSO_UDP))))
goto out;
diff --git a/net/ipv6/ip6_offload.c b/net/ipv6/ip6_offload.c
index f26f0da..8234c1d 100644
--- a/net/ipv6/ip6_offload.c
+++ b/net/ipv6/ip6_offload.c
@@ -99,6 +99,7 @@ static struct sk_buff *ipv6_gso_segment(struct sk_buff *skb,
~(SKB_GSO_UDP |
SKB_GSO_DODGY |
SKB_GSO_TCP_ECN |
+ SKB_GSO_GRE |
SKB_GSO_TCPV6 |
0)))
goto out;
diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c
index 0c8934a..cf05cf0 100644
--- a/net/ipv6/udp_offload.c
+++ b/net/ipv6/udp_offload.c
@@ -56,7 +56,8 @@ static struct sk_buff *udp6_ufo_fragment(struct sk_buff *skb,
/* Packet is from an untrusted source, reset gso_segs. */
int type = skb_shinfo(skb)->gso_type;
- if (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY) ||
+ if (unlikely(type & ~(SKB_GSO_UDP | SKB_GSO_DODGY |
+ SKB_GSO_GRE) ||
!(type & (SKB_GSO_UDP))))
goto out;
--
1.7.1
^ permalink raw reply related
* Re: [PATCH v2 1/1] eventfd: implementation of EFD_MASK flag
From: Martin Sustrik @ 2013-02-15 3:42 UTC (permalink / raw)
To: Andrew Morton
Cc: Alexander Viro, Sha Zhengju, linux-fsdevel, linux-kernel, netdev,
Michael Kerrisk, Davide Libenzi, Andy Lutomirski, Eric Wong
In-Reply-To: <20130214145430.04f8750c.akpm@linux-foundation.org>
Hi Andrew,
Thanks for the detailed code review! I'll have a look at all the
problems you've pointed out, however, one quick question:
>> - ret = seq_printf(m, "eventfd-count: %16llx\n",
>> - (unsigned long long)ctx->count);
>> + if (ctx->flags& EFD_MASK) {
>> + ret = seq_printf(m, "eventfd-mask: %x\n",
>> + (unsigned)ctx->mask.events);
>> + } else {
>> + ret = seq_printf(m, "eventfd-count: %16llx\n",
>> + (unsigned long long)ctx->count);
>> + }
>> spin_unlock_irq(&ctx->wqh.lock);
>
> This is a non-back-compatible userspace interface change. A procfs
> file which previously displayed
>
> eventfd-count: nnnn
>
> can now also display
>
> eventfd-mask: nnnn
>
> So existing userspace could misbehave.
>
> Please fully describe the proposed interface change in the changelog.
> That description should include the full pathname of the procfs file
> and example before-and-after output and a discussion of whether and why
> the risk to existing userspace is acceptable.
I am not sure what the policy is here. Is not printing out the state of
the object acceptable way to maintain backward compatibility? If not so,
does new type of object require new procfs file, which, AFAIU, is the
only way to retain full backward compatibility?
Martin
^ permalink raw reply
* [PATCH net-next] net: use skb_reset_mac_len() in dev_gro_receive()
From: Eric Dumazet @ 2013-02-15 3:31 UTC (permalink / raw)
To: David Miller; +Cc: netdev
From: Eric Dumazet <edumazet@google.com>
We no longer need to use mac_len, lets cleanup things.
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/core/dev.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/net/core/dev.c b/net/core/dev.c
index f444736..09df22d 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3784,7 +3784,6 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
__be16 type = skb->protocol;
struct list_head *head = &offload_base;
int same_flow;
- int mac_len;
enum gro_result ret;
if (!(skb->dev->features & NETIF_F_GRO) || netpoll_rx_on(skb))
@@ -3801,8 +3800,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
continue;
skb_set_network_header(skb, skb_gro_offset(skb));
- mac_len = skb->network_header - skb->mac_header;
- skb->mac_len = mac_len;
+ skb_reset_mac_len(skb);
NAPI_GRO_CB(skb)->same_flow = 0;
NAPI_GRO_CB(skb)->flush = 0;
NAPI_GRO_CB(skb)->free = 0;
^ permalink raw reply related
* Re: [PATCH net-next 3/3] GRE: Add TCP segmentation offload for GRE
From: Pravin Shelar @ 2013-02-15 3:31 UTC (permalink / raw)
To: Michał Mirosław; +Cc: netdev, edumazet, jesse, bhutchings
In-Reply-To: <CAHXqBFJi57WA6vJsWEBrzz_-f7_iSYA8eN+Mta9-6rx9n9bfhw@mail.gmail.com>
On Thu, Feb 14, 2013 at 6:35 PM, Michał Mirosław <mirqus@gmail.com> wrote:
> 2013/2/14 Pravin B Shelar <pshelar@nicira.com>:
>> Following patch adds GRE protocol offload handler so that
>> skb_gso_segment() can segment GRE packets.
>> SKB GSO CB is added to keep track of total header length so that
>> skb_segment can push entire header. e.g. in case of GRE, skb_segment
>> need to push inner and outer headers to every segment.
>> New NETIF_F_GRE_GSO feature is added for devices which support HW
>> GRE TSO offload. Currently none of devices support it therefore GRE GSO
>> always fall backs to software GSO.
> [...]
>> @@ -1044,6 +1102,14 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
>> mtu = 68;
>>
>> tunnel->hlen = addend;
>> + if (tunnel->parms.o_flags & GRE_SEQ) {
>> + /* TCP offload with GRE SEQ is not supported. */
>> + dev->features &= ~NETIF_F_GSO_SOFTWARE;
>> + dev->hw_features &= ~NETIF_F_GSO_SOFTWARE;
>> + } else {
>> + dev->features |= NETIF_F_GSO_SOFTWARE;
>> + dev->hw_features |= NETIF_F_GSO_SOFTWARE;
>> + }
>
> Feature clipping belongs to ndo_fix_features. Here,
> netdev_update_features() for the tunnel device should be called.
>
Actually no clipping is required. After creating tunnel device
features do not change. In short code above is setting features not
updating it. I will remove GRE_SEQ case since it is not required and
it is less confusing.
^ permalink raw reply
* Re: [PATCH net-next 3/3] GRE: Add TCP segmentation offload for GRE
From: Pravin Shelar @ 2013-02-15 3:19 UTC (permalink / raw)
To: Eric Dumazet; +Cc: netdev, edumazet, jesse, bhutchings, mirqus
In-Reply-To: <1360892389.6884.74.camel@edumazet-glaptop>
On Thu, Feb 14, 2013 at 5:39 PM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> On Thu, 2013-02-14 at 11:45 -0800, Pravin B Shelar wrote:
>> Following patch adds GRE protocol offload handler so that
>> skb_gso_segment() can segment GRE packets.
>> SKB GSO CB is added to keep track of total header length so that
>> skb_segment can push entire header. e.g. in case of GRE, skb_segment
>> need to push inner and outer headers to every segment.
>> New NETIF_F_GRE_GSO feature is added for devices which support HW
>> GRE TSO offload. Currently none of devices support it therefore GRE GSO
>> always fall backs to software GSO.
>>
>> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
>> ---
>> Fixed according to comments from Jesse and Eric.
>> v2-v3:
>> - Use device features to segment inner packet.
>> - Moved skb_mac_gso_segment to separate patch.
>> - simplified gre_gso_segment().
>> - Added NETIF_F_GRE_GSO feature.
>>
>> v1-v2:
>> - Factored a MAC layer handler out of skb_gso_segment().
>> - Eliminated copy operation from gre_gso_segment().
>> - Refresh header pointer after pskb_may_pull().
>> ---
>
> Seems very good to me, thanks !
>
> The only thing that puzzles me is the ip_select_ident() in
> ipgre_tunnel_xmit()
>
> Do we care of the IP identifiers being 0, 1, 2, 3, ... on the outer
> headers ?
>
> Without TSO, we are using 0 IP identifiers (DF being set)
>
right. I will keep id as zero for all cases.
> Also if we can't unclone the skb in handle_offloads(), we should
> increment tx_dropped or tx_errors.
>
ok.
>
>
>
^ permalink raw reply
* [ 3.5.y.z extended stable ] Patch "sctp: refactor sctp_outq_teardown to insure proper" has been added to staging queue
From: Herton Ronaldo Krzesinski @ 2013-02-15 3:11 UTC (permalink / raw)
To: Neil Horman
Cc: Jamie Parsons, Vlad Yasevich, David S. Miller, netdev,
Herton Ronaldo Krzesinski, kernel-team
This is a note to let you know that I have just added a patch titled
sctp: refactor sctp_outq_teardown to insure proper
to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree
which can be found at:
http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue
If you, or anyone else, feels it should not be added to this tree, please
reply to this email.
For more information about the 3.5.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
Thanks.
-Herton
------
>From c749be1458b2046faaeb42ff7cf2a07f0627fd24 Mon Sep 17 00:00:00 2001
From: Neil Horman <nhorman@tuxdriver.com>
Date: Thu, 17 Jan 2013 11:15:08 +0000
Subject: [PATCH] sctp: refactor sctp_outq_teardown to insure proper
re-initalization
commit 2f94aabd9f6c925d77aecb3ff020f1cc12ed8f86 upstream.
Jamie Parsons reported a problem recently, in which the re-initalization of an
association (The duplicate init case), resulted in a loss of receive window
space. He tracked down the root cause to sctp_outq_teardown, which discarded
all the data on an outq during a re-initalization of the corresponding
association, but never reset the outq->outstanding_data field to zero. I wrote,
and he tested this fix, which does a proper full re-initalization of the outq,
fixing this problem, and hopefully future proofing us from simmilar issues down
the road.
Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Reported-by: Jamie Parsons <Jamie.Parsons@metaswitch.com>
Tested-by: Jamie Parsons <Jamie.Parsons@metaswitch.com>
CC: Jamie Parsons <Jamie.Parsons@metaswitch.com>
CC: Vlad Yasevich <vyasevich@gmail.com>
CC: "David S. Miller" <davem@davemloft.net>
CC: netdev@vger.kernel.org
Acked-by: Vlad Yasevich <vyasevich@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
net/sctp/outqueue.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c
index a0fa19f..0716290 100644
--- a/net/sctp/outqueue.c
+++ b/net/sctp/outqueue.c
@@ -223,7 +223,7 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q)
/* Free the outqueue structure and any related pending chunks.
*/
-void sctp_outq_teardown(struct sctp_outq *q)
+static void __sctp_outq_teardown(struct sctp_outq *q)
{
struct sctp_transport *transport;
struct list_head *lchunk, *temp;
@@ -276,8 +276,6 @@ void sctp_outq_teardown(struct sctp_outq *q)
sctp_chunk_free(chunk);
}
- q->error = 0;
-
/* Throw away any leftover control chunks. */
list_for_each_entry_safe(chunk, tmp, &q->control_chunk_list, list) {
list_del_init(&chunk->list);
@@ -285,11 +283,17 @@ void sctp_outq_teardown(struct sctp_outq *q)
}
}
+void sctp_outq_teardown(struct sctp_outq *q)
+{
+ __sctp_outq_teardown(q);
+ sctp_outq_init(q->asoc, q);
+}
+
/* Free the outqueue structure and any related pending chunks. */
void sctp_outq_free(struct sctp_outq *q)
{
/* Throw away leftover chunks. */
- sctp_outq_teardown(q);
+ __sctp_outq_teardown(q);
/* If we were kmalloc()'d, free the memory. */
if (q->malloced)
--
1.7.9.5
^ permalink raw reply related
* [ 3.5.y.z extended stable ] Patch "net: calxedaxgmac: throw away overrun frames" has been added to staging queue
From: Herton Ronaldo Krzesinski @ 2013-02-15 3:10 UTC (permalink / raw)
To: Rob Herring; +Cc: netdev, kernel-team, linux-kernel, David S. Miller
This is a note to let you know that I have just added a patch titled
net: calxedaxgmac: throw away overrun frames
to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree
which can be found at:
http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue
If you, or anyone else, feels it should not be added to this tree, please
reply to this email.
For more information about the 3.5.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable
Thanks.
-Herton
------
>From f600e21bce4bd4f5c25873bbd8b89b8cdd8dbaef Mon Sep 17 00:00:00 2001
From: Rob Herring <rob.herring@calxeda.com>
Date: Wed, 16 Jan 2013 13:36:37 +0000
Subject: [PATCH] net: calxedaxgmac: throw away overrun frames
commit d6fb3be544b46a7611a3373fcaa62b5b0be01888 upstream.
The xgmac driver assumes 1 frame per descriptor. If a frame larger than
the descriptor's buffer size is received, the frame will spill over into
the next descriptor. So check for received frames that span more than one
descriptor and discard them. This prevents a crash if we receive erroneous
large packets.
Signed-off-by: Rob Herring <rob.herring@calxeda.com>
Cc: netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herton Ronaldo Krzesinski <herton.krzesinski@canonical.com>
---
drivers/net/ethernet/calxeda/xgmac.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/calxeda/xgmac.c b/drivers/net/ethernet/calxeda/xgmac.c
index 8b0a0e4..8a3cd87 100644
--- a/drivers/net/ethernet/calxeda/xgmac.c
+++ b/drivers/net/ethernet/calxeda/xgmac.c
@@ -546,6 +546,10 @@ static int desc_get_rx_status(struct xgmac_priv *priv, struct xgmac_dma_desc *p)
return -1;
}
+ /* All frames should fit into a single buffer */
+ if (!(status & RXDESC_FIRST_SEG) || !(status & RXDESC_LAST_SEG))
+ return -1;
+
/* Check if packet has checksum already */
if ((status & RXDESC_FRAME_TYPE) && (status & RXDESC_EXT_STATUS) &&
!(ext_status & RXDESC_IP_PAYLOAD_MASK))
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH 1/1] eventfd: implementation of EFD_MASK flag
From: Michał Mirosław @ 2013-02-15 2:45 UTC (permalink / raw)
To: Martin Sustrik
Cc: Alexander Viro, Andrew Morton, Sha Zhengju, linux-fsdevel,
linux-kernel, netdev
In-Reply-To: <1360279763-4768-1-git-send-email-sustrik@250bpm.com>
2013/2/8 Martin Sustrik <sustrik@250bpm.com>:
> When implementing network protocols in user space, one has to implement
> fake user-space file descriptors to represent the sockets for the protocol.
[...]
> This patch implements new EFD_MASK flag which attempts to solve this problem.
[...]
> @@ -55,6 +64,9 @@ __u64 eventfd_signal(struct eventfd_ctx *ctx, __u64 n)
> {
> unsigned long flags;
>
> + /* This function should never be used with eventfd in the mask mode. */
> + BUG_ON(ctx->flags & EFD_MASK);
> +
> spin_lock_irqsave(&ctx->wqh.lock, flags);
> if (ULLONG_MAX - ctx->count < n)
> n = ULLONG_MAX - ctx->count;
> @@ -123,12 +135,16 @@ static unsigned int eventfd_poll(struct file *file, poll_table *wait)
> poll_wait(file, &ctx->wqh, wait);
>
> spin_lock_irqsave(&ctx->wqh.lock, flags);
> - if (ctx->count > 0)
> - events |= POLLIN;
> - if (ctx->count == ULLONG_MAX)
> - events |= POLLERR;
> - if (ULLONG_MAX - 1 > ctx->count)
> - events |= POLLOUT;
> + if (ctx->flags & EFD_MASK) {
> + events = ctx->mask.events;
> + } else {
> + if (ctx->count > 0)
> + events |= POLLIN;
> + if (ctx->count == ULLONG_MAX)
> + events |= POLLERR;
> + if (ULLONG_MAX - 1 > ctx->count)
> + events |= POLLOUT;
> + }
> spin_unlock_irqrestore(&ctx->wqh.lock, flags);
>
> return events;
[...]
> @@ -412,7 +464,12 @@ struct file *eventfd_file_create(unsigned int count, int flags)
>
> kref_init(&ctx->kref);
> init_waitqueue_head(&ctx->wqh);
> - ctx->count = count;
> + if (flags & EFD_MASK) {
> + ctx->mask.events = 0;
> + ctx->mask.ptr = NULL;
> + } else {
> + ctx->count = count;
> + }
> ctx->flags = flags;
>
> file = anon_inode_getfile("[eventfd]", &eventfd_fops, ctx,
Since EFD_MASK is a persistent flag for a fd's lifetime, maybe you
could instead of all those if/elses and BUG_ON()s use another
file_operations struct for this feature?
Best Regards,
Michał Mirosław
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" 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
* Re: [PATCH net-next 3/3] GRE: Add TCP segmentation offload for GRE
From: Michał Mirosław @ 2013-02-15 2:35 UTC (permalink / raw)
To: Pravin B Shelar; +Cc: netdev, edumazet, jesse, bhutchings
In-Reply-To: <1360871101-2086-1-git-send-email-pshelar@nicira.com>
2013/2/14 Pravin B Shelar <pshelar@nicira.com>:
> Following patch adds GRE protocol offload handler so that
> skb_gso_segment() can segment GRE packets.
> SKB GSO CB is added to keep track of total header length so that
> skb_segment can push entire header. e.g. in case of GRE, skb_segment
> need to push inner and outer headers to every segment.
> New NETIF_F_GRE_GSO feature is added for devices which support HW
> GRE TSO offload. Currently none of devices support it therefore GRE GSO
> always fall backs to software GSO.
[...]
> @@ -1044,6 +1102,14 @@ static int ipgre_tunnel_bind_dev(struct net_device *dev)
> mtu = 68;
>
> tunnel->hlen = addend;
> + if (tunnel->parms.o_flags & GRE_SEQ) {
> + /* TCP offload with GRE SEQ is not supported. */
> + dev->features &= ~NETIF_F_GSO_SOFTWARE;
> + dev->hw_features &= ~NETIF_F_GSO_SOFTWARE;
> + } else {
> + dev->features |= NETIF_F_GSO_SOFTWARE;
> + dev->hw_features |= NETIF_F_GSO_SOFTWARE;
> + }
Feature clipping belongs to ndo_fix_features. Here,
netdev_update_features() for the tunnel device should be called.
Wishing You Good Night,
Michał Mirosław
^ permalink raw reply
* [PATCH v4] net: sh_eth: Add support of device tree probe
From: Nobuhiro Iwamatsu @ 2013-02-15 1:53 UTC (permalink / raw)
To: netdev
Cc: horms+renesas, magnus.damm, devicetree-discuss, kda,
kuninori.morimoto.gx, Nobuhiro Iwamatsu
From: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
This adds support of device tree probe for Renesas sh-ether driver.
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
V4: - Remove empty sh_eth_parse_dt().
V3: - Removed sentnece of "needs-init" from document.
V2: - Removed ether_setup().
- Fixed typo from "sh-etn" to "sh-eth".
- Removed "needs-init" and sh-eth,endian from definition of DT.
- Changed "sh-eth,edmac-endian" instead of "sh-eth,edmac-big-endain"
in definition of DT.
---
Documentation/devicetree/bindings/net/sh_ether.txt | 39 +++++
drivers/net/ethernet/renesas/sh_eth.c | 150 ++++++++++++++++----
2 files changed, 165 insertions(+), 24 deletions(-)
create mode 100644 Documentation/devicetree/bindings/net/sh_ether.txt
diff --git a/Documentation/devicetree/bindings/net/sh_ether.txt b/Documentation/devicetree/bindings/net/sh_ether.txt
new file mode 100644
index 0000000..f20d66a
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/sh_ether.txt
@@ -0,0 +1,39 @@
+* Renesas Electronics SuperH EMAC
+
+This file provides information, what the device node
+for the sh_eth interface contains.
+
+Required properties:
+- compatible: "renesas,sh-eth";
+- interrupt-parent: The phandle for the interrupt controller that
+ services interrupts for this device.
+- reg: Offset and length of the register set for the
+ device.
+- interrupts: Interrupt mapping for the sh_eth interrupt
+ sources (vector id).
+- phy-mode: String, operation mode of the PHY interface.
+- sh-eth,register-type: String, register type of sh_eth.
+ Please select "gigabit", "fast-sh4" or
+ "fast-sh3-sh2".
+- sh-eth,phy-id: PHY id.
+
+Optional properties:
+- local-mac-address: 6 bytes, mac address
+- sh-eth,no-ether-link: Set link control by software. When device does
+ not support ether-link, set.
+- sh-eth,ether-link-active-low: Set link check method.
+ When detection of link is treated as active-low,
+ set.
+- sh-eth,edmac-big-endian: Set big endian for sh_eth dmac.
+ It work as little endian when this is not set.
+
+Example (armadillo800eva):
+ sh-eth@e9a00000 {
+ compatible = "renesas,sh-eth";
+ interrupt-parent = <&intca>;
+ reg = <0xe9a00000 0x800>, <0xe9a01800 0x800>;
+ interrupts = <0x500>;
+ phy-mode = "mii";
+ sh-eth,register-type = "gigabit";
+ sh-eth,phy-id = <0>;
+ };
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 3d70586..b41249a 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1,7 +1,7 @@
/*
* SuperH Ethernet device driver
*
- * Copyright (C) 2006-2012 Nobuhiro Iwamatsu
+ * Copyright (C) 2006-2013 Nobuhiro Iwamatsu
* Copyright (C) 2008-2012 Renesas Solutions Corp.
*
* This program is free software; you can redistribute it and/or modify it
@@ -31,6 +31,12 @@
#include <linux/platform_device.h>
#include <linux/mdio-bitbang.h>
#include <linux/netdevice.h>
+#include <linux/of.h>
+#include <linux/of_device.h>
+#include <linux/of_platform.h>
+#include <linux/of_address.h>
+#include <linux/of_irq.h>
+#include <linux/of_net.h>
#include <linux/phy.h>
#include <linux/cache.h>
#include <linux/io.h>
@@ -2347,26 +2353,103 @@ static const struct net_device_ops sh_eth_netdev_ops = {
.ndo_change_mtu = eth_change_mtu,
};
+#ifdef CONFIG_OF
+
+static int
+sh_eth_of_get_register_type(struct device_node *np)
+{
+ const char *of_str;
+ int ret = of_property_read_string(np, "sh-eth,register-type", &of_str);
+ if (ret)
+ return ret;
+
+ if (of_str && !strcmp(of_str, "gigabit"))
+ return SH_ETH_REG_GIGABIT;
+
+ else if (of_str && !strcmp(of_str, "fast-sh4"))
+ return SH_ETH_REG_FAST_SH4;
+ else if (of_str && !strcmp(of_str, "fast-sh3-sh2"))
+ return SH_ETH_REG_FAST_SH3_SH2;
+ else
+ return -EINVAL;
+}
+
+static struct sh_eth_plat_data *
+sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
+{
+ int ret;
+ struct device_node *np = dev->of_node;
+ struct sh_eth_plat_data *pdata;
+
+ pdata = devm_kzalloc(dev, sizeof(struct sh_eth_plat_data),
+ GFP_KERNEL);
+ if (!pdata) {
+ dev_err(dev, "%s: failed to allocate config data\n", __func__);
+ return NULL;
+ }
+
+ pdata->phy_interface = of_get_phy_mode(np);
+
+ of_property_read_u32(np, "sh-eth,phy-id", &pdata->phy);
+
+ if (of_find_property(np, "sh-eth,edmac-big-endian", NULL))
+ pdata->edmac_endian = EDMAC_BIG_ENDIAN;
+ else
+ pdata->edmac_endian = EDMAC_LITTLE_ENDIAN;
+
+ if (of_find_property(np, "sh-eth,no-ether-link", NULL))
+ pdata->no_ether_link = 1;
+ else
+ pdata->no_ether_link = 0;
+
+ if (of_find_property(np, "sh-eth,ether-link-active-low", NULL))
+ pdata->ether_link_active_low = 1;
+ else
+ pdata->ether_link_active_low = 0;
+
+ ret = sh_eth_of_get_register_type(np);
+ if (ret < 0)
+ goto error;
+ pdata->register_type = ret;
+
+#ifdef CONFIG_OF_NET
+ if (!is_valid_ether_addr(ndev->dev_addr)) {
+ const char *macaddr = of_get_mac_address(np);
+ if (macaddr)
+ memcpy(pdata->mac_addr, macaddr, ETH_ALEN);
+ }
+#endif
+
+ return pdata;
+
+error:
+ devm_kfree(dev, pdata);
+ return NULL;
+}
+#endif
+
static int sh_eth_drv_probe(struct platform_device *pdev)
{
- int ret, devno = 0;
+ int ret = 0, devno = 0;
struct resource *res;
struct net_device *ndev = NULL;
struct sh_eth_private *mdp = NULL;
struct sh_eth_plat_data *pd;
+ struct device_node *np = pdev->dev.of_node;
+
+ ndev = alloc_etherdev(sizeof(struct sh_eth_private));
+ if (!ndev) {
+ ret = -ENOMEM;
+ goto out;
+ }
+ mdp = netdev_priv(ndev);
/* get base addr */
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (unlikely(res == NULL)) {
dev_err(&pdev->dev, "invalid resource\n");
ret = -EINVAL;
- goto out;
- }
-
- ndev = alloc_etherdev(sizeof(struct sh_eth_private));
- if (!ndev) {
- ret = -ENOMEM;
- goto out;
+ goto out_release;
}
/* The sh Ether-specific entries in the device structure. */
@@ -2383,27 +2466,41 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
}
ndev->irq = ret;
- SET_NETDEV_DEV(ndev, &pdev->dev);
-
- /* Fill in the fields of the device structure with ethernet values. */
- ether_setup(ndev);
-
- mdp = netdev_priv(ndev);
- mdp->num_tx_ring = TX_RING_SIZE;
- mdp->num_rx_ring = RX_RING_SIZE;
mdp->addr = ioremap(res->start, resource_size(res));
if (mdp->addr == NULL) {
ret = -ENOMEM;
dev_err(&pdev->dev, "ioremap failed.\n");
goto out_release;
}
+#ifdef CONFIG_OF
+ if (np && of_device_is_available(np)) {
+ pd = sh_eth_parse_dt(&pdev->dev, ndev);
+ if (pdev->dev.platform_data) {
+ struct sh_eth_plat_data *tmp =
+ pdev->dev.platform_data;
+ pd->set_mdio_gate = tmp->set_mdio_gate;
+ pd->needs_init = tmp->needs_init;
+ }
+ } else
+#endif
+ pd = (struct sh_eth_plat_data *)(pdev->dev.platform_data);
+
+ if (!pd) {
+ dev_err(&pdev->dev, "no setup data defined\n");
+ ret = -EINVAL;
+ goto out_release;
+ }
+
+ SET_NETDEV_DEV(ndev, &pdev->dev);
+
+ mdp->num_tx_ring = TX_RING_SIZE;
+ mdp->num_rx_ring = RX_RING_SIZE;
spin_lock_init(&mdp->lock);
mdp->pdev = pdev;
pm_runtime_enable(&pdev->dev);
pm_runtime_resume(&pdev->dev);
- pd = (struct sh_eth_plat_data *)(pdev->dev.platform_data);
/* get PHY ID */
mdp->phy_id = pd->phy;
mdp->phy_interface = pd->phy_interface;
@@ -2412,6 +2509,8 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
mdp->no_ether_link = pd->no_ether_link;
mdp->ether_link_active_low = pd->ether_link_active_low;
mdp->reg_offset = sh_eth_get_register_offset(pd->register_type);
+ /* read and set MAC address */
+ read_mac_address(ndev, pd->mac_addr);
/* set cpu data */
#if defined(SH_ETH_HAS_BOTH_MODULES)
@@ -2429,20 +2528,16 @@ static int sh_eth_drv_probe(struct platform_device *pdev)
/* debug message level */
mdp->msg_enable = SH_ETH_DEF_MSG_ENABLE;
- /* read and set MAC address */
- read_mac_address(ndev, pd->mac_addr);
-
/* ioremap the TSU registers */
if (mdp->cd->tsu) {
struct resource *rtsu;
rtsu = platform_get_resource(pdev, IORESOURCE_MEM, 1);
if (!rtsu) {
dev_err(&pdev->dev, "Not found TSU resource\n");
- ret = -ENODEV;
goto out_release;
}
mdp->tsu_addr = ioremap(rtsu->start,
- resource_size(rtsu));
+ resource_size(rtsu));
mdp->port = devno % 2;
ndev->features = NETIF_F_HW_VLAN_FILTER;
}
@@ -2522,17 +2617,24 @@ static int sh_eth_runtime_nop(struct device *dev)
return 0;
}
-static struct dev_pm_ops sh_eth_dev_pm_ops = {
+static const struct dev_pm_ops sh_eth_dev_pm_ops = {
.runtime_suspend = sh_eth_runtime_nop,
.runtime_resume = sh_eth_runtime_nop,
};
+static struct of_device_id sh_eth_match[] = {
+ { .compatible = "renesas,sh-eth",},
+ {},
+};
+MODULE_DEVICE_TABLE(of, sh_eth_match);
+
static struct platform_driver sh_eth_driver = {
.probe = sh_eth_drv_probe,
.remove = sh_eth_drv_remove,
.driver = {
.name = CARDNAME,
.pm = &sh_eth_dev_pm_ops,
+ .of_match_table = sh_eth_match,
},
};
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH net-next 3/3] GRE: Add TCP segmentation offload for GRE
From: Eric Dumazet @ 2013-02-15 1:39 UTC (permalink / raw)
To: Pravin B Shelar; +Cc: netdev, edumazet, jesse, bhutchings, mirqus
In-Reply-To: <1360871101-2086-1-git-send-email-pshelar@nicira.com>
On Thu, 2013-02-14 at 11:45 -0800, Pravin B Shelar wrote:
> Following patch adds GRE protocol offload handler so that
> skb_gso_segment() can segment GRE packets.
> SKB GSO CB is added to keep track of total header length so that
> skb_segment can push entire header. e.g. in case of GRE, skb_segment
> need to push inner and outer headers to every segment.
> New NETIF_F_GRE_GSO feature is added for devices which support HW
> GRE TSO offload. Currently none of devices support it therefore GRE GSO
> always fall backs to software GSO.
>
> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
> ---
> Fixed according to comments from Jesse and Eric.
> v2-v3:
> - Use device features to segment inner packet.
> - Moved skb_mac_gso_segment to separate patch.
> - simplified gre_gso_segment().
> - Added NETIF_F_GRE_GSO feature.
>
> v1-v2:
> - Factored a MAC layer handler out of skb_gso_segment().
> - Eliminated copy operation from gre_gso_segment().
> - Refresh header pointer after pskb_may_pull().
> ---
Seems very good to me, thanks !
The only thing that puzzles me is the ip_select_ident() in
ipgre_tunnel_xmit()
Do we care of the IP identifiers being 0, 1, 2, 3, ... on the outer
headers ?
Without TSO, we are using 0 IP identifiers (DF being set)
Also if we can't unclone the skb in handle_offloads(), we should
increment tx_dropped or tx_errors.
^ permalink raw reply
* ixgbe: Regression, unsupported SFP+ modules on 10Gbit/s X520 NIC no longer work with allow_unsupported_sfp=1
From: Stefan Behte @ 2013-02-15 0:58 UTC (permalink / raw)
To: netdev
[-- Attachment #1: Type: text/plain, Size: 6221 bytes --]
Hello,
I was told to send a mail, even though I had already opened https://bugzilla.kernel.org/show_bug.cgi?id=53901.
Someone patched the ixgbe driver, and now non-intel SFPs do not work anymore, again. The issue of intel "lock-in" was discussed before here:
http://marc.info/?l=e1000-devel&m=132697406314730&w=2
A tested patch is attached.
Here is what I do:
# modinfo ixgbe | grep parm
parm: max_vfs:Maximum number of virtual functions to allocate per physical function - default is zero and maximum value is 63 (uint)
parm: allow_unsupported_sfp:Allow unsupported and untested SFP+ modules on 82599-based adapters (uint)
parm: debug:Debug level (0=none,...,16=all) (int)
# modprobe -r ixgbe
# modprobe ixgbe allow_unsupported_sfp=0
# dmesg | grep ixgbe
[13690.355090] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver - version 3.9.15-k
[13690.355092] ixgbe: Copyright (c) 1999-2012 Intel Corporation.
[13690.373128] ixgbe 0000:02:00.0: failed to load because an unsupported SFP+ module type was detected.
[13690.373177] ixgbe 0000:02:00.0: Reload the driver after installing a supported module.
[13690.390987] ixgbe 0000:02:00.1: failed to load because an unsupported SFP+ module type was detected.
[13690.391036] ixgbe 0000:02:00.1: Reload the driver after installing a supported module.
# modprobe -r ixgbe
# modprobe ixgbe allow_unsupported_sfp=1
# dmesg | grep ixgbe
[13679.088849] dca service started, version 1.12.1
[13679.091174] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver - version 3.9.15-k
[13679.091177] ixgbe: Copyright (c) 1999-2012 Intel Corporation.
[13679.109194] ixgbe 0000:02:00.0: failed to load because an unsupported SFP+ module type was detected.
[13679.109243] ixgbe 0000:02:00.0: Reload the driver after installing a supported module.
[13679.127399] ixgbe 0000:02:00.1: failed to load because an unsupported SFP+ module type was detected.
[13679.127450] ixgbe 0000:02:00.1: Reload the driver after installing a supported module.
[13690.352712] dca service started, version 1.12.1
With the patch:
# modprobe -r ixgbe
# modprobe ixgbe allow_unsupported_sfp=0
# dmesg | grep ixgbe
[13907.870087] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver - version 3.9.15-k
[13907.870089] ixgbe: Copyright (c) 1999-2012 Intel Corporation.
[13907.888106] ixgbe 0000:02:00.0: failed to load because an unsupported SFP+ module type was detected.
[13907.888155] ixgbe 0000:02:00.0: Reload the driver after installing a supported module.
[13907.906187] ixgbe 0000:02:00.1: failed to load because an unsupported SFP+ module type was detected.
[13907.906237] ixgbe 0000:02:00.1: Reload the driver after installing a supported module.
# modprobe -r ixgbe
# modprobe ixgbe allow_unsupported_sfp=1
# dmesg | grep ixgbe
[13914.534758] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver - version3.9.15-k
[13914.534761] ixgbe: Copyright (c) 1999-2012 Intel Corporation.
[13914.552820] ixgbe 0000:02:00.0 (unregistered net_device): WARNING: Intel (R) Network Connections are quality tested using Intel (R) Ethernet Optics. Using untested modules is not supported and may cause unstable operation or damage to
the module or the adapter. Intel Corporation is not responsible for any harm caused by using untested modules.
[13917.741931] ixgbe 0000:02:00.0: irq 50 for MSI/MSI-X
[13917.741938] ixgbe 0000:02:00.0: irq 51 for MSI/MSI-X
[13917.741942] ixgbe 0000:02:00.0: irq 52 for MSI/MSI-X
[13917.741951] ixgbe 0000:02:00.0: irq 53 for MSI/MSI-X
[13917.741955] ixgbe 0000:02:00.0: irq 54 for MSI/MSI-X
[13917.741960] ixgbe 0000:02:00.0: irq 55 for MSI/MSI-X
[13917.741965] ixgbe 0000:02:00.0: irq 56 for MSI/MSI-X
[13917.741969] ixgbe 0000:02:00.0: irq 57 for MSI/MSI-X
[13917.741973] ixgbe 0000:02:00.0: irq 58 for MSI/MSI-X
[13917.742002] ixgbe 0000:02:00.0: Multiqueue Enabled: Rx Queue count = 8, Tx Queue count = 8
[13917.742126] ixgbe 0000:02:00.0: (PCI Express:5.0GT/s:Width x8) 90:e2:ba:37:3b:18
[13917.742207] ixgbe 0000:02:00.0: MAC: 2, PHY: 14, SFP+: 65535, PBA No: E68793-005
[13917.743461] ixgbe 0000:02:00.0: Intel(R) 10 Gigabit Network Connection
[13917.761578] ixgbe 0000:02:00.1 (unregistered net_device): WARNING: Intel (R) Network Connections are quality tested using Intel (R) Ethernet Optics. Using untested modules is not supported and may cause unstable operation or damage to the module or the adapter. Intel Corporation is not responsible for any harm caused by using untested modules.
[13920.948726] ixgbe 0000:02:00.1: irq 59 for MSI/MSI-X
[13920.948737] ixgbe 0000:02:00.1: irq 60 for MSI/MSI-X
[13920.948742] ixgbe 0000:02:00.1: irq 61 for MSI/MSI-X
[13920.948746] ixgbe 0000:02:00.1: irq 62 for MSI/MSI-X
[13920.948751] ixgbe 0000:02:00.1: irq 63 for MSI/MSI-X
[13920.948757] ixgbe 0000:02:00.1: irq 64 for MSI/MSI-X
[13920.948761] ixgbe 0000:02:00.1: irq 65 for MSI/MSI-X
[13920.948767] ixgbe 0000:02:00.1: irq 66 for MSI/MSI-X
[13920.948774] ixgbe 0000:02:00.1: irq 67 for MSI/MSI-X
[13920.948803] ixgbe 0000:02:00.1: Multiqueue Enabled: Rx Queue count = 8, Tx Queue count = 8
[13920.948927] ixgbe 0000:02:00.1: (PCI Express:5.0GT/s:Width x8) 90:e2:ba:37:3b:19
[13920.949008] ixgbe 0000:02:00.1: MAC: 2, PHY: 14, SFP+: 65535, PBA No: E68793-005
[13920.950237] ixgbe 0000:02:00.1: Intel(R) 10 Gigabit Network Connection
And then I get two nice Interfaces. Please apply. :)
Best regards,
Stefan Behte
Babiel GmbH
Moskauer Strasse 27
D-40227 Düsseldorf
Tel: 0211-179349 0
Fax: 0211-179349 29
E-Mail: S.Behte@babiel.com
Internet: http://www.babiel.com
Geschäftsführer: Georg Babiel, Dr. Rainer Babiel, Harald Babiel
Amtsgericht Düsseldorf HRB 38633
~~~~~~~~~~~~~~ DISCLAIMER ~~~~~~~~~~~~~~~
The information transmitted in this electronic mail message may contain confidential and or privileged materials. Any review, retransmission, dissemination or other use of or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you receive such e-mails in error, please contact the sender and delete the material from any computer.
[-- Attachment #2: ixgbe-allow-non-intel-sfp-again.patch --]
[-- Type: application/octet-stream, Size: 671 bytes --]
diff -ur /usr/src/linux-3.7.7.ori/drivers/net/ethernet/intel/ixgbe//ixgbe_phy.c ./ixgbe_phy.c
--- /usr/src/linux-3.7.7.ori/drivers/net/ethernet/intel/ixgbe//ixgbe_phy.c 2013-02-11 18:05:09.000000000 +0100
+++ ./ixgbe_phy.c 2013-02-14 19:01:33.000000000 +0100
@@ -1061,9 +1061,11 @@
hw->phy.sfp_type == ixgbe_sfp_type_1g_cu_core0 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core0 ||
hw->phy.sfp_type == ixgbe_sfp_type_1g_sx_core1)) {
+ if (!hw->allow_unsupported_sfp) {
hw->phy.type = ixgbe_phy_sfp_unsupported;
status = IXGBE_ERR_SFP_NOT_SUPPORTED;
goto out;
+ }
}
/* Anything else 82598-based is supported */
^ permalink raw reply
* Re: [STABLE REQUEST] Merge to linux-3.4.y net: Downgrade CAP_SYS_MODULE deprecated message from error to warning.
From: Greg KH @ 2013-02-15 0:45 UTC (permalink / raw)
To: Vinson Lee; +Cc: stable, davem, edumazet, mirq-linux, jpirko, therbert, netdev
In-Reply-To: <CAKixpbhtD-mhAESjV3HOZRxYqvsWrjH0vTpDgKZuUismUvVa-g@mail.gmail.com>
On Thu, Feb 14, 2013 at 04:16:18PM -0800, Vinson Lee wrote:
> On Thu, Feb 14, 2013 at 3:37 PM, Greg KH <gregkh@linuxfoundation.org> wrote:
> > On Thu, Feb 14, 2013 at 03:29:44PM -0800, Vinson Lee wrote:
> >> Hi.
> >>
> >> I would like to nominate commit
> >> 7cecb523adedcaf8acba5e14d47559d8bc3f40d7 for backport to stable
> >> branches 3.4 and earlier.
> >>
> >> commit 7cecb523adedcaf8acba5e14d47559d8bc3f40d7
> >> Author: Vinson Lee <vlee@twitter.com>
> >> Date: Wed Jun 27 14:32:07 2012 +0000
> >>
> >> net: Downgrade CAP_SYS_MODULE deprecated message from error to warning.
> >>
> >> Make logging level consistent with other deprecation messages in net
> >> subsystem.
> >>
> >> Signed-off-by: Vinson Lee <vlee@twitter.com>
> >> Cc: David Mackey <tdmackey@twitter.com>
> >> Signed-off-by: David S. Miller <davem@davemloft.net>
> >
> > I fail to see how this patch meets the rules described in
> > Documentation/stable_kernel_rules.txt. What am I missing?
> >
> > thanks,
> >
> > greg k-h
>
> I am logging different kernel log-level messages to different files
> and monitoring them here. I see this message most often in the errors
> pile. It's arguable that this is not a bug, but it is definitely
> bothering me here. Please consider for backport but I would understand
> if this request was turned down.
As it's not a "bug", and it's something trivial you can fix on your end
if it really annoys you (you should be fixing the root problem here, not
the kernel log message, right?), I'm not going to take it in the -stable
tree.
Unless the network maintainers want to override me, in which case, I'll
be glad to take it then :)
thanks,
greg k-h
^ permalink raw reply
* [PATCH net] tipc: fix missing spinlock init in broadcast code
From: Paul Gortmaker @ 2013-02-15 0:43 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Erik Hugne, Paul Gortmaker
From: Erik Hugne <erik.hugne@ericsson.com>
After commit 3c294cb3 "tipc: remove the bearer congestion mechanism",
we try to grab the broadcast bearer lock when sending multicast
messages over the broadcast link. This will cause an oops because
the lock is never initialized. This is an old bug, but the lock
was never actually used before commit 3c294cb3, so that why it was
not visible until now. The oops will look something like:
BUG: spinlock bad magic on CPU#2, daemon/147
lock: bcast_bearer+0x48/0xffffffffffffd19a [tipc],
.magic: 00000000, .owner: <none>/-1, .owner_cpu: 0
Pid: 147, comm: daemon Not tainted 3.8.0-rc3+ #206
Call Trace:
spin_dump+0x8a/0x8f
spin_bug+0x21/0x26
do_raw_spin_lock+0x114/0x150
_raw_spin_lock_bh+0x19/0x20
tipc_bearer_blocked+0x1f/0x40 [tipc]
tipc_link_send_buf+0x82/0x280 [tipc]
? __alloc_skb+0x9f/0x2b0
tipc_bclink_send_msg+0x77/0xa0 [tipc]
tipc_multicast+0x11b/0x1b0 [tipc]
send_msg+0x225/0x530 [tipc]
sock_sendmsg+0xca/0xe0
The above can be triggered by running the multicast demo program.
Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
---
[PG: I've marked this as "net" since git describe --contains 3c294cb3
gives v3.8-rc1~139^2~242^2~5 --- i.e. the now closing 3.8 dev cycle.]
net/tipc/bcast.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/net/tipc/bcast.c b/net/tipc/bcast.c
index 54f89f9..2655c9f 100644
--- a/net/tipc/bcast.c
+++ b/net/tipc/bcast.c
@@ -774,6 +774,7 @@ void tipc_bclink_init(void)
bcl->owner = &bclink->node;
bcl->max_pkt = MAX_PKT_DEFAULT_MCAST;
tipc_link_set_queue_limits(bcl, BCLINK_WIN_DEFAULT);
+ spin_lock_init(&bcbearer->bearer.lock);
bcl->b_ptr = &bcbearer->bearer;
bcl->state = WORKING_WORKING;
strlcpy(bcl->name, tipc_bclink_name, TIPC_MAX_LINK_NAME);
--
1.8.1.2
^ permalink raw reply related
* Re: [PATCHi v2] net: sh_eth: Add support of device tree probe
From: Nobuhiro Iwamatsu @ 2013-02-14 2:56 UTC (permalink / raw)
To: Kuninori Morimoto
Cc: netdev, horms+renesas, magnus.damm, devicetree-discuss, kda
In-Reply-To: <87mwv7ofgj.wl%kuninori.morimoto.gx@renesas.com>
(2013/02/14 10:24), Kuninori Morimoto wrote:
>
> Hi Iwamatsu-san
>
> Thank you for this patch.
>
> Small comment from me
>
>> +#ifdef CONFIG_OF
> (snip)
>> +sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
>> +{
>> + int ret;
>> + struct device_node *np = dev->of_node;
>> + struct sh_eth_plat_data *pdata;
> ...
>> +#else
>> +static struct sh_eth_plat_data *
>> +sh_eth_parse_dt(struct device *dev, struct net_device *ndev)
>> +{
>> + return NULL;
>> +}
>> +#endif
>
> (snip)
>
>> static int sh_eth_drv_probe(struct platform_device *pdev)
>> {
> ...
>> +#ifdef CONFIG_OF
>> + if (np&& of_device_is_available(np)) {
>> + pd = sh_eth_parse_dt(&pdev->dev, ndev);
>> + if (pdev->dev.platform_data) {
>> + struct sh_eth_plat_data *tmp =
>> + pdev->dev.platform_data;
>> + pd->set_mdio_gate = tmp->set_mdio_gate;
>> + pd->needs_init = tmp->needs_init;
>> + }
>> + } else
>> +#endif
>
> sh_eth_parse_dt() was defined for both CONFIG_OF and !CONFIG_OF.
> But it is called only from CONFIG_OF ?
>
Because of_device_is_available needs CONFIG_OF.
I already send a patch which add empty function of of_device_is_available.
If this was apply, this ifdef becomes without need.
Best,
Nobuhiro
^ permalink raw reply
* Re: [PATCH net-next 2/3] net: factor out skb_mac_gso_segment() from skb_gso_segment()
From: Eric Dumazet @ 2013-02-15 0:32 UTC (permalink / raw)
To: Pravin B Shelar; +Cc: netdev, edumazet, jesse, bhutchings, mirqus
In-Reply-To: <1360871095-2053-1-git-send-email-pshelar@nicira.com>
On Thu, 2013-02-14 at 11:44 -0800, Pravin B Shelar wrote:
> This function will be used in next GRE_GSO patch. This patch does
> not change any functionality. It only exports skb_mac_gso_segment()
> function.
>
> Signed-off-by: Pravin B Shelar <pshelar@nicira.com>
...
> +struct sk_buff *__skb_gso_segment(struct sk_buff *skb,
> + netdev_features_t features, bool tx_path)
> +{
> +
...
> +
> + skb_reset_mac_header(skb);
> + skb->mac_len = skb->network_header - skb->mac_header;
This could use skb_reset_mac_len() helper, but thats a minor point.
Acked-by: Eric Dumazet <edumazet@google.com>
^ permalink raw reply
* Re: ixgbe: Regression, unsupported SFP+ modules on 10Gbit/s X520 NIC no longer work with allow_unsupported_sfp=1
From: Jeff Kirsher @ 2013-02-15 0:28 UTC (permalink / raw)
To: Stefan Behte
Cc: netdev, Skidmore, Donald C, Duyck, Alexander H, Tantilov, Emil S,
Keller, Jacob E
In-Reply-To: <D76AF9B3DDF5FF49833AC0A1396549060333A1C5@s554.babiel.com>
[-- Attachment #1: Type: text/plain, Size: 6115 bytes --]
On Fri, 2013-02-15 at 01:10 +0100, Stefan Behte wrote:
> Hello,
>
> I was told to send a mail, even though I had already opened
> https://bugzilla.kernel.org/show_bug.cgi?id=53901.
>
> Someone patched the ixgbe driver, and now non-intel SFPs do not work
> anymore, again. The issue of intel "lock-in" was discussed before
> here:
> http://marc.info/?l=e1000-devel&m=132697406314730&w=2
>
> A tested patch is attached.
>
> Here is what I do:
>
> # modinfo ixgbe | grep parm
> parm: max_vfs:Maximum number of virtual functions to
> allocate per physical function - default is zero and maximum value is
> 63 (uint)
> parm: allow_unsupported_sfp:Allow unsupported and untested
> SFP+ modules on 82599-based adapters (uint)
> parm: debug:Debug level (0=none,...,16=all) (int)
>
> # modprobe -r ixgbe
> # modprobe ixgbe allow_unsupported_sfp=0
> # dmesg | grep ixgbe
> [13690.355090] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver -
> version 3.9.15-k
> [13690.355092] ixgbe: Copyright (c) 1999-2012 Intel Corporation.
> [13690.373128] ixgbe 0000:02:00.0: failed to load because an
> unsupported SFP+ module type was detected.
> [13690.373177] ixgbe 0000:02:00.0: Reload the driver after installing
> a supported module.
> [13690.390987] ixgbe 0000:02:00.1: failed to load because an
> unsupported SFP+ module type was detected.
> [13690.391036] ixgbe 0000:02:00.1: Reload the driver after installing
> a supported module.
>
> # modprobe -r ixgbe
> # modprobe ixgbe allow_unsupported_sfp=1
> # dmesg | grep ixgbe
> [13679.088849] dca service started, version 1.12.1
> [13679.091174] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver -
> version 3.9.15-k
> [13679.091177] ixgbe: Copyright (c) 1999-2012 Intel Corporation.
> [13679.109194] ixgbe 0000:02:00.0: failed to load because an
> unsupported SFP+ module type was detected.
> [13679.109243] ixgbe 0000:02:00.0: Reload the driver after installing
> a supported module.
> [13679.127399] ixgbe 0000:02:00.1: failed to load because an
> unsupported SFP+ module type was detected.
> [13679.127450] ixgbe 0000:02:00.1: Reload the driver after installing
> a supported module.
> [13690.352712] dca service started, version 1.12.1
>
>
> With the patch:
>
> # modprobe -r ixgbe
> # modprobe ixgbe allow_unsupported_sfp=0
> # dmesg | grep ixgbe
> [13907.870087] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver -
> version 3.9.15-k
> [13907.870089] ixgbe: Copyright (c) 1999-2012 Intel Corporation.
> [13907.888106] ixgbe 0000:02:00.0: failed to load because an
> unsupported SFP+ module type was detected.
> [13907.888155] ixgbe 0000:02:00.0: Reload the driver after installing
> a supported module.
> [13907.906187] ixgbe 0000:02:00.1: failed to load because an
> unsupported SFP+ module type was detected.
> [13907.906237] ixgbe 0000:02:00.1: Reload the driver after installing
> a supported module.
>
>
> # modprobe -r ixgbe
> # modprobe ixgbe allow_unsupported_sfp=1
> # dmesg | grep ixgbe
> [13914.534758] ixgbe: Intel(R) 10 Gigabit PCI Express Network Driver -
> version3.9.15-k
> [13914.534761] ixgbe: Copyright (c) 1999-2012 Intel Corporation.
> [13914.552820] ixgbe 0000:02:00.0 (unregistered net_device): WARNING:
> Intel (R) Network Connections are quality tested using Intel (R)
> Ethernet Optics. Using untested modules is not supported and may
> cause unstable operation or damage to
> the module or the adapter. Intel Corporation is not responsible for
> any harm caused by using untested modules.
> [13917.741931] ixgbe 0000:02:00.0: irq 50 for MSI/MSI-X
> [13917.741938] ixgbe 0000:02:00.0: irq 51 for MSI/MSI-X
> [13917.741942] ixgbe 0000:02:00.0: irq 52 for MSI/MSI-X
> [13917.741951] ixgbe 0000:02:00.0: irq 53 for MSI/MSI-X
> [13917.741955] ixgbe 0000:02:00.0: irq 54 for MSI/MSI-X
> [13917.741960] ixgbe 0000:02:00.0: irq 55 for MSI/MSI-X
> [13917.741965] ixgbe 0000:02:00.0: irq 56 for MSI/MSI-X
> [13917.741969] ixgbe 0000:02:00.0: irq 57 for MSI/MSI-X
> [13917.741973] ixgbe 0000:02:00.0: irq 58 for MSI/MSI-X
> [13917.742002] ixgbe 0000:02:00.0: Multiqueue Enabled: Rx Queue count
> = 8, Tx Queue count = 8
> [13917.742126] ixgbe 0000:02:00.0: (PCI Express:5.0GT/s:Width x8)
> 90:e2:ba:37:3b:18
> [13917.742207] ixgbe 0000:02:00.0: MAC: 2, PHY: 14, SFP+: 65535, PBA
> No: E68793-005
> [13917.743461] ixgbe 0000:02:00.0: Intel(R) 10 Gigabit Network
> Connection
> [13917.761578] ixgbe 0000:02:00.1 (unregistered net_device): WARNING:
> Intel (R) Network Connections are quality tested using Intel (R)
> Ethernet Optics. Using untested modules is not supported and may
> cause unstable operation or damage to the module or the adapter.
> Intel Corporation is not responsible for any harm caused by using
> untested modules.
> [13920.948726] ixgbe 0000:02:00.1: irq 59 for MSI/MSI-X
> [13920.948737] ixgbe 0000:02:00.1: irq 60 for MSI/MSI-X
> [13920.948742] ixgbe 0000:02:00.1: irq 61 for MSI/MSI-X
> [13920.948746] ixgbe 0000:02:00.1: irq 62 for MSI/MSI-X
> [13920.948751] ixgbe 0000:02:00.1: irq 63 for MSI/MSI-X
> [13920.948757] ixgbe 0000:02:00.1: irq 64 for MSI/MSI-X
> [13920.948761] ixgbe 0000:02:00.1: irq 65 for MSI/MSI-X
> [13920.948767] ixgbe 0000:02:00.1: irq 66 for MSI/MSI-X
> [13920.948774] ixgbe 0000:02:00.1: irq 67 for MSI/MSI-X
> [13920.948803] ixgbe 0000:02:00.1: Multiqueue Enabled: Rx Queue count
> = 8, Tx Queue count = 8
> [13920.948927] ixgbe 0000:02:00.1: (PCI Express:5.0GT/s:Width x8)
> 90:e2:ba:37:3b:19
> [13920.949008] ixgbe 0000:02:00.1: MAC: 2, PHY: 14, SFP+: 65535, PBA
> No: E68793-005
> [13920.950237] ixgbe 0000:02:00.1: Intel(R) 10 Gigabit Network
> Connection
>
> And then I get two nice Interfaces. Please apply. :)
>
>
> Best regards,
>
> Stefan Behte
>
> Babiel GmbH
> Moskauer Strasse 27
> D-40227 Düsseldorf
>
> Tel: 0211-179349 0
> Fax: 0211-179349 29
> E-Mail: S.Behte@babiel.com
> Internet: http://www.babiel.com
>
Thanks Stefan, I will make sure that we take a look at the bugzilla.
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ 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