"tso show (portid)"
" Display the status of TCP Segmentation Offload.\n\n"
- "gro (on|off) (port_id)"
+ "set port (port_id) gro on|off\n"
" Enable or disable Generic Receive Offload in"
" csum forwarding engine.\n\n"
- "gro set (max_flow_num) (max_item_num_per_flow) (port_id)\n"
- " Set max flow number and max packet number per-flow"
- " for GRO.\n\n"
+ "show port (port_id) gro\n"
+ " Display GRO configuration.\n\n"
+
+ "set gro flush (cycles)\n"
+ " Set the cycle to flush GROed packets from"
+ " reassembly tables.\n\n"
"set fwd (%s)\n"
" Set packet forwarding mode.\n\n"
};
/* *** SET GRO FOR A PORT *** */
-struct cmd_gro_result {
+struct cmd_gro_enable_result {
+ cmdline_fixed_string_t cmd_set;
+ cmdline_fixed_string_t cmd_port;
cmdline_fixed_string_t cmd_keyword;
- cmdline_fixed_string_t mode;
- uint8_t port_id;
+ cmdline_fixed_string_t cmd_onoff;
+ portid_t cmd_pid;
};
static void
-cmd_enable_gro_parsed(void *parsed_result,
+cmd_gro_enable_parsed(void *parsed_result,
__attribute__((unused)) struct cmdline *cl,
__attribute__((unused)) void *data)
{
- struct cmd_gro_result *res;
+ struct cmd_gro_enable_result *res;
res = parsed_result;
- setup_gro(res->mode, res->port_id);
-}
-
-cmdline_parse_token_string_t cmd_gro_keyword =
- TOKEN_STRING_INITIALIZER(struct cmd_gro_result,
+ if (!strcmp(res->cmd_keyword, "gro"))
+ setup_gro(res->cmd_onoff, res->cmd_pid);
+}
+
+cmdline_parse_token_string_t cmd_gro_enable_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_enable_result,
+ cmd_set, "set");
+cmdline_parse_token_string_t cmd_gro_enable_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_enable_result,
+ cmd_keyword, "port");
+cmdline_parse_token_num_t cmd_gro_enable_pid =
+ TOKEN_NUM_INITIALIZER(struct cmd_gro_enable_result,
+ cmd_pid, UINT16);
+cmdline_parse_token_string_t cmd_gro_enable_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_enable_result,
cmd_keyword, "gro");
-cmdline_parse_token_string_t cmd_gro_mode =
- TOKEN_STRING_INITIALIZER(struct cmd_gro_result,
- mode, "on#off");
-cmdline_parse_token_num_t cmd_gro_pid =
- TOKEN_NUM_INITIALIZER(struct cmd_gro_result,
- port_id, UINT8);
+cmdline_parse_token_string_t cmd_gro_enable_onoff =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_enable_result,
+ cmd_onoff, "on#off");
-cmdline_parse_inst_t cmd_enable_gro = {
- .f = cmd_enable_gro_parsed,
+cmdline_parse_inst_t cmd_gro_enable = {
+ .f = cmd_gro_enable_parsed,
.data = NULL,
- .help_str = "gro (on|off) (port_id)",
+ .help_str = "set port <port_id> gro on|off",
.tokens = {
- (void *)&cmd_gro_keyword,
- (void *)&cmd_gro_mode,
- (void *)&cmd_gro_pid,
+ (void *)&cmd_gro_enable_set,
+ (void *)&cmd_gro_enable_port,
+ (void *)&cmd_gro_enable_pid,
+ (void *)&cmd_gro_enable_keyword,
+ (void *)&cmd_gro_enable_onoff,
NULL,
},
};
-/* *** SET MAX FLOW NUMBER AND ITEM NUM PER FLOW FOR GRO *** */
-struct cmd_gro_set_result {
- cmdline_fixed_string_t gro;
- cmdline_fixed_string_t mode;
- uint16_t flow_num;
- uint16_t item_num_per_flow;
- uint8_t port_id;
+/* *** DISPLAY GRO CONFIGURATION *** */
+struct cmd_gro_show_result {
+ cmdline_fixed_string_t cmd_show;
+ cmdline_fixed_string_t cmd_port;
+ cmdline_fixed_string_t cmd_keyword;
+ portid_t cmd_pid;
};
static void
-cmd_gro_set_parsed(void *parsed_result,
- __attribute__((unused)) struct cmdline *cl,
- __attribute__((unused)) void *data)
+cmd_gro_show_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
{
- struct cmd_gro_set_result *res = parsed_result;
+ struct cmd_gro_show_result *res;
- if (port_id_is_invalid(res->port_id, ENABLED_WARN))
- return;
- if (test_done == 0) {
- printf("Before set GRO flow_num and item_num_per_flow,"
- " please stop forwarding first\n");
- return;
- }
+ res = parsed_result;
+ if (!strcmp(res->cmd_keyword, "gro"))
+ show_gro(res->cmd_pid);
+}
+
+cmdline_parse_token_string_t cmd_gro_show_show =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_show_result,
+ cmd_show, "show");
+cmdline_parse_token_string_t cmd_gro_show_port =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_show_result,
+ cmd_port, "port");
+cmdline_parse_token_num_t cmd_gro_show_pid =
+ TOKEN_NUM_INITIALIZER(struct cmd_gro_show_result,
+ cmd_pid, UINT16);
+cmdline_parse_token_string_t cmd_gro_show_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_show_result,
+ cmd_keyword, "gro");
- if (!strcmp(res->mode, "set")) {
- if (res->flow_num == 0)
- printf("Invalid flow number. Revert to default value:"
- " %u.\n", GRO_DEFAULT_FLOW_NUM);
- else
- gro_ports[res->port_id].param.max_flow_num =
- res->flow_num;
+cmdline_parse_inst_t cmd_gro_show = {
+ .f = cmd_gro_show_parsed,
+ .data = NULL,
+ .help_str = "show port <port_id> gro",
+ .tokens = {
+ (void *)&cmd_gro_show_show,
+ (void *)&cmd_gro_show_port,
+ (void *)&cmd_gro_show_pid,
+ (void *)&cmd_gro_show_keyword,
+ NULL,
+ },
+};
- if (res->item_num_per_flow == 0)
- printf("Invalid item number per-flow. Revert"
- " to default value:%u.\n",
- GRO_DEFAULT_ITEM_NUM_PER_FLOW);
- else
- gro_ports[res->port_id].param.max_item_per_flow =
- res->item_num_per_flow;
- }
+/* *** SET FLUSH CYCLES FOR GRO *** */
+struct cmd_gro_flush_result {
+ cmdline_fixed_string_t cmd_set;
+ cmdline_fixed_string_t cmd_keyword;
+ cmdline_fixed_string_t cmd_flush;
+ uint8_t cmd_cycles;
+};
+
+static void
+cmd_gro_flush_parsed(void *parsed_result,
+ __attribute__((unused)) struct cmdline *cl,
+ __attribute__((unused)) void *data)
+{
+ struct cmd_gro_flush_result *res;
+
+ res = parsed_result;
+ if ((!strcmp(res->cmd_keyword, "gro")) &&
+ (!strcmp(res->cmd_flush, "flush")))
+ setup_gro_flush_cycles(res->cmd_cycles);
}
-cmdline_parse_token_string_t cmd_gro_set_gro =
- TOKEN_STRING_INITIALIZER(struct cmd_gro_set_result,
- gro, "gro");
-cmdline_parse_token_string_t cmd_gro_set_mode =
- TOKEN_STRING_INITIALIZER(struct cmd_gro_set_result,
- mode, "set");
-cmdline_parse_token_num_t cmd_gro_set_flow_num =
- TOKEN_NUM_INITIALIZER(struct cmd_gro_set_result,
- flow_num, UINT16);
-cmdline_parse_token_num_t cmd_gro_set_item_num_per_flow =
- TOKEN_NUM_INITIALIZER(struct cmd_gro_set_result,
- item_num_per_flow, UINT16);
-cmdline_parse_token_num_t cmd_gro_set_portid =
- TOKEN_NUM_INITIALIZER(struct cmd_gro_set_result,
- port_id, UINT8);
+cmdline_parse_token_string_t cmd_gro_flush_set =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_flush_result,
+ cmd_set, "set");
+cmdline_parse_token_string_t cmd_gro_flush_keyword =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_flush_result,
+ cmd_keyword, "gro");
+cmdline_parse_token_string_t cmd_gro_flush_flush =
+ TOKEN_STRING_INITIALIZER(struct cmd_gro_flush_result,
+ cmd_flush, "flush");
+cmdline_parse_token_num_t cmd_gro_flush_cycles =
+ TOKEN_NUM_INITIALIZER(struct cmd_gro_flush_result,
+ cmd_cycles, UINT8);
-cmdline_parse_inst_t cmd_gro_set = {
- .f = cmd_gro_set_parsed,
+cmdline_parse_inst_t cmd_gro_flush = {
+ .f = cmd_gro_flush_parsed,
.data = NULL,
- .help_str = "gro set <max_flow_num> <max_item_num_per_flow> "
- "<port_id>: set max flow number and max packet number per-flow "
- "for GRO",
+ .help_str = "set gro flush <cycles>",
.tokens = {
- (void *)&cmd_gro_set_gro,
- (void *)&cmd_gro_set_mode,
- (void *)&cmd_gro_set_flow_num,
- (void *)&cmd_gro_set_item_num_per_flow,
- (void *)&cmd_gro_set_portid,
+ (void *)&cmd_gro_flush_set,
+ (void *)&cmd_gro_flush_keyword,
+ (void *)&cmd_gro_flush_flush,
+ (void *)&cmd_gro_flush_cycles,
NULL,
},
};
(cmdline_parse_inst_t *)&cmd_tso_show,
(cmdline_parse_inst_t *)&cmd_tunnel_tso_set,
(cmdline_parse_inst_t *)&cmd_tunnel_tso_show,
- (cmdline_parse_inst_t *)&cmd_enable_gro,
- (cmdline_parse_inst_t *)&cmd_gro_set,
+ (cmdline_parse_inst_t *)&cmd_gro_enable,
+ (cmdline_parse_inst_t *)&cmd_gro_flush,
+ (cmdline_parse_inst_t *)&cmd_gro_show,
(cmdline_parse_inst_t *)&cmd_link_flow_control_set,
(cmdline_parse_inst_t *)&cmd_link_flow_control_set_rx,
(cmdline_parse_inst_t *)&cmd_link_flow_control_set_tx,
}
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);
" 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);
+}
+
char*
list_pkt_forwarding_modes(void)
{
testpmd> tso show (port_id)
-gro
-~~~
+set port - gro
+~~~~~~~~~~~~~~
Enable or disable GRO in ``csum`` forwarding engine::
- testpmd> gro (on|off) (port_id)
+ testpmd> set port <port_id> gro on|off
If enabled, the csum forwarding engine will perform GRO on the TCP/IPv4
packets received from the given port.
.. note::
When enable GRO for a port, TCP/IPv4 packets received from the port
- will be performed GRO. After GRO, the merged packets are multi-segments.
- But csum forwarding engine doesn't support to calculate TCP checksum
- for multi-segment packets in SW. So please select TCP HW checksum
- calculation for the port which GROed packets are transmitted to.
+ will be performed GRO. After GRO, all merged packets have bad
+ checksums, since the GRO library doesn't re-calculate checksums for
+ the merged packets. Therefore, if users want the merged packets to
+ have correct checksums, please select HW IP checksum calculation and
+ HW TCP checksum calculation for the port which the merged packets are
+ transmitted to.
+
+show port - gro
+~~~~~~~~~~~~~~~
-gro set
-~~~~~~~
+Display GRO configuration for a given port::
+
+ testpmd> show port <port_id> gro
+
+set gro flush
+~~~~~~~~~~~~~
+
+Set the cycle to flush the GROed packets from reassembly tables::
+
+ testpmd> set gro flush <cycles>
-Set max flow number and max packet number per-flow for GRO::
+When enable GRO, the csum forwarding engine performs GRO on received
+packets, and the GROed packets are stored in reassembly tables. Users
+can use this command to determine when the GROed packets are flushed
+from the reassembly tables.
- testpmd> gro set (max_flow_num) (max_item_num_per_flow) (port_id)
+The ``cycles`` is measured in GRO operation times. The csum forwarding
+engine flushes the GROed packets from the tables every ``cycles`` GRO
+operations.
-The product of ``max_flow_num`` and ``max_item_num_per_flow`` is the max
-number of packets a GRO table can store.
+By default, the value of ``cycles`` is 1, which means flush GROed packets
+from the reassembly tables as soon as one GRO operation finishes. The value
+of ``cycles`` should be in the range of 1 to ``GRO_MAX_FLUSH_CYCLES``.
-If current packet number is greater than or equal to the max value, GRO
-will stop processing incoming packets.
+Please note that the large value of ``cycles`` may cause the poor TCP/IP
+stack performance. Because the GROed packets are delayed to arrive the
+stack, thus causing more duplicated ACKs and TCP retransmissions.
mac_addr add
~~~~~~~~~~~~