From 318ad9d74522418889805cb0fac493409a78304b Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 19 Jun 2013 18:14:17 -0700 Subject: [PATCH 1/3] update to 3.10-net-next headers --- include/linux/gen_stats.h | 11 +++++++++++ include/linux/if_link.h | 15 +++++++++++++++ include/linux/if_tun.h | 2 ++ 3 files changed, 28 insertions(+) diff --git a/include/linux/gen_stats.h b/include/linux/gen_stats.h index 552c8a0a..6487317e 100644 --- a/include/linux/gen_stats.h +++ b/include/linux/gen_stats.h @@ -9,6 +9,7 @@ enum { TCA_STATS_RATE_EST, TCA_STATS_QUEUE, TCA_STATS_APP, + TCA_STATS_RATE_EST64, __TCA_STATS_MAX, }; #define TCA_STATS_MAX (__TCA_STATS_MAX - 1) @@ -37,6 +38,16 @@ struct gnet_stats_rate_est { __u32 pps; }; +/** + * struct gnet_stats_rate_est64 - rate estimator + * @bps: current byte rate + * @pps: current packet rate + */ +struct gnet_stats_rate_est64 { + __u64 bps; + __u64 pps; +}; + /** * struct gnet_stats_queue - queuing statistics * @qlen: queue length diff --git a/include/linux/if_link.h b/include/linux/if_link.h index 965dc9f9..d07aecaa 100644 --- a/include/linux/if_link.h +++ b/include/linux/if_link.h @@ -219,6 +219,8 @@ enum { IFLA_BRPORT_GUARD, /* bpdu guard */ IFLA_BRPORT_PROTECT, /* root port protection */ IFLA_BRPORT_FAST_LEAVE, /* multicast fast leave */ + IFLA_BRPORT_LEARNING, /* mac learning */ + IFLA_BRPORT_UNICAST_FLOOD, /* flood unicast traffic */ __IFLA_BRPORT_MAX }; #define IFLA_BRPORT_MAX (__IFLA_BRPORT_MAX - 1) @@ -334,6 +336,7 @@ enum { IFLA_VF_VLAN, IFLA_VF_TX_RATE, /* TX Bandwidth Allocation */ IFLA_VF_SPOOFCHK, /* Spoof Checking on/off switch */ + IFLA_VF_LINK_STATE, /* link state enable/disable/auto switch */ __IFLA_VF_MAX, }; @@ -360,6 +363,18 @@ struct ifla_vf_spoofchk { __u32 setting; }; +enum { + IFLA_VF_LINK_STATE_AUTO, /* link state of the uplink */ + IFLA_VF_LINK_STATE_ENABLE, /* link always up */ + IFLA_VF_LINK_STATE_DISABLE, /* link always down */ + __IFLA_VF_LINK_STATE_MAX, +}; + +struct ifla_vf_link_state { + __u32 vf; + __u32 link_state; +}; + /* VF ports management section * * Nested layout of set/get msg is: diff --git a/include/linux/if_tun.h b/include/linux/if_tun.h index dffb1927..dc13de35 100644 --- a/include/linux/if_tun.h +++ b/include/linux/if_tun.h @@ -68,6 +68,8 @@ #define IFF_MULTI_QUEUE 0x0100 #define IFF_ATTACH_QUEUE 0x0200 #define IFF_DETACH_QUEUE 0x0400 +/* read-only flag */ +#define IFF_PERSIST 0x0800 /* Features for GSO (TUNSETOFFLOAD). */ #define TUN_F_CSUM 0x01 /* You can hand me unchecksummed packets. */ From 07fa9c1529871b61879e11a7c9eccbf357982591 Mon Sep 17 00:00:00 2001 From: Rony Efraim Date: Thu, 13 Jun 2013 13:19:12 +0300 Subject: [PATCH 2/3] Add VF link state control Add link state per VF command Signed-off-by: Rony Efraim Signed-off-by: Or Gerlitz --- ip/ipaddress.c | 23 +++++++++++++++++++++++ ip/iplink.c | 14 ++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/ip/ipaddress.c b/ip/ipaddress.c index 5b9a4385..d2524e89 100644 --- a/ip/ipaddress.c +++ b/ip/ipaddress.c @@ -229,6 +229,7 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) struct ifla_vf_vlan *vf_vlan; struct ifla_vf_tx_rate *vf_tx_rate; struct ifla_vf_spoofchk *vf_spoofchk; + struct ifla_vf_link_state *vf_linkstate; struct rtattr *vf[IFLA_VF_MAX+1]; struct rtattr *tmp; SPRINT_BUF(b1); @@ -255,6 +256,20 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) else vf_spoofchk = RTA_DATA(vf[IFLA_VF_SPOOFCHK]); + if (vf_spoofchk) { + /* Check if the link state vf info type is supported by + * this kernel. + */ + tmp = (struct rtattr *)((char *)vf[IFLA_VF_SPOOFCHK] + + vf[IFLA_VF_SPOOFCHK]->rta_len); + + if (tmp->rta_type != IFLA_VF_LINK_STATE) + vf_linkstate = NULL; + else + vf_linkstate = RTA_DATA(vf[IFLA_VF_LINK_STATE]); + } else + vf_linkstate = NULL; + fprintf(fp, "\n vf %d MAC %s", vf_mac->vf, ll_addr_n2a((unsigned char *)&vf_mac->mac, ETH_ALEN, 0, b1, sizeof(b1))); @@ -270,6 +285,14 @@ static void print_vfinfo(FILE *fp, struct rtattr *vfinfo) else fprintf(fp, ", spoof checking off"); } + if (vf_linkstate) { + if (vf_linkstate->link_state == IFLA_VF_LINK_STATE_AUTO) + fprintf(fp, ", link-state auto"); + else if (vf_linkstate->link_state == IFLA_VF_LINK_STATE_ENABLE) + fprintf(fp, ", link-state enable"); + else + fprintf(fp, ", link-state disable"); + } } static void print_link_stats64(FILE *fp, const struct rtnl_link_stats64 *s) { diff --git a/ip/iplink.c b/ip/iplink.c index dc980195..ada9d425 100644 --- a/ip/iplink.c +++ b/ip/iplink.c @@ -77,6 +77,7 @@ void iplink_usage(void) fprintf(stderr, " [ rate TXRATE ] ] \n"); fprintf(stderr, " [ spoofchk { on | off} ] ] \n"); + fprintf(stderr, " [ state { auto | enable | disable} ] ]\n"); fprintf(stderr, " [ master DEVICE ]\n"); fprintf(stderr, " [ nomaster ]\n"); fprintf(stderr, " ip link show [ DEVICE | group GROUP ] [up]\n"); @@ -255,6 +256,19 @@ static int iplink_parse_vf(int vf, int *argcp, char ***argvp, ivs.vf = vf; addattr_l(&req->n, sizeof(*req), IFLA_VF_SPOOFCHK, &ivs, sizeof(ivs)); + } else if (matches(*argv, "state") == 0) { + struct ifla_vf_link_state ivl; + NEXT_ARG(); + if (matches(*argv, "auto") == 0) + ivl.link_state = IFLA_VF_LINK_STATE_AUTO; + else if (matches(*argv, "enable") == 0) + ivl.link_state = IFLA_VF_LINK_STATE_ENABLE; + else if (matches(*argv, "disable") == 0) + ivl.link_state = IFLA_VF_LINK_STATE_DISABLE; + else + invarg("Invalid \"state\" value\n", *argv); + ivl.vf = vf; + addattr_l(&req->n, sizeof(*req), IFLA_VF_LINK_STATE, &ivl, sizeof(ivl)); } else { /* rewind arg */ PREV_ARG(); From b37f2c895d7876416a45e608754a39fff47ddf29 Mon Sep 17 00:00:00 2001 From: Cong Wang Date: Sat, 15 Jun 2013 09:39:19 +0800 Subject: [PATCH 3/3] add quickack option to ip route This patch adds quickack option to enable/disable TCP quick ack mode for per-route. Cc: Stephen Hemminger Cc: "David S. Miller" Cc: Thomas Graf Signed-off-by: Cong Wang --- include/linux/rtnetlink.h | 2 ++ ip/iproute.c | 11 +++++++++++ man/man8/ip-route.8.in | 6 ++++++ 3 files changed, 19 insertions(+) diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h index 93370bd2..248fdd3f 100644 --- a/include/linux/rtnetlink.h +++ b/include/linux/rtnetlink.h @@ -386,6 +386,8 @@ enum { #define RTAX_RTO_MIN RTAX_RTO_MIN RTAX_INITRWND, #define RTAX_INITRWND RTAX_INITRWND + RTAX_QUICKACK, +#define RTAX_QUICKACK RTAX_QUICKACK __RTAX_MAX }; diff --git a/ip/iproute.c b/ip/iproute.c index adef7740..46710b2b 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -52,6 +52,7 @@ static const char *mx_names[RTAX_MAX+1] = { [RTAX_FEATURES] = "features", [RTAX_RTO_MIN] = "rto_min", [RTAX_INITRWND] = "initrwnd", + [RTAX_QUICKACK] = "quickack", }; static void usage(void) __attribute__((noreturn)); @@ -79,6 +80,7 @@ static void usage(void) fprintf(stderr, " [ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]\n"); fprintf(stderr, " [ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]\n"); fprintf(stderr, " [ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]\n"); + fprintf(stderr, " [ quickack BOOL ]\n"); fprintf(stderr, "TYPE := [ unicast | local | broadcast | multicast | throw |\n"); fprintf(stderr, " unreachable | prohibit | blackhole | nat ]\n"); fprintf(stderr, "TABLE_ID := [ local | main | default | all | NUMBER ]\n"); @@ -86,6 +88,7 @@ static void usage(void) fprintf(stderr, "NHFLAGS := [ onlink | pervasive ]\n"); fprintf(stderr, "RTPROTO := [ kernel | boot | static | NUMBER ]\n"); fprintf(stderr, "TIME := NUMBER[s|ms]\n"); + fprintf(stderr, "BOOL := [1|0]\n"); exit(-1); } @@ -885,6 +888,14 @@ static int iproute_modify(int cmd, unsigned flags, int argc, char **argv) if (get_unsigned(&win, *argv, 0)) invarg("\"initrwnd\" value is invalid\n", *argv); rta_addattr32(mxrta, sizeof(mxbuf), RTAX_INITRWND, win); + } else if (matches(*argv, "quickack") == 0) { + unsigned quickack; + NEXT_ARG(); + if (get_unsigned(&quickack, *argv, 0)) + invarg("\"quickack\" value is invalid\n", *argv); + if (quickack != 1 && quickack != 0) + invarg("\"quickack\" value should be 0 or 1\n", *argv); + rta_addattr32(mxrta, sizeof(mxbuf), RTAX_QUICKACK, quickack); } else if (matches(*argv, "rttvar") == 0) { unsigned win; NEXT_ARG(); diff --git a/man/man8/ip-route.8.in b/man/man8/ip-route.8.in index 2c35a973..01997fa0 100644 --- a/man/man8/ip-route.8.in +++ b/man/man8/ip-route.8.in @@ -111,6 +111,8 @@ replace " } " .IR NUMBER " ] [ " .B initrwnd .IR NUMBER " ]" +.B quickack +.IR BOOL " ]" .ti -8 .IR TYPE " := [ " @@ -400,6 +402,10 @@ the initial receive window size for connections to this destination. Actual window size is this value multiplied by the MSS of the connection. The default value is zero, meaning to use Slow Start value. +.TP +.BI quickack " BOOL " "(3.11+ only)" +Enable or disable quick ack for connections to this destination. + .TP .BI advmss " NUMBER " "(2.3.15+ only)" the MSS ('Maximal Segment Size') to advertise to these