* Re: [ovs-dev] [PATCH v2.39 0/7] MPLS actions and matches
From: Jesse Gross @ 2013-09-13 22:15 UTC (permalink / raw)
To: Ben Pfaff
Cc: Simon Horman, dev@openvswitch.org, netdev, Isaku Yamahata, Ravi K
In-Reply-To: <20130912225439.GH25242@nicira.com>
On Thu, Sep 12, 2013 at 3:54 PM, Ben Pfaff <blp@nicira.com> wrote:
> On Fri, Sep 13, 2013 at 07:56:14AM +0900, Simon Horman wrote:
>> On Thu, Sep 12, 2013 at 12:06:36PM -0700, Ben Pfaff wrote:
>> > I've totally lost track of the status of this patch series. I assume it
>> > needs Jesse's review. Jesse, if I'm wrong about that, let me know and
>> > I'll take a pass at it.
>>
>> My understanding is that you have looked over the approach
>> taken for the non-datapath code and were happy with it in
>> the context that it needed review from Jesse along with the
>> datapath code.
>>
>> I believe it was a few revisions ago that you looked over
>> the series but I don't believe the non-datapath code has changed
>> in a meaningful way since then.
>
> That sounds plausible, thanks for refreshing my memory.
I haven't really reviewed the userspace code but there is one thing in
particular that concerns me: mpls_depth in the flow structure. We
obviously can't be making flow-level decisions on information that the
kernel doesn't include in the flow and I think that it is mostly
vestigial at this point. However, at best the name seems misleading
and at worst could result in someone trying to use information that we
don't really have. Can we fix this somehow? Maybe using the BoS bit?
^ permalink raw reply
* [patch 1/4] drivers/net/ethernet/ibm/ehea/ehea_main.c: add alias entry for portN properties
From: akpm @ 2013-09-13 21:52 UTC (permalink / raw)
To: davem; +Cc: netdev, akpm, ohering, cascardo, jeffm, jslaby
From: Olaf Hering <ohering@suse.com>
Subject: drivers/net/ethernet/ibm/ehea/ehea_main.c: add alias entry for portN properties
Use separate table for alias entries in the ehea module, otherwise the
probe() function will operate on the separate ports instead of the
lhea-"root" entry of the device-tree
Addresses https://bugzilla.novell.com/show_bug.cgi?id=435215
Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Olaf Hering <ohering@suse.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Cc: "David S. Miller" <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
drivers/net/ethernet/ibm/ehea/ehea_main.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
diff -puN drivers/net/ethernet/ibm/ehea/ehea_main.c~drivers-net-ethernet-ibm-ehea-ehea_mainc-add-alias-entry-for-portn-properties drivers/net/ethernet/ibm/ehea/ehea_main.c
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c~drivers-net-ethernet-ibm-ehea-ehea_mainc-add-alias-entry-for-portn-properties
+++ a/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -102,6 +102,19 @@ static int ehea_probe_adapter(struct pla
static int ehea_remove(struct platform_device *dev);
+static struct of_device_id ehea_module_device_table[] = {
+ {
+ .name = "lhea",
+ .compatible = "IBM,lhea",
+ },
+ {
+ .type = "network",
+ .compatible = "IBM,lhea-ethernet",
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, ehea_module_device_table);
+
static struct of_device_id ehea_device_table[] = {
{
.name = "lhea",
@@ -109,7 +122,6 @@ static struct of_device_id ehea_device_t
},
{},
};
-MODULE_DEVICE_TABLE(of, ehea_device_table);
static struct platform_driver ehea_driver = {
.driver = {
_
^ permalink raw reply
* RE: GRE support for IPv6
From: Templin, Fred L @ 2013-09-13 22:37 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Hannes Frederic Sowa, netdev@vger.kernel.org, xeb@mail.ru
In-Reply-To: <20130913150626.5f9ecc3b@samsung-9>
[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]
Hi Stephen,
See attached for the patches as applied to iproute2-3.10.0.
The code compiles cleanly - testing is in progress.
Thanks - Fred
> -----Original Message-----
> From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> Sent: Friday, September 13, 2013 3:06 PM
> To: Stephen Hemminger
> Cc: Hannes Frederic Sowa; Templin, Fred L; netdev@vger.kernel.org;
> xeb@mail.ru
> Subject: Re: GRE support for IPv6
>
> On Fri, 13 Sep 2013 14:46:30 -0700
> Stephen Hemminger <stephen@networkplumber.org> wrote:
>
> > On Fri, 13 Sep 2013 23:01:05 +0200
> > Hannes Frederic Sowa <hannes@stressinduktion.org> wrote:
> >
> > > On Fri, Sep 13, 2013 at 06:32:53PM +0000, Templin, Fred L wrote:
> > > > Someone recently added the module ./net/ipv6/ip6_gre.c to the
> > > > kernel, but I cannot find any obvious way to configure it using
> > > > iproute2. Is there any userland code available for turning on
> > > > GRE tunnels for IPv6?
> > >
> > > I guess it got lost somehow:
> > >
> > > http://patchwork.ozlabs.org/patch/173836/
>
> That patch is out of date and does not apply cleanly to current
> iproute2
[-- Attachment #2: ip6_gre.diffs --]
[-- Type: application/octet-stream, Size: 19470 bytes --]
--- ip/Makefile.orig 2013-09-13 15:21:45.628514535 -0700
+++ ip/Makefile 2013-09-13 14:32:35.726300427 -0700
@@ -5,7 +5,7 @@
iplink_vlan.o link_veth.o link_gre.o iplink_can.o \
iplink_macvlan.o iplink_macvtap.o ipl2tp.o link_vti.o \
iplink_vxlan.o tcp_metrics.o iplink_ipoib.o ipnetconf.o link_ip6tnl.o \
- link_iptnl.o
+ link_iptnl.o link_gre6.o
RTMONOBJ=rtmon.o
--- ip/ip6tunnel.c.orig 2013-09-13 15:31:09.236580387 -0700
+++ ip/ip6tunnel.c 2013-09-13 15:22:49.273425396 -0700
@@ -48,11 +48,12 @@
static void usage(void)
{
fprintf(stderr, "Usage: ip -f inet6 tunnel { add | change | del | show } [ NAME ]\n");
- fprintf(stderr, " [ mode { ip6ip6 | ipip6 | any } ]\n");
+ fprintf(stderr, " [ mode { ip6ip6 | ipip6 | ip6gre | any } ]\n");
fprintf(stderr, " [ remote ADDR local ADDR ] [ dev PHYS_DEV ]\n");
fprintf(stderr, " [ encaplimit ELIM ]\n");
fprintf(stderr ," [ hoplimit TTL ] [ tclass TCLASS ] [ flowlabel FLOWLABEL ]\n");
fprintf(stderr, " [ dscp inherit ]\n");
+ fprintf(stderr, " [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]\n");
fprintf(stderr, "\n");
fprintf(stderr, "Where: NAME := STRING\n");
fprintf(stderr, " ADDR := IPV6_ADDRESS\n");
@@ -62,10 +63,11 @@
DEFAULT_TNL_HOP_LIMIT);
fprintf(stderr, " TCLASS := { 0x0..0xff | inherit }\n");
fprintf(stderr, " FLOWLABEL := { 0x0..0xfffff | inherit }\n");
+ fprintf(stderr, " KEY := { DOTTED_QUAD | NUMBER }\n");
exit(-1);
}
-static void print_tunnel(struct ip6_tnl_parm *p)
+static void print_tunnel(struct ip6_tnl_parm2 *p)
{
char remote[64];
char local[64];
@@ -104,9 +106,29 @@
if (p->flags & IP6_TNL_F_RCV_DSCP_COPY)
printf(" dscp inherit");
+
+ if (p->proto == IPPROTO_GRE) {
+ if ((p->i_flags&GRE_KEY) && (p->o_flags&GRE_KEY) && p->o_key == p->i_key)
+ printf(" key %u", ntohl(p->i_key));
+ else if ((p->i_flags|p->o_flags)&GRE_KEY) {
+ if (p->i_flags&GRE_KEY)
+ printf(" ikey %u ", ntohl(p->i_key));
+ if (p->o_flags&GRE_KEY)
+ printf(" okey %u ", ntohl(p->o_key));
+ }
+
+ if (p->i_flags&GRE_SEQ)
+ printf("%s Drop packets out of sequence.\n", _SL_);
+ if (p->i_flags&GRE_CSUM)
+ printf("%s Checksum in received packet is required.", _SL_);
+ if (p->o_flags&GRE_SEQ)
+ printf("%s Sequence packets on output.", _SL_);
+ if (p->o_flags&GRE_CSUM)
+ printf("%s Checksum output packets.", _SL_);
+ }
}
-static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm *p)
+static int parse_args(int argc, char **argv, int cmd, struct ip6_tnl_parm2 *p)
{
int count = 0;
char medium[IFNAMSIZ];
@@ -124,6 +146,9 @@
strcmp(*argv, "ipip6") == 0 ||
strcmp(*argv, "ip4ip6") == 0)
p->proto = IPPROTO_IPIP;
+ else if (strcmp(*argv, "ip6gre") == 0 ||
+ strcmp(*argv, "gre/ipv6") == 0)
+ p->proto = IPPROTO_GRE;
else if (strcmp(*argv, "any/ipv6") == 0 ||
strcmp(*argv, "any") == 0)
p->proto = 0;
@@ -202,6 +227,60 @@
if (strcmp(*argv, "inherit") != 0)
invarg("not inherit", *argv);
p->flags |= IP6_TNL_F_RCV_DSCP_COPY;
+ } else if (strcmp(*argv, "key") == 0) {
+ unsigned uval;
+ NEXT_ARG();
+ p->i_flags |= GRE_KEY;
+ p->o_flags |= GRE_KEY;
+ if (strchr(*argv, '.'))
+ p->i_key = p->o_key = get_addr32(*argv);
+ else {
+ if (get_unsigned(&uval, *argv, 0)<0) {
+ fprintf(stderr, "invalid value of \"key\"\n");
+ exit(-1);
+ }
+ p->i_key = p->o_key = htonl(uval);
+ }
+ } else if (strcmp(*argv, "ikey") == 0) {
+ unsigned uval;
+ NEXT_ARG();
+ p->i_flags |= GRE_KEY;
+ if (strchr(*argv, '.'))
+ p->i_key = get_addr32(*argv);
+ else {
+ if (get_unsigned(&uval, *argv, 0)<0) {
+ fprintf(stderr, "invalid value of \"ikey\"\n");
+ exit(-1);
+ }
+ p->i_key = htonl(uval);
+ }
+ } else if (strcmp(*argv, "okey") == 0) {
+ unsigned uval;
+ NEXT_ARG();
+ p->o_flags |= GRE_KEY;
+ if (strchr(*argv, '.'))
+ p->o_key = get_addr32(*argv);
+ else {
+ if (get_unsigned(&uval, *argv, 0)<0) {
+ fprintf(stderr, "invalid value of \"okey\"\n");
+ exit(-1);
+ }
+ p->o_key = htonl(uval);
+ }
+ } else if (strcmp(*argv, "seq") == 0) {
+ p->i_flags |= GRE_SEQ;
+ p->o_flags |= GRE_SEQ;
+ } else if (strcmp(*argv, "iseq") == 0) {
+ p->i_flags |= GRE_SEQ;
+ } else if (strcmp(*argv, "oseq") == 0) {
+ p->o_flags |= GRE_SEQ;
+ } else if (strcmp(*argv, "csum") == 0) {
+ p->i_flags |= GRE_CSUM;
+ p->o_flags |= GRE_CSUM;
+ } else if (strcmp(*argv, "icsum") == 0) {
+ p->i_flags |= GRE_CSUM;
+ } else if (strcmp(*argv, "ocsum") == 0) {
+ p->o_flags |= GRE_CSUM;
} else {
if (strcmp(*argv, "name") == 0) {
NEXT_ARG();
@@ -212,7 +291,7 @@
duparg2("name", *argv);
strncpy(p->name, *argv, IFNAMSIZ - 1);
if (cmd == SIOCCHGTUNNEL && count == 0) {
- struct ip6_tnl_parm old_p;
+ struct ip6_tnl_parm2 old_p;
memset(&old_p, 0, sizeof(old_p));
if (tnl_get_ioctl(*argv, &old_p))
return -1;
@@ -230,7 +309,7 @@
return 0;
}
-static void ip6_tnl_parm_init(struct ip6_tnl_parm *p, int apply_default)
+static void ip6_tnl_parm_init(struct ip6_tnl_parm2 *p, int apply_default)
{
memset(p, 0, sizeof(*p));
p->proto = IPPROTO_IPV6;
@@ -244,8 +323,8 @@
* @p1: user specified parameter
* @p2: database entry
*/
-static int ip6_tnl_parm_match(const struct ip6_tnl_parm *p1,
- const struct ip6_tnl_parm *p2)
+static int ip6_tnl_parm_match(const struct ip6_tnl_parm2 *p1,
+ const struct ip6_tnl_parm2 *p2)
{
return ((!p1->link || p1->link == p2->link) &&
(!p1->name[0] || strcmp(p1->name, p2->name) == 0) &&
@@ -263,7 +342,7 @@
(!p1->flags || (p1->flags & p2->flags)));
}
-static int do_tunnels_list(struct ip6_tnl_parm *p)
+static int do_tunnels_list(struct ip6_tnl_parm2 *p)
{
char buf[512];
int err = -1;
@@ -287,7 +366,7 @@
rx_fifo, rx_frame,
tx_bytes, tx_packets, tx_errs, tx_drops,
tx_fifo, tx_colls, tx_carrier, rx_multi;
- struct ip6_tnl_parm p1;
+ struct ip6_tnl_parm2 p1;
char *ptr;
buf[sizeof(buf) - 1] = '\0';
@@ -312,10 +391,12 @@
fprintf(stderr, "Failed to get type of \"%s\"\n", name);
continue;
}
- if (type != ARPHRD_TUNNEL6)
+ if (type != ARPHRD_TUNNEL6 && type != ARPHRD_IP6GRE)
continue;
memset(&p1, 0, sizeof(p1));
ip6_tnl_parm_init(&p1, 0);
+ if (type == ARPHRD_IP6GRE)
+ p1.proto = IPPROTO_GRE;
strcpy(p1.name, name);
p1.link = ll_name_to_index(p1.name);
if (p1.link == 0)
@@ -346,7 +427,7 @@
static int do_show(int argc, char **argv)
{
- struct ip6_tnl_parm p;
+ struct ip6_tnl_parm2 p;
ll_init_map(&rth);
ip6_tnl_parm_init(&p, 0);
@@ -369,28 +450,44 @@
static int do_add(int cmd, int argc, char **argv)
{
- struct ip6_tnl_parm p;
+ struct ip6_tnl_parm2 p;
ip6_tnl_parm_init(&p, 1);
if (parse_args(argc, argv, cmd, &p) < 0)
return -1;
- return tnl_add_ioctl(cmd,
- cmd == SIOCCHGTUNNEL && p.name[0] ?
- p.name : "ip6tnl0", p.name, &p);
+ switch (p.proto) {
+ case IPPROTO_IPIP:
+ case IPPROTO_IPV6:
+ return tnl_add_ioctl(cmd, "ip6tnl0", p.name, &p);
+ case IPPROTO_GRE:
+ return tnl_add_ioctl(cmd, "ip6gre0", p.name, &p);
+ default:
+ fprintf(stderr, "cannot determine tunnel mode (ip6ip6, ipip6 or gre)\n");
+ }
+ return -1;
}
static int do_del(int argc, char **argv)
{
- struct ip6_tnl_parm p;
+ struct ip6_tnl_parm2 p;
ip6_tnl_parm_init(&p, 1);
if (parse_args(argc, argv, SIOCDELTUNNEL, &p) < 0)
return -1;
- return tnl_del_ioctl(p.name[0] ? p.name : "ip6tnl0", p.name, &p);
+ switch (p.proto) {
+ case IPPROTO_IPIP:
+ case IPPROTO_IPV6:
+ return tnl_del_ioctl("ip6tnl0", p.name, &p);
+ case IPPROTO_GRE:
+ return tnl_del_ioctl("ip6gre0", p.name, &p);
+ default:
+ return tnl_del_ioctl(p.name, p.name, &p);
+ }
+ return -1;
}
int do_ip6tunnel(int argc, char **argv)
--- ip/link_gre6.c.orig 2013-09-13 15:26:29.992583461 -0700
+++ ip/link_gre6.c 2013-09-13 14:29:13.379403261 -0700
@@ -0,0 +1,397 @@
+/*
+ * link_gre.c gre driver module
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ *
+ * Authors: Herbert Xu <herbert@gondor.apana.org.au>
+ *
+ */
+
+#include <string.h>
+#include <net/if.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <arpa/inet.h>
+
+#include <linux/ip.h>
+#include <linux/if_tunnel.h>
+#include <linux/ip6_tunnel.h>
+
+#include "rt_names.h"
+#include "utils.h"
+#include "ip_common.h"
+#include "tunnel.h"
+
+#define IP6_FLOWINFO_TCLASS htonl(0x0FF00000)
+#define IP6_FLOWINFO_FLOWLABEL htonl(0x000FFFFF)
+
+#define DEFAULT_TNL_HOP_LIMIT (64)
+
+static void usage(void) __attribute__((noreturn));
+static void usage(void)
+{
+ fprintf(stderr, "Usage: ip link { add | set | change | replace | del } NAME\n");
+ fprintf(stderr, " type { ip6gre | ip6gretap } [ remote ADDR ] [ local ADDR ]\n");
+ fprintf(stderr, " [ [i|o]seq ] [ [i|o]key KEY ] [ [i|o]csum ]\n");
+ fprintf(stderr, " [ hoplimit TTL ] [ encaplimit ELIM ]\n");
+ fprintf(stderr, " [ tclass TCLASS ] [ flowlabel FLOWLABEL ]\n");
+ fprintf(stderr, " [ dscp inherit ] [ dev PHYS_DEV ]\n");
+ fprintf(stderr, "\n");
+ fprintf(stderr, "Where: NAME := STRING\n");
+ fprintf(stderr, " ADDR := IPV6_ADDRESS\n");
+ fprintf(stderr, " TTL := { 0..255 } (default=%d)\n",
+ DEFAULT_TNL_HOP_LIMIT);
+ fprintf(stderr, " KEY := { DOTTED_QUAD | NUMBER }\n");
+ fprintf(stderr, " ELIM := { none | 0..255 }(default=%d)\n",
+ IPV6_DEFAULT_TNL_ENCAP_LIMIT);
+ fprintf(stderr, " FLOWLABEL := { 0x0..0xfffff | inherit }\n");
+ exit(-1);
+}
+
+static int gre_parse_opt(struct link_util *lu, int argc, char **argv,
+ struct nlmsghdr *n)
+{
+ struct {
+ struct nlmsghdr n;
+ struct ifinfomsg i;
+ char buf[1024];
+ } req;
+ struct ifinfomsg *ifi = (struct ifinfomsg *)(n + 1);
+ struct rtattr *tb[IFLA_MAX + 1];
+ struct rtattr *linkinfo[IFLA_INFO_MAX+1];
+ struct rtattr *greinfo[IFLA_GRE_MAX + 1];
+ __u16 iflags = 0;
+ __u16 oflags = 0;
+ unsigned ikey = 0;
+ unsigned okey = 0;
+ struct in6_addr raddr = IN6ADDR_ANY_INIT;
+ struct in6_addr laddr = IN6ADDR_ANY_INIT;
+ unsigned link = 0;
+ unsigned flowinfo = 0;
+ unsigned flags = 0;
+ __u8 hop_limit = DEFAULT_TNL_HOP_LIMIT;
+ __u8 encap_limit = IPV6_DEFAULT_TNL_ENCAP_LIMIT;
+ int len;
+
+ if (!(n->nlmsg_flags & NLM_F_CREATE)) {
+ memset(&req, 0, sizeof(req));
+
+ req.n.nlmsg_len = NLMSG_LENGTH(sizeof(*ifi));
+ req.n.nlmsg_flags = NLM_F_REQUEST;
+ req.n.nlmsg_type = RTM_GETLINK;
+ req.i.ifi_family = preferred_family;
+ req.i.ifi_index = ifi->ifi_index;
+
+ if (rtnl_talk(&rth, &req.n, 0, 0, &req.n) < 0) {
+get_failed:
+ fprintf(stderr,
+ "Failed to get existing tunnel info.\n");
+ return -1;
+ }
+
+ len = req.n.nlmsg_len;
+ len -= NLMSG_LENGTH(sizeof(*ifi));
+ if (len < 0)
+ goto get_failed;
+
+ parse_rtattr(tb, IFLA_MAX, IFLA_RTA(&req.i), len);
+
+ if (!tb[IFLA_LINKINFO])
+ goto get_failed;
+
+ parse_rtattr_nested(linkinfo, IFLA_INFO_MAX, tb[IFLA_LINKINFO]);
+
+ if (!linkinfo[IFLA_INFO_DATA])
+ goto get_failed;
+
+ parse_rtattr_nested(greinfo, IFLA_GRE_MAX,
+ linkinfo[IFLA_INFO_DATA]);
+
+ if (greinfo[IFLA_GRE_IKEY])
+ ikey = rta_getattr_u32(greinfo[IFLA_GRE_IKEY]);
+
+ if (greinfo[IFLA_GRE_OKEY])
+ okey = rta_getattr_u32(greinfo[IFLA_GRE_OKEY]);
+
+ if (greinfo[IFLA_GRE_IFLAGS])
+ iflags = rta_getattr_u16(greinfo[IFLA_GRE_IFLAGS]);
+
+ if (greinfo[IFLA_GRE_OFLAGS])
+ oflags = rta_getattr_u16(greinfo[IFLA_GRE_OFLAGS]);
+
+ if (greinfo[IFLA_GRE_LOCAL])
+ memcpy(&laddr, RTA_DATA(greinfo[IFLA_GRE_LOCAL]), sizeof(laddr));
+
+ if (greinfo[IFLA_GRE_REMOTE])
+ memcpy(&raddr, RTA_DATA(greinfo[IFLA_GRE_REMOTE]), sizeof(raddr));
+
+ if (greinfo[IFLA_GRE_TTL])
+ hop_limit = rta_getattr_u8(greinfo[IFLA_GRE_TTL]);
+
+ if (greinfo[IFLA_GRE_LINK])
+ link = rta_getattr_u32(greinfo[IFLA_GRE_LINK]);
+
+ if (greinfo[IFLA_GRE_ENCAP_LIMIT])
+ encap_limit = rta_getattr_u8(greinfo[IFLA_GRE_ENCAP_LIMIT]);
+
+ if (greinfo[IFLA_GRE_FLOWINFO])
+ flowinfo = rta_getattr_u32(greinfo[IFLA_GRE_FLOWINFO]);
+
+ if (greinfo[IFLA_GRE_FLAGS])
+ flags = rta_getattr_u32(greinfo[IFLA_GRE_FLAGS]);
+ }
+
+ while (argc > 0) {
+ if (!matches(*argv, "key")) {
+ unsigned uval;
+
+ NEXT_ARG();
+ iflags |= GRE_KEY;
+ oflags |= GRE_KEY;
+ if (strchr(*argv, '.'))
+ uval = get_addr32(*argv);
+ else {
+ if (get_unsigned(&uval, *argv, 0) < 0) {
+ fprintf(stderr,
+ "Invalid value for \"key\"\n");
+ exit(-1);
+ }
+ uval = htonl(uval);
+ }
+
+ ikey = okey = uval;
+ } else if (!matches(*argv, "ikey")) {
+ unsigned uval;
+
+ NEXT_ARG();
+ iflags |= GRE_KEY;
+ if (strchr(*argv, '.'))
+ uval = get_addr32(*argv);
+ else {
+ if (get_unsigned(&uval, *argv, 0)<0) {
+ fprintf(stderr, "invalid value of \"ikey\"\n");
+ exit(-1);
+ }
+ uval = htonl(uval);
+ }
+ ikey = uval;
+ } else if (!matches(*argv, "okey")) {
+ unsigned uval;
+
+ NEXT_ARG();
+ oflags |= GRE_KEY;
+ if (strchr(*argv, '.'))
+ uval = get_addr32(*argv);
+ else {
+ if (get_unsigned(&uval, *argv, 0)<0) {
+ fprintf(stderr, "invalid value of \"okey\"\n");
+ exit(-1);
+ }
+ uval = htonl(uval);
+ }
+ okey = uval;
+ } else if (!matches(*argv, "seq")) {
+ iflags |= GRE_SEQ;
+ oflags |= GRE_SEQ;
+ } else if (!matches(*argv, "iseq")) {
+ iflags |= GRE_SEQ;
+ } else if (!matches(*argv, "oseq")) {
+ oflags |= GRE_SEQ;
+ } else if (!matches(*argv, "csum")) {
+ iflags |= GRE_CSUM;
+ oflags |= GRE_CSUM;
+ } else if (!matches(*argv, "icsum")) {
+ iflags |= GRE_CSUM;
+ } else if (!matches(*argv, "ocsum")) {
+ oflags |= GRE_CSUM;
+ } else if (!matches(*argv, "remote")) {
+ inet_prefix addr;
+ NEXT_ARG();
+ get_prefix(&addr, *argv, preferred_family);
+ if (addr.family == AF_UNSPEC)
+ invarg("\"remote\" address family is AF_UNSPEC", *argv);
+ memcpy(&raddr, &addr.data, sizeof(raddr));
+ } else if (!matches(*argv, "local")) {
+ inet_prefix addr;
+ NEXT_ARG();
+ get_prefix(&addr, *argv, preferred_family);
+ if (addr.family == AF_UNSPEC)
+ invarg("\"local\" address family is AF_UNSPEC", *argv);
+ memcpy(&laddr, &addr.data, sizeof(laddr));
+ } else if (!matches(*argv, "dev")) {
+ NEXT_ARG();
+ link = if_nametoindex(*argv);
+ if (link == 0)
+ exit(-1);
+ } else if (!matches(*argv, "ttl") ||
+ !matches(*argv, "hoplimit")) {
+ __u8 uval;
+ NEXT_ARG();
+ if (get_u8(&uval, *argv, 0))
+ invarg("invalid TTL", *argv);
+ hop_limit = uval;
+ } else if (!matches(*argv, "tos") ||
+ !matches(*argv, "tclass") ||
+ !matches(*argv, "dsfield")) {
+ __u8 uval;
+ NEXT_ARG();
+ if (strcmp(*argv, "inherit") == 0)
+ flags |= IP6_TNL_F_USE_ORIG_TCLASS;
+ else {
+ if (get_u8(&uval, *argv, 16))
+ invarg("invalid TClass", *argv);
+ flowinfo |= htonl((__u32)uval << 20) & IP6_FLOWINFO_TCLASS;
+ flags &= ~IP6_TNL_F_USE_ORIG_TCLASS;
+ }
+ } else if (strcmp(*argv, "flowlabel") == 0 ||
+ strcmp(*argv, "fl") == 0) {
+ __u32 uval;
+ NEXT_ARG();
+ if (strcmp(*argv, "inherit") == 0)
+ flags |= IP6_TNL_F_USE_ORIG_FLOWLABEL;
+ else {
+ if (get_u32(&uval, *argv, 16))
+ invarg("invalid Flowlabel", *argv);
+ if (uval > 0xFFFFF)
+ invarg("invalid Flowlabel", *argv);
+ flowinfo |= htonl(uval) & IP6_FLOWINFO_FLOWLABEL;
+ flags &= ~IP6_TNL_F_USE_ORIG_FLOWLABEL;
+ }
+ } else if (strcmp(*argv, "dscp") == 0) {
+ NEXT_ARG();
+ if (strcmp(*argv, "inherit") != 0)
+ invarg("not inherit", *argv);
+ flags |= IP6_TNL_F_RCV_DSCP_COPY;
+ } else
+ usage();
+ argc--; argv++;
+ }
+
+ addattr32(n, 1024, IFLA_GRE_IKEY, ikey);
+ addattr32(n, 1024, IFLA_GRE_OKEY, okey);
+ addattr_l(n, 1024, IFLA_GRE_IFLAGS, &iflags, 2);
+ addattr_l(n, 1024, IFLA_GRE_OFLAGS, &oflags, 2);
+ addattr_l(n, 1024, IFLA_GRE_LOCAL, &laddr, sizeof(laddr));
+ addattr_l(n, 1024, IFLA_GRE_REMOTE, &raddr, sizeof(raddr));
+ if (link)
+ addattr32(n, 1024, IFLA_GRE_LINK, link);
+ addattr_l(n, 1024, IFLA_GRE_TTL, &hop_limit, 1);
+ addattr_l(n, 1024, IFLA_GRE_ENCAP_LIMIT, &encap_limit, 1);
+ addattr_l(n, 1024, IFLA_GRE_FLOWINFO, &flowinfo, 4);
+ addattr_l(n, 1024, IFLA_GRE_FLAGS, &flowinfo, 4);
+
+ return 0;
+}
+
+static void gre_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[])
+{
+ char s1[1024];
+ char s2[64];
+ const char *local = "any";
+ const char *remote = "any";
+ unsigned iflags = 0;
+ unsigned oflags = 0;
+ unsigned flags = 0;
+ unsigned flowinfo = 0;
+ struct in6_addr in6_addr_any = IN6ADDR_ANY_INIT;
+
+ if (!tb)
+ return;
+
+ if (tb[IFLA_GRE_FLAGS])
+ flags = rta_getattr_u32(tb[IFLA_GRE_FLAGS]);
+
+ if (tb[IFLA_GRE_FLOWINFO])
+ flags = rta_getattr_u32(tb[IFLA_GRE_FLOWINFO]);
+
+ if (tb[IFLA_GRE_REMOTE]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_GRE_REMOTE]), sizeof(addr));
+
+ if (memcmp(&addr, &in6_addr_any, sizeof(addr)))
+ remote = format_host(AF_INET6, sizeof(addr), &addr, s1, sizeof(s1));
+ }
+
+ fprintf(f, "remote %s ", remote);
+
+ if (tb[IFLA_GRE_LOCAL]) {
+ struct in6_addr addr;
+ memcpy(&addr, RTA_DATA(tb[IFLA_GRE_LOCAL]), sizeof(addr));
+
+ if (memcmp(&addr, &in6_addr_any, sizeof(addr)))
+ local = format_host(AF_INET6, sizeof(addr), &addr, s1, sizeof(s1));
+ }
+
+ fprintf(f, "local %s ", local);
+
+ if (tb[IFLA_GRE_LINK] && rta_getattr_u32(tb[IFLA_GRE_LINK])) {
+ unsigned link = rta_getattr_u32(tb[IFLA_GRE_LINK]);
+ const char *n = if_indextoname(link, s2);
+
+ if (n)
+ fprintf(f, "dev %s ", n);
+ else
+ fprintf(f, "dev %u ", link);
+ }
+
+ if (tb[IFLA_GRE_TTL] && rta_getattr_u8(tb[IFLA_GRE_TTL]))
+ fprintf(f, "hoplimit %d ", rta_getattr_u8(tb[IFLA_GRE_TTL]));
+
+ if (flags & IP6_TNL_F_IGN_ENCAP_LIMIT)
+ fprintf(f, "encaplimit none ");
+ else if (tb[IFLA_GRE_ENCAP_LIMIT]) {
+ int encap_limit = rta_getattr_u8(tb[IFLA_GRE_ENCAP_LIMIT]);
+
+ fprintf(f, "encaplimit %d ", encap_limit);
+ }
+
+ if (flags & IP6_TNL_F_USE_ORIG_FLOWLABEL)
+ fprintf(f, "flowlabel inherit ");
+ else
+ fprintf(f, "flowlabel 0x%05x ", ntohl(flowinfo & IP6_FLOWINFO_FLOWLABEL));
+
+ if (flags & IP6_TNL_F_RCV_DSCP_COPY)
+ fprintf(f, "dscp inherit ");
+
+ if (tb[IFLA_GRE_IFLAGS])
+ iflags = rta_getattr_u16(tb[IFLA_GRE_IFLAGS]);
+
+ if (tb[IFLA_GRE_OFLAGS])
+ oflags = rta_getattr_u16(tb[IFLA_GRE_OFLAGS]);
+
+ if ((iflags & GRE_KEY) && tb[IFLA_GRE_IKEY]) {
+ inet_ntop(AF_INET, RTA_DATA(tb[IFLA_GRE_IKEY]), s2, sizeof(s2));
+ fprintf(f, "ikey %s ", s2);
+ }
+
+ if ((oflags & GRE_KEY) && tb[IFLA_GRE_OKEY]) {
+ inet_ntop(AF_INET, RTA_DATA(tb[IFLA_GRE_OKEY]), s2, sizeof(s2));
+ fprintf(f, "okey %s ", s2);
+ }
+
+ if (iflags & GRE_SEQ)
+ fputs("iseq ", f);
+ if (oflags & GRE_SEQ)
+ fputs("oseq ", f);
+ if (iflags & GRE_CSUM)
+ fputs("icsum ", f);
+ if (oflags & GRE_CSUM)
+ fputs("ocsum ", f);
+}
+
+struct link_util ip6gre_link_util = {
+ .id = "ip6gre",
+ .maxattr = IFLA_GRE_MAX,
+ .parse_opt = gre_parse_opt,
+ .print_opt = gre_print_opt,
+};
+
+struct link_util ip6gretap_link_util = {
+ .id = "ip6gretap",
+ .maxattr = IFLA_GRE_MAX,
+ .parse_opt = gre_parse_opt,
+ .print_opt = gre_print_opt,
+};
^ permalink raw reply
* RE: GRE support for IPv6
From: Templin, Fred L @ 2013-09-13 23:21 UTC (permalink / raw)
To: Templin, Fred L, Stephen Hemminger
Cc: Hannes Frederic Sowa, netdev@vger.kernel.org, xeb@mail.ru
In-Reply-To: <2134F8430051B64F815C691A62D98318108F59@XCH-BLV-504.nw.nos.boeing.com>
> The code compiles cleanly - testing is in progress.
It works.
Fred
> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org] On Behalf Of Templin, Fred L
> Sent: Friday, September 13, 2013 3:37 PM
> To: Stephen Hemminger
> Cc: Hannes Frederic Sowa; netdev@vger.kernel.org; xeb@mail.ru
> Subject: RE: GRE support for IPv6
>
> Hi Stephen,
>
> See attached for the patches as applied to iproute2-3.10.0.
> The code compiles cleanly - testing is in progress.
>
> Thanks - Fred
>
> > -----Original Message-----
> > From: Stephen Hemminger [mailto:stephen@networkplumber.org]
> > Sent: Friday, September 13, 2013 3:06 PM
> > To: Stephen Hemminger
> > Cc: Hannes Frederic Sowa; Templin, Fred L; netdev@vger.kernel.org;
> > xeb@mail.ru
> > Subject: Re: GRE support for IPv6
> >
> > On Fri, 13 Sep 2013 14:46:30 -0700
> > Stephen Hemminger <stephen@networkplumber.org> wrote:
> >
> > > On Fri, 13 Sep 2013 23:01:05 +0200
> > > Hannes Frederic Sowa <hannes@stressinduktion.org> wrote:
> > >
> > > > On Fri, Sep 13, 2013 at 06:32:53PM +0000, Templin, Fred L wrote:
> > > > > Someone recently added the module ./net/ipv6/ip6_gre.c to the
> > > > > kernel, but I cannot find any obvious way to configure it using
> > > > > iproute2. Is there any userland code available for turning on
> > > > > GRE tunnels for IPv6?
> > > >
> > > > I guess it got lost somehow:
> > > >
> > > > http://patchwork.ozlabs.org/patch/173836/
> >
> > That patch is out of date and does not apply cleanly to current
> > iproute2
^ permalink raw reply
* Re: [net 0/6][pull request] Intel Wired LAN Driver Updates
From: David Miller @ 2013-09-13 23:37 UTC (permalink / raw)
To: jeffrey.t.kirsher; +Cc: netdev, gospo, sassmann
In-Reply-To: <1379106730-14994-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Date: Fri, 13 Sep 2013 14:12:04 -0700
> This series contains updates to ixgbe and e1000e.
>
> Jacob provides a ixgbe patch to fix the configure_rx patch to properly
> disable RSC hardware logic when a user disables it. Previously we only
> disabled RSC in the queue settings, but this does not fully disable
> hardware RSC logic which can lead to unexpected performance issues.
>
> Emil provides three fixes for ixgbe. First fixes the ethtool loopback
> test when DCB is enabled, where the frames may be modified on Tx
> (by adding VLAN tag) which will fail the check on receive. Then a fix
> for QSFP+ modules, limit the speed setting to advertise only one speed
> at a time since the QSFP+ modules do not support auto negotiation.
> Lastly, resolve an issue where the driver will display incorrect info
> for QSFP+ modules that were inserted after the driver has been loaded.
>
> David Ertman provides to fixes for e1000e, one removes a comparison to
> the boolean value true where evaluating the lvalue will produce the
> same result. The other fixes an error in the calculation of the
> rar_entry_count, which causes a write of unkown/undefined register
> space in the MAC to unknown/undefined register space in the PHY.
Pulled, thanks Jeff.
^ permalink raw reply
* Re: [patch 1/4] drivers/net/ethernet/ibm/ehea/ehea_main.c: add alias entry for portN properties
From: David Miller @ 2013-09-13 23:58 UTC (permalink / raw)
To: akpm; +Cc: netdev, ohering, cascardo, jeffm, jslaby
In-Reply-To: <20130913215201.6501131C1BF@corp2gmr1-1.hot.corp.google.com>
From: akpm@linux-foundation.org
Date: Fri, 13 Sep 2013 14:52:01 -0700
> From: Olaf Hering <ohering@suse.com>
> Subject: drivers/net/ethernet/ibm/ehea/ehea_main.c: add alias entry for portN properties
>
> Use separate table for alias entries in the ehea module, otherwise the
> probe() function will operate on the separate ports instead of the
> lhea-"root" entry of the device-tree
>
> Addresses https://bugzilla.novell.com/show_bug.cgi?id=435215
>
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>
> Signed-off-by: Olaf Hering <ohering@suse.com>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
This can definitely have consequences and in particular potentially cause
a device to not get probed properly.
Therefore I want an ehea driver maintainer to review and ACK this before
I apply it.
Thanks.
^ permalink raw reply
* Re: [patch 2/4] mISDN: add support for group membership check
From: David Miller @ 2013-09-14 0:00 UTC (permalink / raw)
To: akpm; +Cc: netdev, jeffm, isdn4linux, isdn, jslaby, sergei.shtylyov
In-Reply-To: <20130913215202.7D16C31C1BF@corp2gmr1-1.hot.corp.google.com>
From: akpm@linux-foundation.org
Date: Fri, 13 Sep 2013 14:52:02 -0700
> @@ -612,6 +612,11 @@ data_sock_create(struct net *net, struct
> {
> struct sock *sk;
>
> + if (!capable(CAP_SYS_ADMIN) &&
> + !gid_eq(misdn_permitted_gid, current_gid()) &&
> + !in_group_p(misdn_permitted_gid))
> + return -EPERM;
This and the other conditional need to be styled correctly:
if (a &&
b &&
c)
the object is to get the second and subsequent lines to start at the
first column after the openning parenthesis of the condition, using
the appropriate number of tab and space characters.
^ permalink raw reply
* Re: [patch 3/4] drivers/atm/he.c: convert to module_pci_driver
From: David Miller @ 2013-09-14 0:03 UTC (permalink / raw)
To: akpm; +Cc: netdev, clbchenlibo.chen, chas
In-Reply-To: <20130913215203.B721D31C1BF@corp2gmr1-1.hot.corp.google.com>
From: akpm@linux-foundation.org
Date: Fri, 13 Sep 2013 14:52:03 -0700
> From: Libo Chen <clbchenlibo.chen@huawei.com>
> Subject: drivers/atm/he.c: convert to module_pci_driver
>
> Signed-off-by: Libo Chen <libo.chen@huawei.com>
> Cc: Chas Williams <chas@cmf.nrl.navy.mil>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Applied.
^ permalink raw reply
* Re: [patch 4/4] isdn: clean up debug format string usage
From: David Miller @ 2013-09-14 0:03 UTC (permalink / raw)
To: akpm; +Cc: netdev, keescook, isdn
In-Reply-To: <20130913215204.CD6C031C1FB@corp2gmr1-1.hot.corp.google.com>
From: akpm@linux-foundation.org
Date: Fri, 13 Sep 2013 14:52:04 -0700
> From: Kees Cook <keescook@chromium.org>
> Subject: isdn: clean up debug format string usage
>
> Avoid unneeded local string buffers for constructing debug output. Also
> cleans up debug calls that contain a single parameter so that they cannot
> be accidentally parsed as format strings.
>
> Signed-off-by: Kees Cook <keescook@chromium.org>
> Cc: Karsten Keil <isdn@linux-pingi.de>
> Cc: David Miller <davem@davemloft.net>
> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Applied.
^ permalink raw reply
* Re: [PATCH 1/1] be2net: missing variable initialization
From: David Miller @ 2013-09-14 0:08 UTC (permalink / raw)
To: antonio.alecrim; +Cc: sathya.perla, netdev, linux-kernel
In-Reply-To: <1379091949-4668-1-git-send-email-antonio.alecrim@gmail.com>
From: Antonio Alecrim Jr <antonio.alecrim@gmail.com>
Date: Fri, 13 Sep 2013 14:05:49 -0300
> Signed-off-by: Antonio Alecrim Jr <antonio.alecrim@gmail.com>
Applied, thanks.
^ permalink raw reply
* [PATCH] sh_eth: call phy_scan_fixups() after PHY reset
From: Sergei Shtylyov @ 2013-09-14 0:10 UTC (permalink / raw)
To: netdev; +Cc: nobuhiro.iwamatsu.yj, linux-sh, laurent.pinchart+renesas
Sometimes the PHY reset that sh_eth_phy_start() does effects the PHY registers
registers values of which are vital for the correct functioning of the driver.
Unfortunately, the existing PHY platform fixup mechanism doesn't help here as
it only hooks PHY resets done by ioctl() calls. Calling phy_scan_fixups() from
the driver helps here. With a proper platform fixup, this fixes NFS timeouts on
the SH-Mobile Lager board.
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
This patch is against Dave Miller's 'net.git' tree.
If desired, I can merge it with the Lager platform patch I'll post next, altho
there's only runtime interdependency between them...
drivers/net/ethernet/renesas/sh_eth.c | 5 +++++
1 file changed, 5 insertions(+)
Index: net/drivers/net/ethernet/renesas/sh_eth.c
===================================================================
--- net.orig/drivers/net/ethernet/renesas/sh_eth.c
+++ net/drivers/net/ethernet/renesas/sh_eth.c
@@ -1701,6 +1701,11 @@ static int sh_eth_phy_start(struct net_d
/* reset phy - this also wakes it from PDOWN */
phy_write(mdp->phydev, MII_BMCR, BMCR_RESET);
+ /* some boards need their registers set to non-default state */
+ ret = phy_scan_fixups(mdp->phydev);
+ if (ret)
+ return ret;
+
phy_start(mdp->phydev);
return 0;
^ permalink raw reply
* Re: [PATCH] alx: remove redundant D0 power state set
From: David Miller @ 2013-09-14 0:12 UTC (permalink / raw)
To: wangyijing; +Cc: jcliburn, chris.snook, netdev, guohanjun
In-Reply-To: <1378865220-9368-1-git-send-email-wangyijing@huawei.com>
From: Yijing Wang <wangyijing@huawei.com>
Date: Wed, 11 Sep 2013 10:07:00 +0800
> Pci_enable_device_mem() will set device power state to D0,
> so it's no need to do it again in alx_probe().
> Also remove redundant PM Cap find code, because pci core
> has been saved the pci device pm cap value.
>
> Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Applied, thank you.
^ permalink raw reply
* Re: [PATCH 1/2] bnx2x: Use pci_dev pm_cap
From: David Miller @ 2013-09-14 0:13 UTC (permalink / raw)
To: jdmason; +Cc: netdev, eilong
In-Reply-To: <1378923760-16232-1-git-send-email-jdmason@kudzu.us>
From: Jon Mason <jdmason@kudzu.us>
Date: Wed, 11 Sep 2013 11:22:39 -0700
> Use the already existing pm_cap variable in struct pci_dev for
> determining the power management offset. This saves the driver from
> having to keep track of an extra variable.
>
> Signed-off-by: Jon Mason <jdmason@kudzu.us>
Applied.
^ permalink raw reply
* Re: [PATCH 2/2] tg3: Use pci_dev pm_cap
From: David Miller @ 2013-09-14 0:13 UTC (permalink / raw)
To: jdmason; +Cc: netdev, nsujir, mchan
In-Reply-To: <1378923760-16232-2-git-send-email-jdmason@kudzu.us>
From: Jon Mason <jdmason@kudzu.us>
Date: Wed, 11 Sep 2013 11:22:40 -0700
> Use the already existing pm_cap variable in struct pci_dev for
> determining the power management offset. This saves the driver from
> having to keep track of an extra variable.
>
> Signed-off-by: Jon Mason <jdmason@kudzu.us>
Applied.
^ permalink raw reply
* Re: [PATCH 1/1] net: race condition when removing virtual net_device
From: David Miller @ 2013-09-14 0:16 UTC (permalink / raw)
To: ebiederm; +Cc: fruggeri, edumazet, jiri, alexander.h.duyck, amwang, netdev
In-Reply-To: <87txhp249u.fsf@xmission.com>
From: ebiederm@xmission.com (Eric W. Biederman)
Date: Thu, 12 Sep 2013 13:06:53 -0700
> David, Eric, do any of you know why we have this netdevice notfier
> rebroadcast?
It's been there as long as I can remember, but I don't remember
exactly why we do that.
If I had to guess, it's to handle something that has to retry later
due to a "spin_trylock()" or similar type of situation.
Probably best to not remove it. :)
^ permalink raw reply
* [PATCH] ARM: shmobile: Lager: add Micrel KSZ8041 PHY fixup
From: Sergei Shtylyov @ 2013-09-14 0:29 UTC (permalink / raw)
To: horms, linux-sh
Cc: magnus.damm, linux, linux-arm-kernel, laurent.pinchart+renesas,
netdev
Currently on the Lager board NFS timeouts/delays are seen when booting. That
turned out to happen because the SoC's ETH_LINK signal turns on and off after
each packet. It is connected to Micrel KSZ8041 PHY's LED0 signal. Ether LEDs
on the Lager board are named LINK and ACTIVE which corresponds to non-default
01 setting of the PHY control register 1 bits 14-15. The 'sh_eth' driver resets
the PHY when opening the network device, so we have to set the mentioned bits
back to 01 from the default 00 value which causes bouncing of ETH_LINK. That
can be achieved using the PHY platform fixup mechanism if we also modify the
driver to use it..
Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>
---
This patch is against the recent Linus' tree. Its effect on NFS issue depends
on the 'sh_eth' driver patch I've posted earlier.
Simon, please update your 'master' and/or 'fixes' branches since currently it's
impossible to apply fixes to your tree.
arch/arm/mach-shmobile/board-lager.c | 27 ++++++++++++++++++++++++++-
1 file changed, 26 insertions(+), 1 deletion(-)
Index: linux/arch/arm/mach-shmobile/board-lager.c
===================================================================
--- linux.orig/arch/arm/mach-shmobile/board-lager.c
+++ linux/arch/arm/mach-shmobile/board-lager.c
@@ -29,6 +29,7 @@
#include <linux/pinctrl/machine.h>
#include <linux/platform_data/gpio-rcar.h>
#include <linux/platform_device.h>
+#include <linux/phy.h>
#include <linux/regulator/fixed.h>
#include <linux/regulator/machine.h>
#include <linux/sh_eth.h>
@@ -155,6 +156,30 @@ static void __init lager_add_standard_de
ðer_pdata, sizeof(ether_pdata));
}
+/*
+ * Ether LEDs on the Lager board are named LINK and ACTIVE which corresponds
+ * to non-default 01 setting of the Micrel KSZ8041 PHY control register 1 bits
+ * 14-15. We have to set them back to 01 from the default 00 value each time
+ * the PHY is reset. It's also important because the PHY's LED0 signal is
+ * connected to SoC's ETH_LINK signal and in the PHY's default mode it will
+ * bounce on and off after each packet, which we apparently want to avoid.
+ */
+static int lager_ksz8041_fixup(struct phy_device *phydev)
+{
+ u16 phyctrl1 = phy_read(phydev, 0x1e);
+
+ phyctrl1 &= ~0xc000;
+ phyctrl1 |= 0x4000;
+ return phy_write(phydev, 0x1e, phyctrl1);
+}
+
+static void __init lager_init(void)
+{
+ lager_add_standard_devices();
+
+ phy_register_fixup_for_id("r8a7790-ether-ff:01", lager_ksz8041_fixup);
+}
+
static const char *lager_boards_compat_dt[] __initdata = {
"renesas,lager",
NULL,
@@ -163,6 +188,6 @@ static const char *lager_boards_compat_d
DT_MACHINE_START(LAGER_DT, "lager")
.init_early = r8a7790_init_delay,
.init_time = r8a7790_timer_init,
- .init_machine = lager_add_standard_devices,
+ .init_machine = lager_init,
.dt_compat = lager_boards_compat_dt,
MACHINE_END
^ permalink raw reply
* Re: [PATCH 1/1] net: race condition when removing virtual net_device
From: Eric W. Biederman @ 2013-09-14 1:32 UTC (permalink / raw)
To: David Miller; +Cc: fruggeri, edumazet, jiri, alexander.h.duyck, amwang, netdev
In-Reply-To: <20130913.201626.1381750756413200302.davem@davemloft.net>
David Miller <davem@davemloft.net> writes:
> From: ebiederm@xmission.com (Eric W. Biederman)
> Date: Thu, 12 Sep 2013 13:06:53 -0700
>
>> David, Eric, do any of you know why we have this netdevice notfier
>> rebroadcast?
>
> It's been there as long as I can remember, but I don't remember
> exactly why we do that.
>
> If I had to guess, it's to handle something that has to retry later
> due to a "spin_trylock()" or similar type of situation.
>
> Probably best to not remove it. :)
Since it doesn't completely solve the problem, it isn't worth it to
solve this problem. Sigh
I have added this bit of code and the moving of references to the
loopback device in dst_ifdown to my hitlist of things to sort out some
day when I have plenty time.
Eric
^ permalink raw reply
* Re: [PATCH 1/1] net: race condition when removing virtual net_device
From: Eric W. Biederman @ 2013-09-14 1:46 UTC (permalink / raw)
To: Francesco Ruggeri
Cc: David S. Miller, Eric Dumazet, Jiri Pirko, Alexander Duyck,
Cong Wang, netdev
In-Reply-To: <CA+HUmGjEC8eXT7BHm20uVOagJQbsqO9VZjmGSgmUvnrtEH-JYw@mail.gmail.com>
Francesco Ruggeri <fruggeri@aristanetworks.com> writes:
> On Thu, Sep 12, 2013 at 10:50 PM, Eric W. Biederman
> <ebiederm@xmission.com> wrote:
> To summarize your proposal:
> 1) Remove re-broadcasting of NETDEV_UNREGISTER and
> NETDEV_UNREGISTER_FINAL from netdev_wait_allrefs.
Forget that it isn't needed. It would be nice but since it doesn't
solve the entire problem let's not go there.
> 2) If unregistering a net_device causes unregistering of other virtual
> devices (eg veth, macvlan, vlan) then move the virtual devices to the
> namespace of the original net_device.
>
> I do have some concerns about both correctness and feasibility of this approach.
>
> About 2), namespace dependent operations triggered by unregistering
> the virtual devices (eg rt_flush_dev, dst_dev_event/dst_ifdown and
> probably more) would not be done in the namespaces where they should.
Yes they will. That is what dev_change_net_namespace does.
dev_change_net_namespace would not be correct if it did not do that.
Now dev_change_net_namespace is comparitively expensive so it may not be the
best approach but it is an approach that will work.
> I do urge you to take a second look at the approach that I proposed.
> All it does is make sure that a namespace loopback_dev is not removed
> until any devices unlisted from that namespace are also disposed of.
> That in turn prevents non-device pernet subsystems from exiting that
> namespace in ops_exit_list.
It was worth a second look. I can not find anything wrong with your
patch but I can not convince myself that it is correct either. The
moving around the loopback device in the net dev todo list to prevent
deadlock I can't imagine why you are doing that.
I think I would prefer something more explicit and less likely to break.
Perhaps something that keeps a network namespace from exiting while we
delete devices. Using the loopback device like that looks fragile.
However it is very true that we require the loopback device to stay
around until all of the dst_ifdown calls in a network namespace are
made.
At least my original concern that you could be incrementing the count on
the loop back device when it had already reached zero can't be the case.
It would be very nice to have something that I could think through
easily and was robust to change.
Eric
^ permalink raw reply
* [PATCH] ptp: measure the time offset between PHC and system clock
From: Dong Zhu @ 2013-09-14 8:03 UTC (permalink / raw)
To: Richard Cochran, Rob Landley; +Cc: netdev, linux-doc, linux-kernel
This patch add a method into testptp.c to measure the time offset
between phc and system clock through the ioctl PTP_SYS_OFFSET.
Signed-off-by: Dong Zhu <bluezhudong@gmail.com>
---
Documentation/ptp/testptp.c | 40 ++++++++++++++++++++++++++++++++++++++--
1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/Documentation/ptp/testptp.c b/Documentation/ptp/testptp.c
index f59ded0..72bb030 100644
--- a/Documentation/ptp/testptp.c
+++ b/Documentation/ptp/testptp.c
@@ -112,6 +112,7 @@ static void usage(char *progname)
" -f val adjust the ptp clock frequency by 'val' ppb\n"
" -g get the ptp clock time\n"
" -h prints this message\n"
+ " -k val measure the time offset between PHC and system clock\n"
" -p val enable output with a period of 'val' nanoseconds\n"
" -P val enable or disable (val=1|0) the system clock PPS\n"
" -s set the ptp clock time from the system time\n"
@@ -133,8 +134,12 @@ int main(int argc, char *argv[])
struct itimerspec timeout;
struct sigevent sigevent;
+ struct ptp_clock_time *pct;
+ struct ptp_sys_offset *sysoff;
+
+
char *progname;
- int c, cnt, fd;
+ int i, c, cnt, fd;
char *device = DEVICE;
clockid_t clkid;
@@ -144,6 +149,8 @@ int main(int argc, char *argv[])
int extts = 0;
int gettime = 0;
int oneshot = 0;
+ int offset = 0;
+ int n_samples = 0;
int periodic = 0;
int perout = -1;
int pps = -1;
@@ -151,7 +158,7 @@ int main(int argc, char *argv[])
progname = strrchr(argv[0], '/');
progname = progname ? 1+progname : argv[0];
- while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghp:P:sSt:v"))) {
+ while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghk:p:P:sSt:v"))) {
switch (c) {
case 'a':
oneshot = atoi(optarg);
@@ -174,6 +181,10 @@ int main(int argc, char *argv[])
case 'g':
gettime = 1;
break;
+ case 'k':
+ offset = 1;
+ n_samples = atoi(optarg);
+ break;
case 'p':
perout = atoi(optarg);
break;
@@ -376,6 +387,31 @@ int main(int argc, char *argv[])
}
}
+ if (offset) {
+ sysoff = calloc(1, sizeof(*sysoff));
+ if (!sysoff) {
+ perror("calloc");
+ return -1;
+ }
+ sysoff->n_samples = n_samples;
+
+ if (ioctl(fd, PTP_SYS_OFFSET, sysoff))
+ perror("PTP_SYS_OFFSET");
+ else
+ puts("time offset between PHC and
+ system clock request okay");
+
+ pct = &sysoff->ts[0];
+ for (i = 0; i < sysoff->n_samples; i++, pct++) {
+ printf("system time: %ld.%ld\n", pct->sec, pct->nsec);
+ pct++;
+ printf("phc time: %ld.%ld\n\n", pct->sec, pct->nsec);
+ }
+ printf("system time: %ld.%ld\n", pct->sec, pct->nsec);
+
+ free(sysoff);
+ }
+
close(fd);
return 0;
}
--
1.7.11.7
--
Best Regards,
Dong Zhu
^ permalink raw reply related
* Re: [PATCH v2 1/6] ipv6: del the statements for updating route in (dccp|tcp|sctp)_v6_err
From: Daniel Borkmann @ 2013-09-14 8:20 UTC (permalink / raw)
To: Hannes Frederic Sowa; +Cc: Duan Jiong, davem, netdev, vyasevic, linux-sctp
In-Reply-To: <20130913203721.GB32431@order.stressinduktion.org>
> [added linux-sctp, Daniel and Vlad + full quote]
>
> On Fri, Sep 13, 2013 at 10:58:55AM +0800, Duan Jiong wrote:
> > From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
> >
> > Because we will do route updating for redirect in nidsc layer. And
> > when dealing with redirect message, the dccp and sctp should like
> > tcp return directly.
> >
> > Signed-off-by: Duan Jiong <duanj.fnst@cn.fujitsu.com>
[...]
> Please Cc linux-sctp@vger.kernel.org on the sctp bits in the next round,
> too.
>
> Otherwise I looked at all patches and they seemed fine to me.
>
> Duan, I would suggest the following:
>
> I cannot judge if the patch Daniel proposed regarding EPROTO in sk->sk_err
> on redirects should go to stable. If it should, perhaps this patch should
> go in first and you could later on rebase this series as soon as Daniel's
> patch has landed in the net repo? Only some minor edits should be needed
> then. This way there is a clean patch for stable and David can consider
> taking this in for net or net-next (this fixes a glitch where we do not
> apply redirects generated by packets of ipv6 tunnels, otherwise a bit of
> code removal).
Thanks Hannes !
I'm on travel over the weekend and mostly offline, so I'll look into this
on right on Monday morning.
Cheers and thanks,
Daniel
^ permalink raw reply
* Re: [PATCH net 0/3] SLCAN/SLIP fixes and performance
From: Marc Kleine-Budde @ 2013-09-14 10:45 UTC (permalink / raw)
To: Andre Naujoks; +Cc: davem, linux-can, netdev, linux-kernel
In-Reply-To: <1379093833-4949-1-git-send-email-nautsch2@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 988 bytes --]
On 09/13/2013 07:37 PM, Andre Naujoks wrote:
> Hi Dave,
>
> these are some loosely related patches, that fix an ancient locking problem in
> the slip and slcan drivers, add general ASCII-HEX to bin functions for
> uppercase ASCII, fix the handling of CAN RTR frames in the slcan driver
Can you get an Acked-by for the ASCII-HEX functions from the appropriate
maintainer?
> and increase the performance for the slcan driver.
>
> As these patches mainly contain fixes for the slip/slcan drivers that require
> a tty layer fix included in 3.11, I would suggest to get the patches in via
> the net tree for the 3.12 cycle. They should apply properly on the latest net
> and mainline tree.
Marc
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 259 bytes --]
^ permalink raw reply
* Re: [PATCH net 0/3] SLCAN/SLIP fixes and performance
From: Andre Naujoks @ 2013-09-14 11:22 UTC (permalink / raw)
To: Marc Kleine-Budde; +Cc: davem, linux-can, netdev, linux-kernel
In-Reply-To: <52343E64.1050207@pengutronix.de>
On 14.09.2013 12:45, Marc Kleine-Budde wrote:
> On 09/13/2013 07:37 PM, Andre Naujoks wrote:
>> Hi Dave,
>>
>> these are some loosely related patches, that fix an ancient locking problem in
>> the slip and slcan drivers, add general ASCII-HEX to bin functions for
>> uppercase ASCII, fix the handling of CAN RTR frames in the slcan driver
>
> Can you get an Acked-by for the ASCII-HEX functions from the appropriate
> maintainer?
The patch went out to the maintainers I got from the get_maintainer.pl
script. Is there anything else I can or should do to get an Ack from them?
Regards
Andre
>
>> and increase the performance for the slcan driver.
>>
>> As these patches mainly contain fixes for the slip/slcan drivers that require
>> a tty layer fix included in 3.11, I would suggest to get the patches in via
>> the net tree for the 3.12 cycle. They should apply properly on the latest net
>> and mainline tree.
>
> Marc
>
^ permalink raw reply
* [PATCH] Do not drop DNATed 6to4/6rd packets
From: Catalin(ux) M. BOIE @ 2013-09-14 10:30 UTC (permalink / raw)
To: netdev; +Cc: hannes, yoshfuji, davem
From: "Catalin(ux) M. BOIE" <catab@embedromix.ro>
When a router is doing DNAT for 6to4/6rd packets the latest anti-spoofing
patch (218774dc) will drop them because the IPv6 address embedded
does not match the IPv4 destination. This patch will allow them to
pass by testing if we have an address that matches on 6to4/6rd interface.
I have been hit by this problem using Fedora and IPV6TO4_IPV4ADDR.
Also, log the dropped packets (with rate limit).
Signed-off-by: Catalin(ux) M. BOIE <catab@embedromix.ro>
---
include/net/addrconf.h | 5 +++++
net/ipv6/addrconf.c | 28 ++++++++++++++++++++++++++++
net/ipv6/sit.c | 50 +++++++++++++++++++++++++++++++++++++++++++-------
3 files changed, 76 insertions(+), 7 deletions(-)
diff --git a/include/net/addrconf.h b/include/net/addrconf.h
index 84a6440..49886fc 100644
--- a/include/net/addrconf.h
+++ b/include/net/addrconf.h
@@ -73,6 +73,11 @@ extern int ipv6_chk_home_addr(struct net *net,
const struct in6_addr *addr);
#endif
+extern bool ipv6_chk_custom_prefix(
+ const struct in6_addr *addr,
+ const unsigned int prefix_len,
+ struct net_device *dev);
+
extern int ipv6_chk_prefix(const struct in6_addr *addr,
struct net_device *dev);
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index d1ab6ab..70ab1ba 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1527,6 +1527,34 @@ static bool ipv6_chk_same_addr(struct net *net, const struct in6_addr *addr,
return false;
}
+/*
+ * Compares an address/prefix_len with addresses on device @dev.
+ * If one is found it returns true.
+ */
+bool ipv6_chk_custom_prefix(const struct in6_addr *addr,
+ const unsigned int prefix_len, struct net_device *dev)
+{
+ struct inet6_dev *idev;
+ struct inet6_ifaddr *ifa;
+ bool ret = false;
+
+ rcu_read_lock();
+ idev = __in6_dev_get(dev);
+ if (idev) {
+ read_lock_bh(&idev->lock);
+ list_for_each_entry(ifa, &idev->addr_list, if_list) {
+ ret = ipv6_prefix_equal(addr, &ifa->addr, prefix_len);
+ if (ret)
+ break;
+ }
+ read_unlock_bh(&idev->lock);
+ }
+ rcu_read_unlock();
+
+ return ret;
+}
+EXPORT_SYMBOL(ipv6_chk_custom_prefix);
+
int ipv6_chk_prefix(const struct in6_addr *addr, struct net_device *dev)
{
struct inet6_dev *idev;
diff --git a/net/ipv6/sit.c b/net/ipv6/sit.c
index 3353634..fd2aba9 100644
--- a/net/ipv6/sit.c
+++ b/net/ipv6/sit.c
@@ -566,6 +566,33 @@ static inline bool is_spoofed_6rd(struct ip_tunnel *tunnel, const __be32 v4addr,
return false;
}
+/*
+ * Checks if an address matches an address on the tunnel interface.
+ * Used to detect the NAT of proto 41 packets and let them pass spoofing test.
+ * Long story:
+ * This function is called after we considered the packet as spoofed
+ * in is_spoofed_6rd.
+ * We may have a router that is doing NAT for proto 41 packets
+ * for an internal station. Destination a.a.a.a/PREFIX:bbbb:bbbb
+ * will be translated to n.n.n.n/PREFIX:bbbb:bbbb. And is_spoofed_6rd
+ * function will return true, dropping the packet.
+ * But, we can still check if is spoofed against the IP
+ * addresses associated with the interface.
+ */
+static bool only_dnatted(const struct ip_tunnel *tunnel,
+ const struct in6_addr *v6dst)
+{
+ int prefix_len;
+
+#ifdef CONFIG_IPV6_SIT_6RD
+ prefix_len = tunnel->ip6rd.prefixlen + 32
+ - tunnel->ip6rd.relay_prefixlen;
+#else
+ prefix_len = 48;
+#endif
+ return ipv6_chk_custom_prefix(v6dst, prefix_len, tunnel->dev);
+}
+
static int ipip6_rcv(struct sk_buff *skb)
{
const struct iphdr *iph = ip_hdr(skb);
@@ -589,11 +616,20 @@ static int ipip6_rcv(struct sk_buff *skb)
tunnel->dev->stats.rx_errors++;
goto out;
}
- } else {
- if (is_spoofed_6rd(tunnel, iph->saddr,
- &ipv6_hdr(skb)->saddr) ||
- is_spoofed_6rd(tunnel, iph->daddr,
- &ipv6_hdr(skb)->daddr)) {
+ } else if (!(tunnel->dev->flags&IFF_POINTOPOINT)) {
+ if (unlikely(is_spoofed_6rd(tunnel, iph->saddr,
+ &ipv6_hdr(skb)->saddr))) {
+ net_warn_ratelimited("Src spoofed %pI4/%pI6c\n",
+ &iph->saddr, &ipv6_hdr(skb)->saddr);
+ tunnel->dev->stats.rx_errors++;
+ goto out;
+ }
+
+ if (unlikely(is_spoofed_6rd(tunnel, iph->daddr,
+ &ipv6_hdr(skb)->daddr)
+ && !only_dnatted(tunnel, &ipv6_hdr(skb)->daddr))) {
+ net_warn_ratelimited("Dst spoofed %pI4/%pI6c\n",
+ &iph->daddr, &ipv6_hdr(skb)->daddr);
tunnel->dev->stats.rx_errors++;
goto out;
}
@@ -713,7 +749,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
neigh = dst_neigh_lookup(skb_dst(skb), &iph6->daddr);
if (neigh == NULL) {
- net_dbg_ratelimited("sit: nexthop == NULL\n");
+ net_dbg_ratelimited("nexthop == NULL\n");
goto tx_error;
}
@@ -742,7 +778,7 @@ static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
neigh = dst_neigh_lookup(skb_dst(skb), &iph6->daddr);
if (neigh == NULL) {
- net_dbg_ratelimited("sit: nexthop == NULL\n");
+ net_dbg_ratelimited("nexthop == NULL\n");
goto tx_error;
}
--
1.8.3.1
^ permalink raw reply related
* Re: [RFC PATCH 2/4] net: Add lower dev list helpers
From: Veaceslav Falico @ 2013-09-14 12:27 UTC (permalink / raw)
To: John Fastabend
Cc: stephen, bhutchings, ogerlitz, john.ronciak, netdev,
shannon.nelson
In-Reply-To: <20130911184647.26914.40440.stgit@nitbit.x32>
On Wed, Sep 11, 2013 at 11:46:49AM -0700, John Fastabend wrote:
>This patch adds helpers to traverse the lower dev lists, these
>helpers match the upper dev list implementation.
>
>VSI implementers may use these to track a list of connected netdevs.
>This is easier then having drivers do their own accounting.
Just as a note (as I have quite no idea how ixgbe works) - you are aware
that the upper/lower lists currently include *all* upper/lower devices, and
not only the first-connected ones?
I've seen that you usually verify it, however not always, just a heads-up -
sorry if misread.
I'm also currently trying to get the new patchset included - which would
split the first-tier connected devices from all the 'other' (as in - lower
of a lower and upper of an upper) devices, so that way, I think, it would
be easier/faster for you to use it. It also has a ->private field, easily
accessible, which you could have used instead of/in conjunction with/for
struct ixgbe_vsi_adapter.
[PATCH v2 net-next 00/27] bonding: use neighbours instead of own lists
Here's the patchset.
Hope that helps.
>
>Signed-off-by: John Fastabend <john.r.fastabend@intel.com>
>---
> include/linux/netdevice.h | 8 ++++++++
> net/core/dev.c | 25 +++++++++++++++++++++++++
> 2 files changed, 33 insertions(+)
>
>diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
>index 041b42a..4d24b38 100644
>--- a/include/linux/netdevice.h
>+++ b/include/linux/netdevice.h
>@@ -2813,6 +2813,8 @@ extern int bpf_jit_enable;
> extern bool netdev_has_upper_dev(struct net_device *dev,
> struct net_device *upper_dev);
> extern bool netdev_has_any_upper_dev(struct net_device *dev);
>+extern struct net_device *netdev_lower_get_next_dev_rcu(struct net_device *dev,
>+ struct list_head **iter);
> extern struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
> struct list_head **iter);
>
>@@ -2823,6 +2825,12 @@ extern struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
> upper; \
> upper = netdev_upper_get_next_dev_rcu(dev, &(iter)))
>
>+#define netdev_for_each_lower_dev_rcu(dev, lower, iter) \
>+ for (iter = &(dev)->lower_dev_list, \
>+ lower = netdev_lower_get_next_dev_rcu(dev, &(iter)); \
>+ lower; \
>+ lower = netdev_lower_get_next_dev_rcu(dev, &(iter)))
>+
> extern struct net_device *netdev_master_upper_dev_get(struct net_device *dev);
> extern struct net_device *netdev_master_upper_dev_get_rcu(struct net_device *dev);
> extern int netdev_upper_dev_link(struct net_device *dev,
>diff --git a/net/core/dev.c b/net/core/dev.c
>index 5c713f2..65ed610 100644
>--- a/net/core/dev.c
>+++ b/net/core/dev.c
>@@ -4468,6 +4468,31 @@ struct net_device *netdev_master_upper_dev_get(struct net_device *dev)
> }
> EXPORT_SYMBOL(netdev_master_upper_dev_get);
>
>+/* netdev_lower_get_next_dev_rcu - Get the next dev from lower list
>+ * @dev: device
>+ * @iter: list_head ** of the current position
>+ *
>+ * Gets the next device from the dev's lower list, starting from iter
>+ * position. The caller must hold RTNL/RCU read lock.
>+ */
>+struct net_device *netdev_lower_get_next_dev_rcu(struct net_device *dev,
>+ struct list_head **iter)
>+{
>+ struct netdev_adjacent *lower;
>+
>+ WARN_ON_ONCE(!rcu_read_lock_held());
>+
>+ lower = list_entry_rcu((*iter)->next, struct netdev_adjacent, list);
>+
>+ if (&lower->list == &dev->lower_dev_list)
>+ return NULL;
>+
>+ *iter = &lower->list;
>+
>+ return lower->dev;
>+}
>+EXPORT_SYMBOL(netdev_lower_get_next_dev_rcu);
>+
> /* netdev_upper_get_next_dev_rcu - Get the next dev from upper list
> * @dev: device
> * @iter: list_head ** of the current position
>
^ permalink raw reply
* Re: [PATCH] ptp: measure the time offset between PHC and system clock
From: Richard Cochran @ 2013-09-14 14:31 UTC (permalink / raw)
To: Dong Zhu; +Cc: Rob Landley, netdev, linux-doc, linux-kernel
In-Reply-To: <20130914080306.GC23682@zhudong.nay.redhat.com>
On Sat, Sep 14, 2013 at 04:03:06PM +0800, Dong Zhu wrote:
> This patch add a method into testptp.c to measure the time offset
> between phc and system clock through the ioctl PTP_SYS_OFFSET.
>
This is a nice addition to the testptp program. I do have a few
comments, below.
First off, the subject line should mention testptp. How about this?
[PATCH] ptp: add the PTP_SYS_OFFSET ioctl to the testptp program
> Signed-off-by: Dong Zhu <bluezhudong@gmail.com>
> ---
> Documentation/ptp/testptp.c | 40 ++++++++++++++++++++++++++++++++++++++--
> 1 file changed, 38 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/ptp/testptp.c b/Documentation/ptp/testptp.c
> index f59ded0..72bb030 100644
> --- a/Documentation/ptp/testptp.c
> +++ b/Documentation/ptp/testptp.c
> @@ -112,6 +112,7 @@ static void usage(char *progname)
> " -f val adjust the ptp clock frequency by 'val' ppb\n"
> " -g get the ptp clock time\n"
> " -h prints this message\n"
> + " -k val measure the time offset between PHC and system clock\n"
The help message should tell the user what 'val' is.
> " -p val enable output with a period of 'val' nanoseconds\n"
> " -P val enable or disable (val=1|0) the system clock PPS\n"
> " -s set the ptp clock time from the system time\n"
> @@ -133,8 +134,12 @@ int main(int argc, char *argv[])
> struct itimerspec timeout;
> struct sigevent sigevent;
>
> + struct ptp_clock_time *pct;
> + struct ptp_sys_offset *sysoff;
> +
> +
> char *progname;
> - int c, cnt, fd;
> + int i, c, cnt, fd;
>
> char *device = DEVICE;
> clockid_t clkid;
> @@ -144,6 +149,8 @@ int main(int argc, char *argv[])
> int extts = 0;
> int gettime = 0;
> int oneshot = 0;
> + int offset = 0;
> + int n_samples = 0;
> int periodic = 0;
> int perout = -1;
> int pps = -1;
> @@ -151,7 +158,7 @@ int main(int argc, char *argv[])
>
> progname = strrchr(argv[0], '/');
> progname = progname ? 1+progname : argv[0];
> - while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghp:P:sSt:v"))) {
> + while (EOF != (c = getopt(argc, argv, "a:A:cd:e:f:ghk:p:P:sSt:v"))) {
> switch (c) {
> case 'a':
> oneshot = atoi(optarg);
> @@ -174,6 +181,10 @@ int main(int argc, char *argv[])
> case 'g':
> gettime = 1;
> break;
> + case 'k':
> + offset = 1;
> + n_samples = atoi(optarg);
> + break;
> case 'p':
> perout = atoi(optarg);
> break;
> @@ -376,6 +387,31 @@ int main(int argc, char *argv[])
> }
> }
>
> + if (offset) {
> + sysoff = calloc(1, sizeof(*sysoff));
> + if (!sysoff) {
> + perror("calloc");
> + return -1;
> + }
> + sysoff->n_samples = n_samples;
> +
> + if (ioctl(fd, PTP_SYS_OFFSET, sysoff))
> + perror("PTP_SYS_OFFSET");
> + else
> + puts("time offset between PHC and
> + system clock request okay");
> +
> + pct = &sysoff->ts[0];
> + for (i = 0; i < sysoff->n_samples; i++, pct++) {
> + printf("system time: %ld.%ld\n", pct->sec, pct->nsec);
> + pct++;
> + printf("phc time: %ld.%ld\n\n", pct->sec, pct->nsec);
^^^^
I think the output would look nicer with only one newline. After all,
each measurement is a {sys,phc,sys} triplet and not a {sys,phc} pair.
> + }
> + printf("system time: %ld.%ld\n", pct->sec, pct->nsec);
> +
> + free(sysoff);
> + }
> +
Thanks,
Richard
^ 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