ETH_LINK_SPEED_100G;
/*
- * Per-queue capabilities. Actually most of the offloads are enabled
- * by default on the port and can be used on selected queues (by adding
- * packet flags at runtime when required)
+ * Per-queue capabilities
+ * RTE does not support disabling a feature on a queue if it is
+ * enabled globally on the device. Thus the driver does not advertise
+ * capabilities like DEV_TX_OFFLOAD_IPV4_CKSUM as per-queue even
+ * though the driver would be otherwise capable of disabling it on
+ * a per-queue basis.
*/
- dev_info->rx_queue_offload_capa =
- DEV_RX_OFFLOAD_IPV4_CKSUM |
- DEV_RX_OFFLOAD_UDP_CKSUM |
- DEV_RX_OFFLOAD_TCP_CKSUM |
- 0;
-
- dev_info->tx_queue_offload_capa =
- DEV_TX_OFFLOAD_IPV4_CKSUM |
- DEV_TX_OFFLOAD_UDP_CKSUM |
- DEV_TX_OFFLOAD_TCP_CKSUM |
- DEV_TX_OFFLOAD_VLAN_INSERT |
- DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
- DEV_TX_OFFLOAD_OUTER_UDP_CKSUM |
- 0;
+ dev_info->rx_queue_offload_capa = 0;
+ dev_info->tx_queue_offload_capa = 0;
/*
* Per-port capabilities
*/
dev_info->rx_offload_capa = dev_info->rx_queue_offload_capa |
+ DEV_RX_OFFLOAD_IPV4_CKSUM |
+ DEV_RX_OFFLOAD_UDP_CKSUM |
+ DEV_RX_OFFLOAD_TCP_CKSUM |
DEV_RX_OFFLOAD_JUMBO_FRAME |
DEV_RX_OFFLOAD_VLAN_FILTER |
DEV_RX_OFFLOAD_VLAN_STRIP |
DEV_RX_OFFLOAD_SCATTER |
+ DEV_RX_OFFLOAD_RSS_HASH |
0;
dev_info->tx_offload_capa = dev_info->tx_queue_offload_capa |
+ DEV_TX_OFFLOAD_IPV4_CKSUM |
+ DEV_TX_OFFLOAD_UDP_CKSUM |
+ DEV_TX_OFFLOAD_TCP_CKSUM |
+ DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
+ DEV_TX_OFFLOAD_OUTER_UDP_CKSUM |
DEV_TX_OFFLOAD_MULTI_SEGS |
DEV_TX_OFFLOAD_TCP_TSO |
+ DEV_TX_OFFLOAD_VLAN_INSERT |
0;
dev_info->rx_desc_lim = rx_desc_lim;
dev_info->default_rxportconf.ring_size = IONIC_DEF_TXRX_DESC;
dev_info->default_txportconf.ring_size = IONIC_DEF_TXRX_DESC;
+ dev_info->default_rxconf = (struct rte_eth_rxconf) {
+ /* Packets are always dropped if no desc are available */
+ .rx_drop_en = 1,
+ };
+
return 0;
}
ionic_vlan_offload_set(struct rte_eth_dev *eth_dev, int mask)
{
struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
- struct rte_eth_rxmode *rxmode;
- rxmode = ð_dev->data->dev_conf.rxmode;
- int i;
-
- if (mask & ETH_VLAN_STRIP_MASK) {
- if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP) {
- for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
- struct ionic_qcq *rxq =
- eth_dev->data->rx_queues[i];
- rxq->offloads |= DEV_RX_OFFLOAD_VLAN_STRIP;
- }
- lif->features |= IONIC_ETH_HW_VLAN_RX_STRIP;
- } else {
- for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
- struct ionic_qcq *rxq =
- eth_dev->data->rx_queues[i];
- rxq->offloads &= ~DEV_RX_OFFLOAD_VLAN_STRIP;
- }
- lif->features &= ~IONIC_ETH_HW_VLAN_RX_STRIP;
- }
- }
- if (mask & ETH_VLAN_FILTER_MASK) {
- if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_FILTER)
- lif->features |= IONIC_ETH_HW_VLAN_RX_FILTER;
- else
- lif->features &= ~IONIC_ETH_HW_VLAN_RX_FILTER;
- }
+ ionic_lif_configure_vlan_offload(lif, mask);
ionic_lif_set_features(lif);
ionic_dev_configure(struct rte_eth_dev *eth_dev)
{
struct ionic_lif *lif = IONIC_ETH_DEV_TO_LIF(eth_dev);
- int err;
IONIC_PRINT_CALL();
- err = ionic_lif_configure(lif);
- if (err) {
- IONIC_PRINT(ERR, "Cannot configure LIF: %d", err);
- return err;
- }
+ ionic_lif_configure(lif);
+
+ ionic_lif_set_features(lif);
return 0;
}
if (err)
goto err_out_adminq_deinit;
- lif->features =
- IONIC_ETH_HW_VLAN_TX_TAG
- | IONIC_ETH_HW_VLAN_RX_STRIP
- | IONIC_ETH_HW_VLAN_RX_FILTER
- | IONIC_ETH_HW_RX_HASH
- | IONIC_ETH_HW_TX_SG
- | IONIC_ETH_HW_RX_SG
- | IONIC_ETH_HW_TX_CSUM
- | IONIC_ETH_HW_RX_CSUM
- | IONIC_ETH_HW_TSO
- | IONIC_ETH_HW_TSO_IPV6
- | IONIC_ETH_HW_TSO_ECN;
+ /*
+ * Configure initial feature set
+ * This will be updated later by the dev_configure() step
+ */
+ lif->features = IONIC_ETH_HW_RX_HASH | IONIC_ETH_HW_VLAN_RX_FILTER;
err = ionic_lif_set_features(lif);
if (err)
lif->state &= ~IONIC_LIF_F_INITED;
}
-int
+void
+ionic_lif_configure_vlan_offload(struct ionic_lif *lif, int mask)
+{
+ struct rte_eth_dev *eth_dev = lif->eth_dev;
+ struct rte_eth_rxmode *rxmode = ð_dev->data->dev_conf.rxmode;
+
+ /*
+ * IONIC_ETH_HW_VLAN_RX_FILTER cannot be turned off, so
+ * set DEV_RX_OFFLOAD_VLAN_FILTER and ignore ETH_VLAN_FILTER_MASK
+ */
+ rxmode->offloads |= DEV_RX_OFFLOAD_VLAN_FILTER;
+
+ if (mask & ETH_VLAN_STRIP_MASK) {
+ if (rxmode->offloads & DEV_RX_OFFLOAD_VLAN_STRIP)
+ lif->features |= IONIC_ETH_HW_VLAN_RX_STRIP;
+ else
+ lif->features &= ~IONIC_ETH_HW_VLAN_RX_STRIP;
+ }
+}
+
+void
ionic_lif_configure(struct ionic_lif *lif)
{
+ struct rte_eth_rxmode *rxmode = &lif->eth_dev->data->dev_conf.rxmode;
+ struct rte_eth_txmode *txmode = &lif->eth_dev->data->dev_conf.txmode;
struct ionic_identity *ident = &lif->adapter->ident;
uint32_t ntxqs_per_lif =
ident->lif.eth.config.queue_count[IONIC_QTYPE_TXQ];
lif->nrxqcqs = nrxqs_per_lif;
lif->ntxqcqs = ntxqs_per_lif;
- return 0;
+ /* Update the LIF configuration based on the eth_dev */
+
+ /*
+ * NB: While it is true that RSS_HASH is always enabled on ionic,
+ * setting this flag unconditionally causes problems in DTS.
+ * rxmode->offloads |= DEV_RX_OFFLOAD_RSS_HASH;
+ */
+
+ /* RX per-port */
+
+ if (rxmode->offloads & DEV_RX_OFFLOAD_IPV4_CKSUM ||
+ rxmode->offloads & DEV_RX_OFFLOAD_UDP_CKSUM ||
+ rxmode->offloads & DEV_RX_OFFLOAD_TCP_CKSUM)
+ lif->features |= IONIC_ETH_HW_RX_CSUM;
+ else
+ lif->features &= ~IONIC_ETH_HW_RX_CSUM;
+
+ if (rxmode->offloads & DEV_RX_OFFLOAD_SCATTER) {
+ lif->features |= IONIC_ETH_HW_RX_SG;
+ lif->eth_dev->data->scattered_rx = 1;
+ } else {
+ lif->features &= ~IONIC_ETH_HW_RX_SG;
+ lif->eth_dev->data->scattered_rx = 0;
+ }
+
+ /* Covers VLAN_STRIP */
+ ionic_lif_configure_vlan_offload(lif, ETH_VLAN_STRIP_MASK);
+
+ /* TX per-port */
+
+ if (txmode->offloads & DEV_TX_OFFLOAD_IPV4_CKSUM ||
+ txmode->offloads & DEV_TX_OFFLOAD_UDP_CKSUM ||
+ txmode->offloads & DEV_TX_OFFLOAD_TCP_CKSUM ||
+ txmode->offloads & DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM ||
+ txmode->offloads & DEV_TX_OFFLOAD_OUTER_UDP_CKSUM)
+ lif->features |= IONIC_ETH_HW_TX_CSUM;
+ else
+ lif->features &= ~IONIC_ETH_HW_TX_CSUM;
+
+ if (txmode->offloads & DEV_TX_OFFLOAD_VLAN_INSERT)
+ lif->features |= IONIC_ETH_HW_VLAN_TX_TAG;
+ else
+ lif->features &= ~IONIC_ETH_HW_VLAN_TX_TAG;
+
+ if (txmode->offloads & DEV_TX_OFFLOAD_MULTI_SEGS)
+ lif->features |= IONIC_ETH_HW_TX_SG;
+ else
+ lif->features &= ~IONIC_ETH_HW_TX_SG;
+
+ if (txmode->offloads & DEV_TX_OFFLOAD_TCP_TSO) {
+ lif->features |= IONIC_ETH_HW_TSO;
+ lif->features |= IONIC_ETH_HW_TSO_IPV6;
+ lif->features |= IONIC_ETH_HW_TSO_ECN;
+ } else {
+ lif->features &= ~IONIC_ETH_HW_TSO;
+ lif->features &= ~IONIC_ETH_HW_TSO_IPV6;
+ lif->features &= ~IONIC_ETH_HW_TSO_ECN;
+ }
}
int
int ionic_lif_start(struct ionic_lif *lif);
void ionic_lif_stop(struct ionic_lif *lif);
-int ionic_lif_configure(struct ionic_lif *lif);
+void ionic_lif_configure(struct ionic_lif *lif);
+void ionic_lif_configure_vlan_offload(struct ionic_lif *lif, int mask);
void ionic_lif_reset(struct ionic_lif *lif);
int ionic_intr_alloc(struct ionic_lif *lif, struct ionic_intr_info *intr);
"Configuring skt %u RX queue %u with %u buffers, offloads %jx",
socket_id, rx_queue_id, nb_desc, offloads);
+ if (!rx_conf->rx_drop_en)
+ IONIC_PRINT(WARNING, "No-drop mode is not supported");
+
/* Validate number of receive descriptors */
if (!rte_is_power_of_2(nb_desc) ||
nb_desc < IONIC_MIN_RING_DESC ||
return -EINVAL; /* or use IONIC_DEFAULT_RING_DESC */
}
- if (rx_conf->offloads & DEV_RX_OFFLOAD_SCATTER)
- eth_dev->data->scattered_rx = 1;
-
/* Free memory prior to re-allocation if needed... */
if (eth_dev->data->rx_queues[rx_queue_id] != NULL) {
void *rx_queue = eth_dev->data->rx_queues[rx_queue_id];