From: Tom Herbert <tom@herbertland.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>, <shemming@brocade.com>
Cc: <kernel-team@fb.com>, <haoxuany@fb.com>,
Tom Herbert <tom@herbertland.com>
Subject: [PATCH iproute 1/5] ila: Support for checksum neutral translation
Date: Thu, 14 Jul 2016 12:22:12 -0700 [thread overview]
Message-ID: <1468524136-3389846-2-git-send-email-tom@herbertland.com> (raw)
In-Reply-To: <1468524136-3389846-1-git-send-email-tom@herbertland.com>
Add configuration of ila LWT tunnels for checksum mode including
checksum neutral translation.
Signed-off-by: Tom Herbert <tom@herbertland.com>
---
ip/iproute_lwtunnel.c | 57 +++++++++++++++++++++++++++++++++++++++++++++++++--
1 file changed, 55 insertions(+), 2 deletions(-)
diff --git a/ip/iproute_lwtunnel.c b/ip/iproute_lwtunnel.c
index bdbb15d..42b0a1f 100644
--- a/ip/iproute_lwtunnel.c
+++ b/ip/iproute_lwtunnel.c
@@ -90,6 +90,32 @@ static void print_encap_ip(FILE *fp, struct rtattr *encap)
fprintf(fp, "tos %d ", rta_getattr_u8(tb[LWTUNNEL_IP_TOS]));
}
+static char *ila_csum_mode2name(__u8 csum_mode)
+{
+ switch (csum_mode) {
+ case ILA_CSUM_ADJUST_TRANSPORT:
+ return "adj-transport";
+ case ILA_CSUM_NEUTRAL_MAP:
+ return "neutral-map";
+ case ILA_CSUM_NO_ACTION:
+ return "no-action";
+ default:
+ return "unknown";
+ }
+}
+
+static __u8 ila_csum_name2mode(char *name)
+{
+ if (strcmp(name, "adj-transport") == 0)
+ return ILA_CSUM_ADJUST_TRANSPORT;
+ else if (strcmp(name, "neutral-map") == 0)
+ return ILA_CSUM_NEUTRAL_MAP;
+ else if (strcmp(name, "no-action") == 0)
+ return ILA_CSUM_NO_ACTION;
+ else
+ return -1;
+}
+
static void print_encap_ila(FILE *fp, struct rtattr *encap)
{
struct rtattr *tb[ILA_ATTR_MAX+1];
@@ -103,6 +129,10 @@ static void print_encap_ila(FILE *fp, struct rtattr *encap)
abuf, sizeof(abuf));
fprintf(fp, " %s ", abuf);
}
+
+ if (tb[ILA_ATTR_CSUM_MODE])
+ fprintf(fp, " csum-mode %s ",
+ ila_csum_mode2name(rta_getattr_u8(tb[ILA_ATTR_CSUM_MODE])));
}
static void print_encap_ip6(FILE *fp, struct rtattr *encap)
@@ -246,10 +276,33 @@ static int parse_encap_ila(struct rtattr *rta, size_t len,
exit(1);
}
+ argc--; argv++;
+
rta_addattr64(rta, 1024, ILA_ATTR_LOCATOR, locator);
- *argcp = argc;
- *argvp = argv;
+ while (argc > 0) {
+ if (strcmp(*argv, "csum-mode") == 0) {
+ __u8 csum_mode;
+
+ NEXT_ARG();
+
+ csum_mode = ila_csum_name2mode(*argv);
+ if (csum_mode < 0)
+ invarg("\"csum-mode\" value is invalid\n", *argv);
+
+ rta_addattr8(rta, 1024, ILA_ATTR_CSUM_MODE, csum_mode);
+
+ argc--; argv++;
+ } else {
+ break;
+ }
+ }
+
+ /* argv is currently the first unparsed argument,
+ * but the lwt_parse_encap() caller will move to the next,
+ * so step back */
+ *argcp = argc + 1;
+ *argvp = argv - 1;
return 0;
}
--
2.8.0.rc2
next prev parent reply other threads:[~2016-07-14 19:22 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-14 19:22 [PATCH iproute 0/5] iproute: ila and fou additions Tom Herbert
2016-07-14 19:22 ` Tom Herbert [this message]
2016-07-14 19:22 ` [PATCH iproute 2/5] ila: Support for configuring ila to use netfilter hook Tom Herbert
2016-07-14 19:22 ` [PATCH iproute 3/5] ip6tnl: Support for fou encapsulation Tom Herbert
2016-07-14 19:22 ` [PATCH iproute 4/5] gre6: " Tom Herbert
2016-07-14 19:22 ` [PATCH iproute 5/5] fou: Allowing configuring IPv6 listener Tom Herbert
2016-07-15 18:23 ` [PATCH iproute 0/5] iproute: ila and fou additions Stephen Hemminger
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1468524136-3389846-2-git-send-email-tom@herbertland.com \
--to=tom@herbertland.com \
--cc=davem@davemloft.net \
--cc=haoxuany@fb.com \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
--cc=shemming@brocade.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.