__attribute__((unused)) void *data)
{
struct cmd_config_max_pkt_len_result *res = parsed_result;
+ uint64_t rx_offloads = rx_mode.offloads;
if (!all_ports_stopped()) {
printf("Please stop all ports first\n");
rx_mode.max_rx_pkt_len = res->value;
if (res->value > ETHER_MAX_LEN)
- rx_mode.jumbo_frame = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
else
- rx_mode.jumbo_frame = 0;
+ 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;
if (!all_ports_stopped()) {
printf("Please stop all ports first\n");
if (!strcmp(res->name, "crc-strip")) {
if (!strcmp(res->value, "on"))
- rx_mode.hw_strip_crc = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_CRC_STRIP;
else if (!strcmp(res->value, "off"))
- rx_mode.hw_strip_crc = 0;
+ 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_mode.enable_scatter = 1;
- else if (!strcmp(res->value, "off"))
- rx_mode.enable_scatter = 0;
- else {
+ 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_mode.hw_ip_checksum = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM;
else if (!strcmp(res->value, "off"))
- rx_mode.hw_ip_checksum = 0;
+ 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_mode.hw_timestamp = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
else if (!strcmp(res->value, "off"))
- rx_mode.hw_timestamp = 0;
+ 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_mode.hw_vlan_filter = 1;
- rx_mode.hw_vlan_strip = 1;
+ rx_offloads |= (DEV_RX_OFFLOAD_VLAN_FILTER |
+ DEV_RX_OFFLOAD_VLAN_STRIP);
}
else if (!strcmp(res->value, "off")) {
- rx_mode.hw_vlan_filter = 0;
- rx_mode.hw_vlan_strip = 0;
+ rx_offloads &= ~(DEV_RX_OFFLOAD_VLAN_FILTER |
+ DEV_RX_OFFLOAD_VLAN_STRIP);
}
else {
printf("Unknown parameter\n");
}
} else if (!strcmp(res->name, "hw-vlan-filter")) {
if (!strcmp(res->value, "on"))
- rx_mode.hw_vlan_filter = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
else if (!strcmp(res->value, "off"))
- rx_mode.hw_vlan_filter = 0;
+ 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_mode.hw_vlan_strip = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
else if (!strcmp(res->value, "off"))
- rx_mode.hw_vlan_strip = 0;
+ 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_mode.hw_vlan_extend = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_VLAN_EXTEND;
else if (!strcmp(res->value, "off"))
- rx_mode.hw_vlan_extend = 0;
+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND;
else {
printf("Unknown parameter\n");
return;
printf("Unknown parameter\n");
return;
}
+ rx_mode.offloads = rx_offloads;
init_port_config();
void
port_offload_cap_display(portid_t port_id)
{
- struct rte_eth_dev *dev;
struct rte_eth_dev_info dev_info;
static const char *info_border = "************";
if (port_id_is_invalid(port_id, ENABLED_WARN))
return;
- dev = &rte_eth_devices[port_id];
rte_eth_dev_info_get(port_id, &dev_info);
printf("\n%s Port %d supported offload features: %s\n",
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_VLAN_STRIP) {
printf("VLAN stripped: ");
- if (dev->data->dev_conf.rxmode.hw_vlan_strip)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_VLAN_STRIP)
printf("on\n");
else
printf("off\n");
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_QINQ_STRIP) {
printf("Double VLANs stripped: ");
- if (dev->data->dev_conf.rxmode.hw_vlan_extend)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_VLAN_EXTEND)
printf("on\n");
else
printf("off\n");
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_IPV4_CKSUM) {
printf("RX IPv4 checksum: ");
- if (dev->data->dev_conf.rxmode.hw_ip_checksum)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_IPV4_CKSUM)
printf("on\n");
else
printf("off\n");
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_UDP_CKSUM) {
printf("RX UDP checksum: ");
- if (dev->data->dev_conf.rxmode.hw_ip_checksum)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_UDP_CKSUM)
printf("on\n");
else
printf("off\n");
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_CKSUM) {
printf("RX TCP checksum: ");
- if (dev->data->dev_conf.rxmode.hw_ip_checksum)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_TCP_CKSUM)
printf("on\n");
else
printf("off\n");
}
- if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM)
- printf("RX Outer IPv4 checksum: on");
+ if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM) {
+ printf("RX Outer IPv4 checksum: ");
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM)
+ printf("on\n");
+ else
+ printf("off\n");
+ }
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TCP_LRO) {
printf("Large receive offload: ");
- if (dev->data->dev_conf.rxmode.enable_lro)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_TCP_LRO)
printf("on\n");
else
printf("off\n");
if (dev_info.rx_offload_capa & DEV_RX_OFFLOAD_TIMESTAMP) {
printf("HW timestamp: ");
- if (dev->data->dev_conf.rxmode.hw_timestamp)
+ if (ports[port_id].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_TIMESTAMP)
printf("on\n");
else
printf("off\n");
printf(" port %d:\n", (unsigned int)pid);
printf(" CRC stripping %s\n",
- ports[pid].dev_conf.rxmode.hw_strip_crc ?
+ (ports[pid].dev_conf.rxmode.offloads &
+ DEV_RX_OFFLOAD_CRC_STRIP) ?
"enabled" : "disabled");
printf(" RX queues=%d - RX desc=%d - RX free threshold=%d\n",
nb_rxq, nb_rxd, rx_conf->rx_free_thresh);
char **argvopt;
int opt_idx;
enum { TX, RX };
+ /* Default Rx offloads for all ports. */
+ uint64_t rx_offloads = rx_mode.offloads;
static struct option lgopts[] = {
{ "help", 0, 0, 0 },
if (n >= ETHER_MIN_LEN) {
rx_mode.max_rx_pkt_len = (uint32_t) n;
if (n > ETHER_MAX_LEN)
- rx_mode.jumbo_frame = 1;
+ rx_offloads |=
+ DEV_RX_OFFLOAD_JUMBO_FRAME;
} else
rte_exit(EXIT_FAILURE,
"Invalid max-pkt-len=%d - should be > %d\n",
}
#endif
if (!strcmp(lgopts[opt_idx].name, "disable-crc-strip"))
- rx_mode.hw_strip_crc = 0;
+ rx_offloads &= ~DEV_RX_OFFLOAD_CRC_STRIP;
if (!strcmp(lgopts[opt_idx].name, "enable-lro"))
- rx_mode.enable_lro = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_TCP_LRO;
if (!strcmp(lgopts[opt_idx].name, "enable-scatter"))
- rx_mode.enable_scatter = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_SCATTER;
if (!strcmp(lgopts[opt_idx].name, "enable-rx-cksum"))
- rx_mode.hw_ip_checksum = 1;
+ rx_offloads |= DEV_RX_OFFLOAD_CHECKSUM;
if (!strcmp(lgopts[opt_idx].name,
"enable-rx-timestamp"))
- rx_mode.hw_timestamp = 1;
-
- if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan")) {
- rx_mode.hw_vlan_filter = 0;
- rx_mode.hw_vlan_strip = 0;
- rx_mode.hw_vlan_extend = 0;
- }
+ rx_offloads |= DEV_RX_OFFLOAD_TIMESTAMP;
+ if (!strcmp(lgopts[opt_idx].name, "disable-hw-vlan"))
+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN;
if (!strcmp(lgopts[opt_idx].name,
"disable-hw-vlan-filter"))
- rx_mode.hw_vlan_filter = 0;
+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_FILTER;
if (!strcmp(lgopts[opt_idx].name,
"disable-hw-vlan-strip"))
- rx_mode.hw_vlan_strip = 0;
+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
if (!strcmp(lgopts[opt_idx].name,
"disable-hw-vlan-extend"))
- rx_mode.hw_vlan_extend = 0;
+ rx_offloads &= ~DEV_RX_OFFLOAD_VLAN_EXTEND;
if (!strcmp(lgopts[opt_idx].name, "enable-drop-en"))
rx_drop_en = 1;
break;
}
}
+
+ /* Set offload configuration from command line parameters. */
+ rx_mode.offloads = rx_offloads;
}
*/
struct rte_eth_rxmode rx_mode = {
.max_rx_pkt_len = ETHER_MAX_LEN, /**< Default maximum frame length. */
- .split_hdr_size = 0,
- .header_split = 0, /**< Header Split disabled. */
- .hw_ip_checksum = 0, /**< IP checksum offload disabled. */
- .hw_vlan_filter = 1, /**< VLAN filtering enabled. */
- .hw_vlan_strip = 1, /**< VLAN strip enabled. */
- .hw_vlan_extend = 0, /**< Extended VLAN disabled. */
- .jumbo_frame = 0, /**< Jumbo Frame Support disabled. */
- .hw_strip_crc = 1, /**< CRC stripping by hardware enabled. */
- .hw_timestamp = 0, /**< HW timestamp enabled. */
+ .offloads = (DEV_RX_OFFLOAD_VLAN_FILTER |
+ DEV_RX_OFFLOAD_VLAN_STRIP |
+ DEV_RX_OFFLOAD_CRC_STRIP),
+ .ignore_offload_bitfield = 1,
};
struct rte_fdir_conf fdir_conf = {
port->need_reconfig_queues = 1;
return -1;
}
+ /* Apply Rx offloads configuration */
+ port->rx_conf.offloads = port->dev_conf.rxmode.offloads;
/* setup rx queues */
for (qi = 0; qi < nb_rxq; qi++) {
if ((numa_support) &&
retval = get_eth_dcb_conf(&port_conf, dcb_mode, num_tcs, pfc_en);
if (retval < 0)
return retval;
- port_conf.rxmode.hw_vlan_filter = 1;
+ port_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
/**
* Write the configuration into the device.
rxtx_port_config(rte_port);
/* VLAN filter */
- rte_port->dev_conf.rxmode.hw_vlan_filter = 1;
+ rte_port->dev_conf.rxmode.offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
for (i = 0; i < RTE_DIM(vlan_tags); i++)
rx_vft_set(pid, vlan_tags[i], 1);