From a1f1143e8da7be12375e6dd8d0d54c5919358114 Mon Sep 17 00:00:00 2001 From: Vince Worthington Date: Mon, 17 Jul 2006 14:10:09 -0400 Subject: [PATCH] Proposed patch to iproute to add Initial Max Congestion Window Size route tuning parameter Vince Worthington wrote: > Hello, > > We've been working with a customer of ours who was experiencing some > latency issues, and in the process of helping them solve their problem > we found that adding the ability to adjust the Initial Max Congestion > Window size on a route, they were able to tune their routes to perform > more favorably in their mixed Linux and Solaris environment. There > were a couple of other tuning steps necessary as well but we did find > that the ability to set a larger initial max congestion window size > was helpful in making Linux behave more like Solaris in low-latency > situations. > > The kernel already supports this route attribute, this patch simply > adds the option to iproute.c to provide a means to set it from userspace. > > I've attached the patch we used in test builds of the iproute packages > we distribute in RHEL3 and RHEL4 for your consideration for possible > acceptance and inclusion in iproute. Please let us know if there is > any further information you would need or if there is a more > appropriate venue to submit this patch. > > Thanks, > Vince Worthington > Red Hat, Inc. Stephen, I apologize for the last patch I sent not applying cleanly to the latest iproute2 sources. I realized that this might impede any review/acceptance of the patch and created a separate patch against the 20060323 build of iproute2, which seems to be the latest (by looking at the website). The previous patch wouldn't apply cleanly due to the label of the ssthresh argument being corrected from REALMS to NUMBER. Please let us know if there is any other information or assistance we can be with this patch submission. Thanks Vince --- ip/iproute.c | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/ip/iproute.c b/ip/iproute.c index a43c09e6..0b703473 100644 --- a/ip/iproute.c +++ b/ip/iproute.c @@ -59,8 +59,8 @@ static void usage(void) fprintf(stderr, "NH := [ via ADDRESS ] [ dev STRING ] [ weight NUMBER ] NHFLAGS\n"); fprintf(stderr, "OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ]\n"); fprintf(stderr, " [ rtt NUMBER ] [ rttvar NUMBER ]\n"); - fprintf(stderr, " [ window NUMBER] [ cwnd NUMBER ] [ ssthresh NUMBER ]\n"); - fprintf(stderr, " [ realms REALM ]\n"); + fprintf(stderr, " [ window NUMBER] [ cwnd NUMBER ] [ initcwnd NUMBER ]\n"); + fprintf(stderr, " [ ssthresh NUMBER ] [ realms REALM ]\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"); @@ -487,6 +487,15 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) mxlock = *(unsigned*)RTA_DATA(mxrta[RTAX_LOCK]); for (i=2; i<=RTAX_MAX; i++) { + + /* + * "hoplimit" and "features" are not supported in + * userspace yet, but they are present in kernel's + * RTM_METRICS array in include/linux/rtnetlink.h, + * so putting placeholders in here for now so we + * can match the position of initcwnd in this + * structure: */ + static char *mx_names[] = { "mtu", @@ -497,6 +506,9 @@ int print_route(const struct sockaddr_nl *who, struct nlmsghdr *n, void *arg) "cwnd", "advmss", "reordering", + "hoplimit", + "initcwnd", + "features", }; static int hz; if (mxrta[i] == NULL) @@ -794,6 +806,16 @@ int iproute_modify(int cmd, unsigned flags, int argc, char **argv) if (get_unsigned(&win, *argv, 0)) invarg("\"cwnd\" value is invalid\n", *argv); rta_addattr32(mxrta, sizeof(mxbuf), RTAX_CWND, win); + } else if (matches(*argv, "initcwnd") == 0) { + unsigned win; + NEXT_ARG(); + if (strcmp(*argv, "lock") == 0) { + mxlock |= (1<