net/sfc: check configured Rx mode
authorAndrew Rybchenko <arybchenko@solarflare.com>
Tue, 29 Nov 2016 16:19:16 +0000 (16:19 +0000)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 17 Jan 2017 18:39:26 +0000 (19:39 +0100)
Signed-off-by: Andrew Rybchenko <arybchenko@solarflare.com>
Reviewed-by: Andy Moreton <amoreton@solarflare.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
doc/guides/nics/sfc_efx.rst
drivers/net/sfc/sfc_rx.c

index 46c892b..87b217f 100644 (file)
@@ -60,6 +60,18 @@ The features not yet supported include:
 
 - Loopback
 
+- Configurable RX CRC stripping (always stripped)
+
+- Header split on receive
+
+- VLAN filtering
+
+- VLAN stripping
+
+- Scattered receive
+
+- LRO
+
 
 Supported NICs
 --------------
index e2c7d00..88e3319 100644 (file)
@@ -47,6 +47,61 @@ sfc_rx_qinit_info(struct sfc_adapter *sa, unsigned int sw_index)
        return 0;
 }
 
+static int
+sfc_rx_check_mode(struct sfc_adapter *sa, struct rte_eth_rxmode *rxmode)
+{
+       int rc = 0;
+
+       switch (rxmode->mq_mode) {
+       case ETH_MQ_RX_NONE:
+               /* No special checks are required */
+               break;
+       default:
+               sfc_err(sa, "Rx multi-queue mode %u not supported",
+                       rxmode->mq_mode);
+               rc = EINVAL;
+       }
+
+       if (rxmode->header_split) {
+               sfc_err(sa, "Header split on Rx not supported");
+               rc = EINVAL;
+       }
+
+       if (rxmode->hw_vlan_filter) {
+               sfc_err(sa, "HW VLAN filtering not supported");
+               rc = EINVAL;
+       }
+
+       if (rxmode->hw_vlan_strip) {
+               sfc_err(sa, "HW VLAN stripping not supported");
+               rc = EINVAL;
+       }
+
+       if (rxmode->hw_vlan_extend) {
+               sfc_err(sa,
+                       "Q-in-Q HW VLAN stripping not supported");
+               rc = EINVAL;
+       }
+
+       if (!rxmode->hw_strip_crc) {
+               sfc_warn(sa,
+                        "FCS stripping control not supported - always stripped");
+               rxmode->hw_strip_crc = 1;
+       }
+
+       if (rxmode->enable_scatter) {
+               sfc_err(sa, "Scatter on Rx not supported");
+               rc = EINVAL;
+       }
+
+       if (rxmode->enable_lro) {
+               sfc_err(sa, "LRO not supported");
+               rc = EINVAL;
+       }
+
+       return rc;
+}
+
 /**
  * Initialize Rx subsystem.
  *
@@ -58,9 +113,14 @@ sfc_rx_qinit_info(struct sfc_adapter *sa, unsigned int sw_index)
 int
 sfc_rx_init(struct sfc_adapter *sa)
 {
+       struct rte_eth_conf *dev_conf = &sa->eth_dev->data->dev_conf;
        unsigned int sw_index;
        int rc;
 
+       rc = sfc_rx_check_mode(sa, &dev_conf->rxmode);
+       if (rc != 0)
+               goto fail_check_mode;
+
        sa->rxq_count = sa->eth_dev->data->nb_rx_queues;
 
        rc = ENOMEM;
@@ -84,6 +144,7 @@ fail_rx_qinit_info:
 
 fail_rxqs_alloc:
        sa->rxq_count = 0;
+fail_check_mode:
        sfc_log_init(sa, "failed %d", rc);
        return rc;
 }