X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=app%2Ftest-pmd%2Fconfig.c;h=d04940c3d10ec3e86926e8f7407abbffc773791c;hb=52f38a2055ede3cd171658588df9ff2a84875227;hp=4ec8f0db580999dc2642aa0a09a398b1bfe9e814;hpb=576f459eb2a900c9868ff868093e06a59fa584ea;p=dpdk.git diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index 4ec8f0db58..d04940c3d1 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -360,7 +360,7 @@ rx_queue_infos_display(portid_t port_id, uint16_t queue_id) rc = rte_eth_rx_queue_info_get(port_id, queue_id, &qinfo); if (rc != 0) { - printf("Failed to retrieve information for port: %hhu, " + printf("Failed to retrieve information for port: %u, " "RX queue: %hu\nerror desc: %s(%d)\n", port_id, queue_id, strerror(-rc), rc); return; @@ -393,7 +393,7 @@ tx_queue_infos_display(portid_t port_id, uint16_t queue_id) rc = rte_eth_tx_queue_info_get(port_id, queue_id, &qinfo); if (rc != 0) { - printf("Failed to retrieve information for port: %hhu, " + printf("Failed to retrieve information for port: %u, " "TX queue: %hu\nerror desc: %s(%d)\n", port_id, queue_id, strerror(-rc), rc); return; @@ -2428,7 +2428,7 @@ set_tx_pkt_segments(unsigned *seg_lengths, unsigned nb_segs) } void -setup_gro(const char *mode, uint8_t port_id) +setup_gro(const char *onoff, portid_t port_id) { if (!rte_eth_dev_is_valid_port(port_id)) { printf("invalid port id %u\n", port_id); @@ -2439,29 +2439,101 @@ setup_gro(const char *mode, uint8_t port_id) " please stop forwarding first\n"); return; } - if (strcmp(mode, "on") == 0) { - if (gro_ports[port_id].enable) { - printf("port %u has enabled GRO\n", port_id); + if (strcmp(onoff, "on") == 0) { + if (gro_ports[port_id].enable != 0) { + printf("Port %u has enabled GRO. Please" + " disable GRO first\n", port_id); return; } - gro_ports[port_id].enable = 1; - gro_ports[port_id].param.gro_types = RTE_GRO_TCP_IPV4; - - if (gro_ports[port_id].param.max_flow_num == 0) + if (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) { + gro_ports[port_id].param.gro_types = RTE_GRO_TCP_IPV4; gro_ports[port_id].param.max_flow_num = GRO_DEFAULT_FLOW_NUM; - if (gro_ports[port_id].param.max_item_per_flow == 0) gro_ports[port_id].param.max_item_per_flow = GRO_DEFAULT_ITEM_NUM_PER_FLOW; + } + gro_ports[port_id].enable = 1; } else { if (gro_ports[port_id].enable == 0) { - printf("port %u has disabled GRO\n", port_id); + printf("Port %u has disabled GRO\n", port_id); return; } gro_ports[port_id].enable = 0; } } +void +setup_gro_flush_cycles(uint8_t cycles) +{ + if (test_done == 0) { + printf("Before change flush interval for GRO," + " please stop forwarding first.\n"); + return; + } + + if (cycles > GRO_MAX_FLUSH_CYCLES || cycles < + GRO_DEFAULT_FLUSH_CYCLES) { + printf("The flushing cycle be in the range" + " of 1 to %u. Revert to the default" + " value %u.\n", + GRO_MAX_FLUSH_CYCLES, + GRO_DEFAULT_FLUSH_CYCLES); + cycles = GRO_DEFAULT_FLUSH_CYCLES; + } + + gro_flush_cycles = cycles; +} + +void +show_gro(portid_t port_id) +{ + struct rte_gro_param *param; + uint32_t max_pkts_num; + + param = &gro_ports[port_id].param; + + if (!rte_eth_dev_is_valid_port(port_id)) { + printf("Invalid port id %u.\n", port_id); + return; + } + if (gro_ports[port_id].enable) { + printf("GRO type: TCP/IPv4\n"); + if (gro_flush_cycles == GRO_DEFAULT_FLUSH_CYCLES) { + max_pkts_num = param->max_flow_num * + param->max_item_per_flow; + } else + max_pkts_num = MAX_PKT_BURST * GRO_MAX_FLUSH_CYCLES; + printf("Max number of packets to perform GRO: %u\n", + max_pkts_num); + printf("Flushing cycles: %u\n", gro_flush_cycles); + } else + printf("Port %u doesn't enable GRO.\n", port_id); +} + +void +setup_gso(const char *mode, portid_t port_id) +{ + if (!rte_eth_dev_is_valid_port(port_id)) { + printf("invalid port id %u\n", port_id); + return; + } + if (strcmp(mode, "on") == 0) { + if (test_done == 0) { + printf("before enabling GSO," + " please stop forwarding first\n"); + return; + } + gso_ports[port_id].enable = 1; + } else if (strcmp(mode, "off") == 0) { + if (test_done == 0) { + printf("before disabling GSO," + " please stop forwarding first\n"); + return; + } + gso_ports[port_id].enable = 0; + } +} + char* list_pkt_forwarding_modes(void) {