/* Test program for SIOC{G,S}HWTSTAMP * Copyright 2013 Solarflare Communications * Author: Ben Hutchings */ #include #include #include #include #include #include #include #include #include static int lookup_value(const char **names, int size, const char *name) { int value; for (value = 0; value < size; value++) if (names[value] && strcasecmp(names[value], name) == 0) return value; return -1; } static const char * lookup_name(const char **names, int size, int value) { return (value >= 0 && value < size) ? names[value] : NULL; } static void list_names(FILE *f, const char **names, int size) { int value; for (value = 0; value < size; value++) if (names[value]) fprintf(f, " %s\n", names[value]); } static const char *tx_types[] = { #define TX_TYPE(name) [HWTSTAMP_TX_ ## name] = #name TX_TYPE(OFF), TX_TYPE(ON), TX_TYPE(ONESTEP_SYNC) #undef TX_TYPE }; #define N_TX_TYPES ((int)(sizeof(tx_types) / sizeof(tx_types[0]))) static const char *rx_filters[] = { #define RX_FILTER(name) [HWTSTAMP_FILTER_ ## name] = #name RX_FILTER(NONE), RX_FILTER(ALL), RX_FILTER(SOME), RX_FILTER(PTP_V1_L4_EVENT), RX_FILTER(PTP_V1_L4_SYNC), RX_FILTER(PTP_V1_L4_DELAY_REQ), RX_FILTER(PTP_V2_L4_EVENT), RX_FILTER(PTP_V2_L4_SYNC), RX_FILTER(PTP_V2_L4_DELAY_REQ), RX_FILTER(PTP_V2_L2_EVENT), RX_FILTER(PTP_V2_L2_SYNC), RX_FILTER(PTP_V2_L2_DELAY_REQ), RX_FILTER(PTP_V2_EVENT), RX_FILTER(PTP_V2_SYNC), RX_FILTER(PTP_V2_DELAY_REQ), #undef RX_FILTER }; #define N_RX_FILTERS ((int)(sizeof(rx_filters) / sizeof(rx_filters[0]))) static void usage(void) { fputs("Usage: hwtstamp_config if_name [tx_type rx_filter]\n" "tx_type is any of (case-insensitive):\n", stderr); list_names(stderr, tx_types, N_TX_TYPES); fputs("rx_filter is any of (case-insensitive):\n", stderr); list_names(stderr, rx_filters, N_RX_FILTERS); } int main(int argc, char **argv) { struct ifreq ifr; struct hwtstamp_config config; const char *name; int sock; if ((argc != 2 && argc != 4) || (strlen(argv[1]) >= IFNAMSIZ)) { usage(); return 2; } if (argc == 4) { config.flags = 0; config.tx_type = lookup_value(tx_types, N_TX_TYPES, argv[2]); config.rx_filter = lookup_value(rx_filters, N_RX_FILTERS, argv[3]); if (config.tx_type < 0 || config.rx_filter < 0) { usage(); return 2; } } sock = socket(AF_INET, SOCK_DGRAM, 0); if (sock < 0) { perror("socket"); return 1; } strcpy(ifr.ifr_name, argv[1]); ifr.ifr_data = (caddr_t)&config; if (ioctl(sock, (argc == 2) ? SIOCGHWTSTAMP : SIOCSHWTSTAMP, &ifr)) { perror("ioctl"); return 1; } printf("flags = %#x\n", config.flags); name = lookup_name(tx_types, N_TX_TYPES, config.tx_type); if (name) printf("tx_type = %s\n", name); else printf("tx_type = %d\n", config.tx_type); name = lookup_name(rx_filters, N_RX_FILTERS, config.rx_filter); if (name) printf("rx_filter = %s\n", name); else printf("rx_filter = %d\n", config.rx_filter); return 0; } left'>Lines 2017-02-08ipv4: fib: Notify about nexthop status changesIdo Schimmel1-0/+33 When a multipath route is hit the kernel doesn't consider nexthops that are DEAD or LINKDOWN when IN_DEV_IGNORE_ROUTES_WITH_LINKDOWN is set. Devices that offload multipath routes need to be made aware of nexthop status changes. Otherwise, the device will keep forwarding packets to non-functional nexthops. Add the FIB_EVENT_NH_{ADD,DEL} events to the fib notification chain, which notify capable devices when they should add or delete a nexthop from their tables. Cc: Roopa Prabhu <roopa@cumulusnetworks.com> Cc: David Ahern <dsa@cumulusnetworks.com> Cc: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: Ido Schimmel <idosch@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Reviewed-by: Andy Gospodarek <gospo@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-08bridge: vlan tunnel id info range fill size calc cleanupsRoopa Prabhu1-18/+16 This fixes a bug and cleans up tunnelid range size calculation code by using consistent variable names and checks in size calculation and fill functions. tested for a few cases of vlan-vni range mappings: (output from patched iproute2): $bridge vlan showtunnel port vid tunid vxlan0 100-105 1000-1005 200 2000 210 2100 211-213 2100-2102 214 2104 216-217 2108-2109 219 2119 Fixes: efa5356b0d97 ("bridge: per vlan dst_metadata netlink support") Reported-by: Colin Ian King <colin.king@canonical.com> Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-08gro_cells: move to net/core/gro_cells.cEric Dumazet6-0/+100 We have many gro cells users, so lets move the code to avoid duplication. This creates a CONFIG_GRO_CELLS option. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net> 2017-02-07Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller