__attribute__((unused)) void *data)
{
struct cmd_config_max_pkt_len_result *res = parsed_result;
- uint64_t rx_offloads = rx_mode.offloads;
+ portid_t pid;
if (!all_ports_stopped()) {
printf("Please stop all ports first\n");
return;
}
- if (!strcmp(res->name, "max-pkt-len")) {
- if (res->value < ETHER_MIN_LEN) {
- printf("max-pkt-len can not be less than %d\n",
- ETHER_MIN_LEN);
+ RTE_ETH_FOREACH_DEV(pid) {
+ struct rte_port *port = &ports[pid];
+ uint64_t rx_offloads = port->dev_conf.rxmode.offloads;
+
+ if (!strcmp(res->name, "max-pkt-len")) {
+ if (res->value < ETHER_MIN_LEN) {
+ printf("max-pkt-len can not be less than %d\n",
+ ETHER_MIN_LEN);
+ return;
+ }
+ if (res->value == port->dev_conf.rxmode.max_rx_pkt_len)
+ return;
+
+ port->dev_conf.rxmode.max_rx_pkt_len = res->value;
+ if (res->value > ETHER_MAX_LEN)
+ rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+ else
+ rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
+ port->dev_conf.rxmode.offloads = rx_offloads;
+ } else {
+ printf("Unknown parameter\n");
return;
}
- if (res->value == rx_mode.max_rx_pkt_len)
- return;
-
- rx_mode.max_rx_pkt_len = res->value;
- if (res->value > ETHER_MAX_LEN)
- rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
- else
- rx_offloads &= ~DEV_RX_OFFLOAD_JUMBO_FRAME;
- } else {
- printf("Unknown parameter\n");
- return;
}
- rx_mode.offloads = rx_offloads;
-
init_port_config();
cmd_reconfig_device_queue(RTE_PORT_ALL, 1, 1);
__attribute__((unused)) void *data)
{
struct cmd_config_rx_mode_flag *res = parsed_result;
- uint64_t rx_offloads = rx_mode.offloads;
+ portid_t pid;
if (!all_ports_stopped()) {
printf("Please stop all ports first\n");
return;
}
- if (!strcmp(res->name, "crc-strip")) {
- if (!strcmp(res->value, "on"))
- rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
- else if (!strcmp(res->value, "off"))
- rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "scatter")) {
- if (!strcmp(res->value, "on")) {
- rx_offloads |= DEV_RX_OFFLOAD_SCATTER;
- } else if (!strcmp(res->value, "off")) {
- rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER;
+ RTE_ETH_FOREACH_DEV(pid) {
+ struct rte_port *port;
+ uint64_t rx_offloads;
+
+ port = &ports[pid];
+ rx_offloads = port->dev_conf.rxmode.offloads;
+ if (!strcmp(res->name, "crc-strip")) {
+ if (!strcmp(res->value, "on"))
+ rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
+ else if (!strcmp(res->value, "off"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "scatter")) {
+ if (!strcmp(res->value, "on")) {
+ rx_offloads |= DEV_RX_OFFLOAD_SCATTER;
+ } else if (!strcmp(res->value, "off")) {
+ rx_offloads &= ~DEV_RX_OFFLOAD_SCATTER;
+ } else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "rx-cksum")) {
+ if (!strcmp(res->value, "on"))
+ rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM;
+ else if (!strcmp(res->value, "off"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "rx-timestamp")) {
+ if (!strcmp(res->value, "on"))
+ rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
+ else if (!strcmp(res->value, "off"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "hw-vlan")) {
+ if (!strcmp(res->value, "on")) {
+ rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER |
+ DEV_RX_OFFLOAD_VLAN_STRIP);
+ } else if (!strcmp(res->value, "off")) {
+ rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER |
+ DEV_RX_OFFLOAD_VLAN_STRIP);
+ } else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "hw-vlan-filter")) {
+ if (!strcmp(res->value, "on"))
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
+ else if (!strcmp(res->value, "off"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "hw-vlan-strip")) {
+ if (!strcmp(res->value, "on"))
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
+ else if (!strcmp(res->value, "off"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "hw-vlan-extend")) {
+ if (!strcmp(res->value, "on"))
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
+ else if (!strcmp(res->value, "off"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
+ } else if (!strcmp(res->name, "drop-en")) {
+ if (!strcmp(res->value, "on"))
+ rx_drop_en = 1;
+ else if (!strcmp(res->value, "off"))
+ rx_drop_en = 0;
+ else {
+ printf("Unknown parameter\n");
+ return;
+ }
} else {
printf("Unknown parameter\n");
return;
}
- } else if (!strcmp(res->name, "rx-cksum")) {
- if (!strcmp(res->value, "on"))
- rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM;
- else if (!strcmp(res->value, "off"))
- rx_offloads &= ~DEV_RX_OFFLOAD_CHECKSUM;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "rx-timestamp")) {
- if (!strcmp(res->value, "on"))
- rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
- else if (!strcmp(res->value, "off"))
- rx_offloads &= ~DEV_RX_OFFLOAD_TIMESTAMP;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "hw-vlan")) {
- if (!strcmp(res->value, "on")) {
- rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER |
- DEV_RX_OFFLOAD_VLAN_STRIP);
- }
- else if (!strcmp(res->value, "off")) {
- rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER |
- DEV_RX_OFFLOAD_VLAN_STRIP);
- }
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "hw-vlan-filter")) {
- if (!strcmp(res->value, "on"))
- rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
- else if (!strcmp(res->value, "off"))
- rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "hw-vlan-strip")) {
- if (!strcmp(res->value, "on"))
- rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
- else if (!strcmp(res->value, "off"))
- rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "hw-vlan-extend")) {
- if (!strcmp(res->value, "on"))
- rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
- else if (!strcmp(res->value, "off"))
- rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else if (!strcmp(res->name, "drop-en")) {
- if (!strcmp(res->value, "on"))
- rx_drop_en = 1;
- else if (!strcmp(res->value, "off"))
- rx_drop_en = 0;
- else {
- printf("Unknown parameter\n");
- return;
- }
- } else {
- printf("Unknown parameter\n");
- return;
+ port->dev_conf.rxmode.offloads = rx_offloads;
}
- rx_mode.offloads = rx_offloads;
init_port_config();
{
int diag;
int vlan_offload;
+ uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
- if (on)
+ if (on) {
vlan_offload |= ETH_VLAN_EXTEND_OFFLOAD;
- else
+ port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
+ } else {
vlan_offload &= ~ETH_VLAN_EXTEND_OFFLOAD;
+ port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND;
+ }
diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
if (diag < 0)
printf("rx_vlan_extend_set(port_pi=%d, on=%d) failed "
"diag=%d\n", port_id, on, diag);
+ ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
}
void
{
int diag;
int vlan_offload;
+ uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
- if (on)
+ if (on) {
vlan_offload |= ETH_VLAN_STRIP_OFFLOAD;
- else
+ port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
+ } else {
vlan_offload &= ~ETH_VLAN_STRIP_OFFLOAD;
+ port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
+ }
diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
if (diag < 0)
printf("rx_vlan_strip_set(port_pi=%d, on=%d) failed "
"diag=%d\n", port_id, on, diag);
+ ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
}
void
{
int diag;
int vlan_offload;
+ uint64_t port_rx_offloads = ports[port_id].dev_conf.rxmode.offloads;
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
vlan_offload = rte_eth_dev_get_vlan_offload(port_id);
- if (on)
+ if (on) {
vlan_offload |= ETH_VLAN_FILTER_OFFLOAD;
- else
+ port_rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
+ } else {
vlan_offload &= ~ETH_VLAN_FILTER_OFFLOAD;
+ port_rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER;
+ }
diag = rte_eth_dev_set_vlan_offload(port_id, vlan_offload);
if (diag < 0)
printf("rx_vlan_filter_set(port_pi=%d, on=%d) failed "
"diag=%d\n", port_id, on, diag);
+ ports[port_id].dev_conf.rxmode.offloads = port_rx_offloads;
}
int