New upstream version 18.05
[deb_dpdk.git] / drivers / net / sfc / sfc_ethdev.c
index 4c9335f..1b6499f 100644 (file)
@@ -1,39 +1,19 @@
-/*-
- *   BSD LICENSE
+/* SPDX-License-Identifier: BSD-3-Clause
  *
- * Copyright (c) 2016-2017 Solarflare Communications Inc.
+ * Copyright (c) 2016-2018 Solarflare Communications Inc.
  * All rights reserved.
  *
  * This software was jointly developed between OKTET Labs (under contract
  * for Solarflare) and Solarflare Communications, Inc.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * 1. Redistributions of source code must retain the above copyright notice,
- *    this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright notice,
- *    this list of conditions and the following disclaimer in the documentation
- *    and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
- * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
- * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
- * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
- * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
 #include <rte_dev.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
 #include <rte_ethdev_pci.h>
 #include <rte_pci.h>
+#include <rte_bus_pci.h>
 #include <rte_errno.h>
+#include <rte_string_fns.h>
 
 #include "efx.h"
 
@@ -48,6 +28,8 @@
 #include "sfc_dp.h"
 #include "sfc_dp_rx.h"
 
+uint32_t sfc_logtype_driver;
+
 static struct sfc_dp_list sfc_dp_head =
        TAILQ_HEAD_INITIALIZER(sfc_dp_head);
 
@@ -103,11 +85,11 @@ static void
 sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
 {
        struct sfc_adapter *sa = dev->data->dev_private;
-       const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
+       struct sfc_rss *rss = &sa->rss;
+       uint64_t txq_offloads_def = 0;
 
        sfc_log_init(sa, "entry");
 
-       dev_info->pci_dev = RTE_DEV_TO_PCI(dev->device);
        dev_info->max_rx_pktlen = EFX_MAC_PDU_MAX;
 
        /* Autonegotiation may be disabled */
@@ -116,8 +98,14 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
                dev_info->speed_capa |= ETH_LINK_SPEED_1G;
        if (sa->port.phy_adv_cap_mask & EFX_PHY_CAP_10000FDX)
                dev_info->speed_capa |= ETH_LINK_SPEED_10G;
+       if (sa->port.phy_adv_cap_mask & EFX_PHY_CAP_25000FDX)
+               dev_info->speed_capa |= ETH_LINK_SPEED_25G;
        if (sa->port.phy_adv_cap_mask & EFX_PHY_CAP_40000FDX)
                dev_info->speed_capa |= ETH_LINK_SPEED_40G;
+       if (sa->port.phy_adv_cap_mask & EFX_PHY_CAP_50000FDX)
+               dev_info->speed_capa |= ETH_LINK_SPEED_50G;
+       if (sa->port.phy_adv_cap_mask & EFX_PHY_CAP_100000FDX)
+               dev_info->speed_capa |= ETH_LINK_SPEED_100G;
 
        dev_info->max_rx_queues = sa->rxq_max;
        dev_info->max_tx_queues = sa->txq_max;
@@ -125,37 +113,44 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
        /* By default packets are dropped if no descriptors are available */
        dev_info->default_rxconf.rx_drop_en = 1;
 
-       dev_info->rx_offload_capa =
-               DEV_RX_OFFLOAD_IPV4_CKSUM |
-               DEV_RX_OFFLOAD_UDP_CKSUM |
-               DEV_RX_OFFLOAD_TCP_CKSUM;
+       dev_info->rx_queue_offload_capa = sfc_rx_get_queue_offload_caps(sa);
 
-       dev_info->tx_offload_capa =
-               DEV_TX_OFFLOAD_IPV4_CKSUM |
-               DEV_TX_OFFLOAD_UDP_CKSUM |
-               DEV_TX_OFFLOAD_TCP_CKSUM;
+       /*
+        * rx_offload_capa includes both device and queue offloads since
+        * the latter may be requested on a per device basis which makes
+        * sense when some offloads are needed to be set on all queues.
+        */
+       dev_info->rx_offload_capa = sfc_rx_get_dev_offload_caps(sa) |
+                                   dev_info->rx_queue_offload_capa;
 
-       dev_info->default_txconf.txq_flags = ETH_TXQ_FLAGS_NOXSUMSCTP;
-       if ((~sa->dp_tx->features & SFC_DP_TX_FEAT_VLAN_INSERT) ||
-           !encp->enc_hw_tx_insert_vlan_enabled)
-               dev_info->default_txconf.txq_flags |= ETH_TXQ_FLAGS_NOVLANOFFL;
-       else
-               dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_VLAN_INSERT;
+       dev_info->tx_queue_offload_capa = sfc_tx_get_queue_offload_caps(sa);
+
+       /*
+        * tx_offload_capa includes both device and queue offloads since
+        * the latter may be requested on a per device basis which makes
+        * sense when some offloads are needed to be set on all queues.
+        */
+       dev_info->tx_offload_capa = sfc_tx_get_dev_offload_caps(sa) |
+                                   dev_info->tx_queue_offload_capa;
+
+       if (dev_info->tx_offload_capa & DEV_TX_OFFLOAD_MBUF_FAST_FREE)
+               txq_offloads_def |= DEV_TX_OFFLOAD_MBUF_FAST_FREE;
+
+       dev_info->default_txconf.offloads |= txq_offloads_def;
+
+       if (rss->context_type != EFX_RX_SCALE_UNAVAILABLE) {
+               uint64_t rte_hf = 0;
+               unsigned int i;
 
-       if (~sa->dp_tx->features & SFC_DP_TX_FEAT_MULTI_SEG)
-               dev_info->default_txconf.txq_flags |= ETH_TXQ_FLAGS_NOMULTSEGS;
+               for (i = 0; i < rss->hf_map_nb_entries; ++i)
+                       rte_hf |= rss->hf_map[i].rte;
 
-#if EFSYS_OPT_RX_SCALE
-       if (sa->rss_support != EFX_RX_SCALE_UNAVAILABLE) {
                dev_info->reta_size = EFX_RSS_TBL_SIZE;
-               dev_info->hash_key_size = SFC_RSS_KEY_SIZE;
-               dev_info->flow_type_rss_offloads = SFC_RSS_OFFLOADS;
+               dev_info->hash_key_size = EFX_RSS_KEY_SIZE;
+               dev_info->flow_type_rss_offloads = rte_hf;
        }
-#endif
-
-       if (sa->tso)
-               dev_info->tx_offload_capa |= DEV_TX_OFFLOAD_TCP_TSO;
 
+       /* Initialize to hardware limits */
        dev_info->rx_desc_lim.nb_max = EFX_RXQ_MAXNDESCS;
        dev_info->rx_desc_lim.nb_min = EFX_RXQ_MINNDESCS;
        /* The RXQ hardware requires that the descriptor count is a power
@@ -163,6 +158,7 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
         */
        dev_info->rx_desc_lim.nb_align = EFX_RXQ_MINNDESCS;
 
+       /* Initialize to hardware limits */
        dev_info->tx_desc_lim.nb_max = sa->txq_max_entries;
        dev_info->tx_desc_lim.nb_min = EFX_TXQ_MINNDESCS;
        /*
@@ -170,14 +166,21 @@ sfc_dev_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info)
         * of 2, but tx_desc_lim cannot properly describe that constraint
         */
        dev_info->tx_desc_lim.nb_align = EFX_TXQ_MINNDESCS;
+
+       if (sa->dp_rx->get_dev_info != NULL)
+               sa->dp_rx->get_dev_info(dev_info);
+       if (sa->dp_tx->get_dev_info != NULL)
+               sa->dp_tx->get_dev_info(dev_info);
 }
 
 static const uint32_t *
 sfc_dev_supported_ptypes_get(struct rte_eth_dev *dev)
 {
        struct sfc_adapter *sa = dev->data->dev_private;
+       const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
+       uint32_t tunnel_encaps = encp->enc_tunnel_encapsulations_supported;
 
-       return sa->dp_rx->supported_ptypes_get();
+       return sa->dp_rx->supported_ptypes_get(tunnel_encaps);
 }
 
 static int
@@ -231,22 +234,13 @@ static int
 sfc_dev_link_update(struct rte_eth_dev *dev, int wait_to_complete)
 {
        struct sfc_adapter *sa = dev->data->dev_private;
-       struct rte_eth_link *dev_link = &dev->data->dev_link;
-       struct rte_eth_link old_link;
        struct rte_eth_link current_link;
+       int ret;
 
        sfc_log_init(sa, "entry");
 
-retry:
-       EFX_STATIC_ASSERT(sizeof(*dev_link) == sizeof(rte_atomic64_t));
-       *(int64_t *)&old_link = rte_atomic64_read((rte_atomic64_t *)dev_link);
-
        if (sa->state != SFC_ADAPTER_STARTED) {
                sfc_port_link_mode_to_info(EFX_LINK_UNKNOWN, &current_link);
-               if (!rte_atomic64_cmpset((volatile uint64_t *)dev_link,
-                                        *(uint64_t *)&old_link,
-                                        *(uint64_t *)&current_link))
-                       goto retry;
        } else if (wait_to_complete) {
                efx_link_mode_t link_mode;
 
@@ -254,21 +248,17 @@ retry:
                        link_mode = EFX_LINK_UNKNOWN;
                sfc_port_link_mode_to_info(link_mode, &current_link);
 
-               if (!rte_atomic64_cmpset((volatile uint64_t *)dev_link,
-                                        *(uint64_t *)&old_link,
-                                        *(uint64_t *)&current_link))
-                       goto retry;
        } else {
                sfc_ev_mgmt_qpoll(sa);
-               *(int64_t *)&current_link =
-                       rte_atomic64_read((rte_atomic64_t *)dev_link);
+               rte_eth_linkstatus_get(dev, &current_link);
        }
 
-       if (old_link.link_status != current_link.link_status)
-               sfc_info(sa, "Link status is %s",
-                        current_link.link_status ? "UP" : "DOWN");
+       ret = rte_eth_linkstatus_set(dev, &current_link);
+       if (ret == 0)
+               sfc_notice(sa, "Link status is %s",
+                          current_link.link_status ? "UP" : "DOWN");
 
-       return old_link.link_status == current_link.link_status ? 0 : -1;
+       return ret;
 }
 
 static void
@@ -361,8 +351,13 @@ sfc_dev_filter_set(struct rte_eth_dev *dev, enum sfc_dev_filter_mode mode,
        if (*toggle != enabled) {
                *toggle = enabled;
 
-               if ((sa->state == SFC_ADAPTER_STARTED) &&
-                   (sfc_set_rx_mode(sa) != 0)) {
+               if (port->isolated) {
+                       sfc_warn(sa, "isolated mode is active on the port");
+                       sfc_warn(sa, "the change is to be applied on the next "
+                                    "start provided that isolated mode is "
+                                    "disabled prior the next start");
+               } else if ((sa->state == SFC_ADAPTER_STARTED) &&
+                          (sfc_set_rx_mode(sa) != 0)) {
                        *toggle = !(enabled);
                        sfc_warn(sa, "Failed to %s %s mode",
                                 ((enabled) ? "enable" : "disable"), desc);
@@ -510,16 +505,18 @@ sfc_tx_queue_release(void *queue)
        sfc_adapter_unlock(sa);
 }
 
-static void
+static int
 sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 {
        struct sfc_adapter *sa = dev->data->dev_private;
        struct sfc_port *port = &sa->port;
        uint64_t *mac_stats;
+       int ret;
 
        rte_spinlock_lock(&port->mac_stats_lock);
 
-       if (sfc_port_update_mac_stats(sa) != 0)
+       ret = sfc_port_update_mac_stats(sa);
+       if (ret != 0)
                goto unlock;
 
        mac_stats = port->mac_stats_buf;
@@ -576,6 +573,8 @@ sfc_stats_get(struct rte_eth_dev *dev, struct rte_eth_stats *stats)
 
 unlock:
        rte_spinlock_unlock(&port->mac_stats_lock);
+       SFC_ASSERT(ret >= 0);
+       return -ret;
 }
 
 static void
@@ -650,7 +649,7 @@ sfc_xstats_get_names(struct rte_eth_dev *dev,
        for (i = 0; i < EFX_MAC_NSTATS; ++i) {
                if (EFX_MAC_STAT_SUPPORTED(port->mac_stats_mask, i)) {
                        if (xstats_names != NULL && nstats < xstats_count)
-                               strncpy(xstats_names[nstats].name,
+                               strlcpy(xstats_names[nstats].name,
                                        efx_mac_stat_name(sa->nic, i),
                                        sizeof(xstats_names[0].name));
                        nstats++;
@@ -660,6 +659,84 @@ sfc_xstats_get_names(struct rte_eth_dev *dev,
        return nstats;
 }
 
+static int
+sfc_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
+                    uint64_t *values, unsigned int n)
+{
+       struct sfc_adapter *sa = dev->data->dev_private;
+       struct sfc_port *port = &sa->port;
+       uint64_t *mac_stats;
+       unsigned int nb_supported = 0;
+       unsigned int nb_written = 0;
+       unsigned int i;
+       int ret;
+       int rc;
+
+       if (unlikely(values == NULL) ||
+           unlikely((ids == NULL) && (n < port->mac_stats_nb_supported)))
+               return port->mac_stats_nb_supported;
+
+       rte_spinlock_lock(&port->mac_stats_lock);
+
+       rc = sfc_port_update_mac_stats(sa);
+       if (rc != 0) {
+               SFC_ASSERT(rc > 0);
+               ret = -rc;
+               goto unlock;
+       }
+
+       mac_stats = port->mac_stats_buf;
+
+       for (i = 0; (i < EFX_MAC_NSTATS) && (nb_written < n); ++i) {
+               if (!EFX_MAC_STAT_SUPPORTED(port->mac_stats_mask, i))
+                       continue;
+
+               if ((ids == NULL) || (ids[nb_written] == nb_supported))
+                       values[nb_written++] = mac_stats[i];
+
+               ++nb_supported;
+       }
+
+       ret = nb_written;
+
+unlock:
+       rte_spinlock_unlock(&port->mac_stats_lock);
+
+       return ret;
+}
+
+static int
+sfc_xstats_get_names_by_id(struct rte_eth_dev *dev,
+                          struct rte_eth_xstat_name *xstats_names,
+                          const uint64_t *ids, unsigned int size)
+{
+       struct sfc_adapter *sa = dev->data->dev_private;
+       struct sfc_port *port = &sa->port;
+       unsigned int nb_supported = 0;
+       unsigned int nb_written = 0;
+       unsigned int i;
+
+       if (unlikely(xstats_names == NULL) ||
+           unlikely((ids == NULL) && (size < port->mac_stats_nb_supported)))
+               return port->mac_stats_nb_supported;
+
+       for (i = 0; (i < EFX_MAC_NSTATS) && (nb_written < size); ++i) {
+               if (!EFX_MAC_STAT_SUPPORTED(port->mac_stats_mask, i))
+                       continue;
+
+               if ((ids == NULL) || (ids[nb_written] == nb_supported)) {
+                       char *name = xstats_names[nb_written++].name;
+
+                       strlcpy(name, efx_mac_stat_name(sa->nic, i),
+                               sizeof(xstats_names[0].name));
+               }
+
+               ++nb_supported;
+       }
+
+       return nb_written;
+}
+
 static int
 sfc_flow_ctrl_get(struct rte_eth_dev *dev, struct rte_eth_fc_conf *fc_conf)
 {
@@ -800,7 +877,13 @@ sfc_dev_set_mtu(struct rte_eth_dev *dev, uint16_t mtu)
         * The driver does not use it, but other PMDs update jumbo_frame
         * flag and max_rx_pkt_len when MTU is set.
         */
-       dev->data->dev_conf.rxmode.jumbo_frame = (mtu > ETHER_MAX_LEN);
+       if (mtu > ETHER_MAX_LEN) {
+               struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
+
+               rxmode->offloads |= DEV_RX_OFFLOAD_JUMBO_FRAME;
+               rxmode->jumbo_frame = 1;
+       }
+
        dev->data->dev_conf.rxmode.max_rx_pkt_len = sa->port.pdu;
 
        sfc_adapter_unlock(sa);
@@ -821,18 +904,39 @@ fail_inval:
        SFC_ASSERT(rc > 0);
        return -rc;
 }
-static void
+static int
 sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
 {
        struct sfc_adapter *sa = dev->data->dev_private;
        const efx_nic_cfg_t *encp = efx_nic_cfg_get(sa->nic);
-       int rc;
+       struct sfc_port *port = &sa->port;
+       struct ether_addr *old_addr = &dev->data->mac_addrs[0];
+       int rc = 0;
 
        sfc_adapter_lock(sa);
 
+       /*
+        * Copy the address to the device private data so that
+        * it could be recalled in the case of adapter restart.
+        */
+       ether_addr_copy(mac_addr, &port->default_mac_addr);
+
+       /*
+        * Neither of the two following checks can return
+        * an error. The new MAC address is preserved in
+        * the device private data and can be activated
+        * on the next port start if the user prevents
+        * isolated mode from being enabled.
+        */
+       if (port->isolated) {
+               sfc_warn(sa, "isolated mode is active on the port");
+               sfc_warn(sa, "will not set MAC address");
+               goto unlock;
+       }
+
        if (sa->state != SFC_ADAPTER_STARTED) {
-               sfc_info(sa, "the port is not started");
-               sfc_info(sa, "the new MAC address will be set on port start");
+               sfc_notice(sa, "the port is not started");
+               sfc_notice(sa, "the new MAC address will be set on port start");
 
                goto unlock;
        }
@@ -850,8 +954,12 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
                 * we also need to update unicast filters
                 */
                rc = sfc_set_rx_mode(sa);
-               if (rc != 0)
+               if (rc != 0) {
                        sfc_err(sa, "cannot set filter (rc = %u)", rc);
+                       /* Rollback the old address */
+                       (void)efx_mac_addr_set(sa->nic, old_addr->addr_bytes);
+                       (void)sfc_set_rx_mode(sa);
+               }
        } else {
                sfc_warn(sa, "cannot set MAC address with filters installed");
                sfc_warn(sa, "adapter will be restarted to pick the new MAC");
@@ -859,9 +967,9 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
 
                /*
                 * Since setting MAC address with filters installed is not
-                * allowed on the adapter, one needs to simply restart adapter
-                * so that the new MAC address will be taken from an outer
-                * storage and set flawlessly by means of sfc_start() call
+                * allowed on the adapter, the new MAC address will be set
+                * by means of adapter restart. sfc_start() shall retrieve
+                * the new address from the device private data and set it.
                 */
                sfc_stop(sa);
                rc = sfc_start(sa);
@@ -870,7 +978,13 @@ sfc_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr)
        }
 
 unlock:
+       if (rc != 0)
+               ether_addr_copy(old_addr, &port->default_mac_addr);
+
        sfc_adapter_unlock(sa);
+
+       SFC_ASSERT(rc >= 0);
+       return -rc;
 }
 
 
@@ -884,6 +998,12 @@ sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set,
        int rc;
        unsigned int i;
 
+       if (port->isolated) {
+               sfc_err(sa, "isolated mode is active on the port");
+               sfc_err(sa, "will not set multicast address list");
+               return -ENOTSUP;
+       }
+
        if (mc_addrs == NULL)
                return -ENOBUFS;
 
@@ -894,7 +1014,7 @@ sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set,
        }
 
        for (i = 0; i < nb_mc_addr; ++i) {
-               (void)rte_memcpy(mc_addrs, mc_addr_set[i].addr_bytes,
+               rte_memcpy(mc_addrs, mc_addr_set[i].addr_bytes,
                                 EFX_MAC_ADDR_LEN);
                mc_addrs += EFX_MAC_ADDR_LEN;
        }
@@ -913,6 +1033,10 @@ sfc_set_mc_addr_list(struct rte_eth_dev *dev, struct ether_addr *mc_addr_set,
        return -rc;
 }
 
+/*
+ * The function is used by the secondary process as well. It must not
+ * use any process-local pointers from the adapter data.
+ */
 static void
 sfc_rx_queue_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id,
                      struct rte_eth_rxq_info *qinfo)
@@ -933,12 +1057,22 @@ sfc_rx_queue_info_get(struct rte_eth_dev *dev, uint16_t rx_queue_id,
        qinfo->conf.rx_free_thresh = rxq->refill_threshold;
        qinfo->conf.rx_drop_en = 1;
        qinfo->conf.rx_deferred_start = rxq_info->deferred_start;
-       qinfo->scattered_rx = (rxq_info->type == EFX_RXQ_TYPE_SCATTER);
+       qinfo->conf.offloads = DEV_RX_OFFLOAD_IPV4_CKSUM |
+                              DEV_RX_OFFLOAD_UDP_CKSUM |
+                              DEV_RX_OFFLOAD_TCP_CKSUM;
+       if (rxq_info->type_flags & EFX_RXQ_FLAG_SCATTER) {
+               qinfo->conf.offloads |= DEV_RX_OFFLOAD_SCATTER;
+               qinfo->scattered_rx = 1;
+       }
        qinfo->nb_desc = rxq_info->entries;
 
        sfc_adapter_unlock(sa);
 }
 
+/*
+ * The function is used by the secondary process as well. It must not
+ * use any process-local pointers from the adapter data.
+ */
 static void
 sfc_tx_queue_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,
                      struct rte_eth_txq_info *qinfo)
@@ -956,6 +1090,7 @@ sfc_tx_queue_info_get(struct rte_eth_dev *dev, uint16_t tx_queue_id,
        memset(qinfo, 0, sizeof(*qinfo));
 
        qinfo->conf.txq_flags = txq_info->txq->flags;
+       qinfo->conf.offloads = txq_info->txq->offloads;
        qinfo->conf.tx_free_thresh = txq_info->txq->free_thresh;
        qinfo->conf.tx_deferred_start = txq_info->deferred_start;
        qinfo->nb_desc = txq_info->entries;
@@ -981,6 +1116,24 @@ sfc_rx_descriptor_done(void *queue, uint16_t offset)
        return sfc_rx_qdesc_done(dp_rxq, offset);
 }
 
+static int
+sfc_rx_descriptor_status(void *queue, uint16_t offset)
+{
+       struct sfc_dp_rxq *dp_rxq = queue;
+       struct sfc_rxq *rxq = sfc_rxq_by_dp_rxq(dp_rxq);
+
+       return rxq->evq->sa->dp_rx->qdesc_status(dp_rxq, offset);
+}
+
+static int
+sfc_tx_descriptor_status(void *queue, uint16_t offset)
+{
+       struct sfc_dp_txq *dp_txq = queue;
+       struct sfc_txq *txq = sfc_txq_by_dp_txq(dp_txq);
+
+       return txq->evq->sa->dp_tx->qdesc_status(dp_txq, offset);
+}
+
 static int
 sfc_rx_queue_start(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
@@ -1077,17 +1230,135 @@ sfc_tx_queue_stop(struct rte_eth_dev *dev, uint16_t tx_queue_id)
        return 0;
 }
 
-#if EFSYS_OPT_RX_SCALE
+static efx_tunnel_protocol_t
+sfc_tunnel_rte_type_to_efx_udp_proto(enum rte_eth_tunnel_type rte_type)
+{
+       switch (rte_type) {
+       case RTE_TUNNEL_TYPE_VXLAN:
+               return EFX_TUNNEL_PROTOCOL_VXLAN;
+       case RTE_TUNNEL_TYPE_GENEVE:
+               return EFX_TUNNEL_PROTOCOL_GENEVE;
+       default:
+               return EFX_TUNNEL_NPROTOS;
+       }
+}
+
+enum sfc_udp_tunnel_op_e {
+       SFC_UDP_TUNNEL_ADD_PORT,
+       SFC_UDP_TUNNEL_DEL_PORT,
+};
+
+static int
+sfc_dev_udp_tunnel_op(struct rte_eth_dev *dev,
+                     struct rte_eth_udp_tunnel *tunnel_udp,
+                     enum sfc_udp_tunnel_op_e op)
+{
+       struct sfc_adapter *sa = dev->data->dev_private;
+       efx_tunnel_protocol_t tunnel_proto;
+       int rc;
+
+       sfc_log_init(sa, "%s udp_port=%u prot_type=%u",
+                    (op == SFC_UDP_TUNNEL_ADD_PORT) ? "add" :
+                    (op == SFC_UDP_TUNNEL_DEL_PORT) ? "delete" : "unknown",
+                    tunnel_udp->udp_port, tunnel_udp->prot_type);
+
+       tunnel_proto =
+               sfc_tunnel_rte_type_to_efx_udp_proto(tunnel_udp->prot_type);
+       if (tunnel_proto >= EFX_TUNNEL_NPROTOS) {
+               rc = ENOTSUP;
+               goto fail_bad_proto;
+       }
+
+       sfc_adapter_lock(sa);
+
+       switch (op) {
+       case SFC_UDP_TUNNEL_ADD_PORT:
+               rc = efx_tunnel_config_udp_add(sa->nic,
+                                              tunnel_udp->udp_port,
+                                              tunnel_proto);
+               break;
+       case SFC_UDP_TUNNEL_DEL_PORT:
+               rc = efx_tunnel_config_udp_remove(sa->nic,
+                                                 tunnel_udp->udp_port,
+                                                 tunnel_proto);
+               break;
+       default:
+               rc = EINVAL;
+               goto fail_bad_op;
+       }
+
+       if (rc != 0)
+               goto fail_op;
+
+       if (sa->state == SFC_ADAPTER_STARTED) {
+               rc = efx_tunnel_reconfigure(sa->nic);
+               if (rc == EAGAIN) {
+                       /*
+                        * Configuration is accepted by FW and MC reboot
+                        * is initiated to apply the changes. MC reboot
+                        * will be handled in a usual way (MC reboot
+                        * event on management event queue and adapter
+                        * restart).
+                        */
+                       rc = 0;
+               } else if (rc != 0) {
+                       goto fail_reconfigure;
+               }
+       }
+
+       sfc_adapter_unlock(sa);
+       return 0;
+
+fail_reconfigure:
+       /* Remove/restore entry since the change makes the trouble */
+       switch (op) {
+       case SFC_UDP_TUNNEL_ADD_PORT:
+               (void)efx_tunnel_config_udp_remove(sa->nic,
+                                                  tunnel_udp->udp_port,
+                                                  tunnel_proto);
+               break;
+       case SFC_UDP_TUNNEL_DEL_PORT:
+               (void)efx_tunnel_config_udp_add(sa->nic,
+                                               tunnel_udp->udp_port,
+                                               tunnel_proto);
+               break;
+       }
+
+fail_op:
+fail_bad_op:
+       sfc_adapter_unlock(sa);
+
+fail_bad_proto:
+       SFC_ASSERT(rc > 0);
+       return -rc;
+}
+
+static int
+sfc_dev_udp_tunnel_port_add(struct rte_eth_dev *dev,
+                           struct rte_eth_udp_tunnel *tunnel_udp)
+{
+       return sfc_dev_udp_tunnel_op(dev, tunnel_udp, SFC_UDP_TUNNEL_ADD_PORT);
+}
+
+static int
+sfc_dev_udp_tunnel_port_del(struct rte_eth_dev *dev,
+                           struct rte_eth_udp_tunnel *tunnel_udp)
+{
+       return sfc_dev_udp_tunnel_op(dev, tunnel_udp, SFC_UDP_TUNNEL_DEL_PORT);
+}
+
 static int
 sfc_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
                          struct rte_eth_rss_conf *rss_conf)
 {
        struct sfc_adapter *sa = dev->data->dev_private;
+       struct sfc_rss *rss = &sa->rss;
+       struct sfc_port *port = &sa->port;
 
-       if (sa->rss_support != EFX_RX_SCALE_EXCLUSIVE)
+       if (rss->context_type != EFX_RX_SCALE_EXCLUSIVE || port->isolated)
                return -ENOTSUP;
 
-       if (sa->rss_channels == 0)
+       if (rss->channels == 0)
                return -EINVAL;
 
        sfc_adapter_lock(sa);
@@ -1098,10 +1369,10 @@ sfc_dev_rss_hash_conf_get(struct rte_eth_dev *dev,
         * flags which corresponds to the active EFX configuration stored
         * locally in 'sfc_adapter' and kept up-to-date
         */
-       rss_conf->rss_hf = sfc_efx_to_rte_hash_type(sa->rss_hash_types);
-       rss_conf->rss_key_len = SFC_RSS_KEY_SIZE;
+       rss_conf->rss_hf = sfc_rx_hf_efx_to_rte(sa, rss->hash_types);
+       rss_conf->rss_key_len = EFX_RSS_KEY_SIZE;
        if (rss_conf->rss_key != NULL)
-               rte_memcpy(rss_conf->rss_key, sa->rss_key, SFC_RSS_KEY_SIZE);
+               rte_memcpy(rss_conf->rss_key, rss->key, EFX_RSS_KEY_SIZE);
 
        sfc_adapter_unlock(sa);
 
@@ -1113,63 +1384,69 @@ sfc_dev_rss_hash_update(struct rte_eth_dev *dev,
                        struct rte_eth_rss_conf *rss_conf)
 {
        struct sfc_adapter *sa = dev->data->dev_private;
+       struct sfc_rss *rss = &sa->rss;
+       struct sfc_port *port = &sa->port;
        unsigned int efx_hash_types;
        int rc = 0;
 
-       if (sa->rss_support != EFX_RX_SCALE_EXCLUSIVE) {
+       if (port->isolated)
+               return -ENOTSUP;
+
+       if (rss->context_type != EFX_RX_SCALE_EXCLUSIVE) {
                sfc_err(sa, "RSS is not available");
                return -ENOTSUP;
        }
 
-       if (sa->rss_channels == 0) {
+       if (rss->channels == 0) {
                sfc_err(sa, "RSS is not configured");
                return -EINVAL;
        }
 
        if ((rss_conf->rss_key != NULL) &&
-           (rss_conf->rss_key_len != sizeof(sa->rss_key))) {
+           (rss_conf->rss_key_len != sizeof(rss->key))) {
                sfc_err(sa, "RSS key size is wrong (should be %lu)",
-                       sizeof(sa->rss_key));
-               return -EINVAL;
-       }
-
-       if ((rss_conf->rss_hf & ~SFC_RSS_OFFLOADS) != 0) {
-               sfc_err(sa, "unsupported hash functions requested");
+                       sizeof(rss->key));
                return -EINVAL;
        }
 
        sfc_adapter_lock(sa);
 
-       efx_hash_types = sfc_rte_to_efx_hash_type(rss_conf->rss_hf);
+       rc = sfc_rx_hf_rte_to_efx(sa, rss_conf->rss_hf, &efx_hash_types);
+       if (rc != 0)
+               goto fail_rx_hf_rte_to_efx;
 
-       rc = efx_rx_scale_mode_set(sa->nic, EFX_RX_HASHALG_TOEPLITZ,
-                                  efx_hash_types, B_TRUE);
+       rc = efx_rx_scale_mode_set(sa->nic, EFX_RSS_CONTEXT_DEFAULT,
+                                  rss->hash_alg, efx_hash_types, B_TRUE);
        if (rc != 0)
                goto fail_scale_mode_set;
 
        if (rss_conf->rss_key != NULL) {
                if (sa->state == SFC_ADAPTER_STARTED) {
-                       rc = efx_rx_scale_key_set(sa->nic, rss_conf->rss_key,
-                                                 sizeof(sa->rss_key));
+                       rc = efx_rx_scale_key_set(sa->nic,
+                                                 EFX_RSS_CONTEXT_DEFAULT,
+                                                 rss_conf->rss_key,
+                                                 sizeof(rss->key));
                        if (rc != 0)
                                goto fail_scale_key_set;
                }
 
-               rte_memcpy(sa->rss_key, rss_conf->rss_key, sizeof(sa->rss_key));
+               rte_memcpy(rss->key, rss_conf->rss_key, sizeof(rss->key));
        }
 
-       sa->rss_hash_types = efx_hash_types;
+       rss->hash_types = efx_hash_types;
 
        sfc_adapter_unlock(sa);
 
        return 0;
 
 fail_scale_key_set:
-       if (efx_rx_scale_mode_set(sa->nic, EFX_RX_HASHALG_TOEPLITZ,
-                                 sa->rss_hash_types, B_TRUE) != 0)
+       if (efx_rx_scale_mode_set(sa->nic, EFX_RSS_CONTEXT_DEFAULT,
+                                 EFX_RX_HASHALG_TOEPLITZ,
+                                 rss->hash_types, B_TRUE) != 0)
                sfc_err(sa, "failed to restore RSS mode");
 
 fail_scale_mode_set:
+fail_rx_hf_rte_to_efx:
        sfc_adapter_unlock(sa);
        return -rc;
 }
@@ -1180,12 +1457,14 @@ sfc_dev_rss_reta_query(struct rte_eth_dev *dev,
                       uint16_t reta_size)
 {
        struct sfc_adapter *sa = dev->data->dev_private;
+       struct sfc_rss *rss = &sa->rss;
+       struct sfc_port *port = &sa->port;
        int entry;
 
-       if (sa->rss_support != EFX_RX_SCALE_EXCLUSIVE)
+       if (rss->context_type != EFX_RX_SCALE_EXCLUSIVE || port->isolated)
                return -ENOTSUP;
 
-       if (sa->rss_channels == 0)
+       if (rss->channels == 0)
                return -EINVAL;
 
        if (reta_size != EFX_RSS_TBL_SIZE)
@@ -1198,7 +1477,7 @@ sfc_dev_rss_reta_query(struct rte_eth_dev *dev,
                int grp_idx = entry % RTE_RETA_GROUP_SIZE;
 
                if ((reta_conf[grp].mask >> grp_idx) & 1)
-                       reta_conf[grp].reta[grp_idx] = sa->rss_tbl[entry];
+                       reta_conf[grp].reta[grp_idx] = rss->tbl[entry];
        }
 
        sfc_adapter_unlock(sa);
@@ -1212,17 +1491,22 @@ sfc_dev_rss_reta_update(struct rte_eth_dev *dev,
                        uint16_t reta_size)
 {
        struct sfc_adapter *sa = dev->data->dev_private;
+       struct sfc_rss *rss = &sa->rss;
+       struct sfc_port *port = &sa->port;
        unsigned int *rss_tbl_new;
        uint16_t entry;
-       int rc;
+       int rc = 0;
 
 
-       if (sa->rss_support != EFX_RX_SCALE_EXCLUSIVE) {
+       if (port->isolated)
+               return -ENOTSUP;
+
+       if (rss->context_type != EFX_RX_SCALE_EXCLUSIVE) {
                sfc_err(sa, "RSS is not available");
                return -ENOTSUP;
        }
 
-       if (sa->rss_channels == 0) {
+       if (rss->channels == 0) {
                sfc_err(sa, "RSS is not configured");
                return -EINVAL;
        }
@@ -1233,13 +1517,13 @@ sfc_dev_rss_reta_update(struct rte_eth_dev *dev,
                return -EINVAL;
        }
 
-       rss_tbl_new = rte_zmalloc("rss_tbl_new", sizeof(sa->rss_tbl), 0);
+       rss_tbl_new = rte_zmalloc("rss_tbl_new", sizeof(rss->tbl), 0);
        if (rss_tbl_new == NULL)
                return -ENOMEM;
 
        sfc_adapter_lock(sa);
 
-       rte_memcpy(rss_tbl_new, sa->rss_tbl, sizeof(sa->rss_tbl));
+       rte_memcpy(rss_tbl_new, rss->tbl, sizeof(rss->tbl));
 
        for (entry = 0; entry < reta_size; entry++) {
                int grp_idx = entry % RTE_RETA_GROUP_SIZE;
@@ -1248,7 +1532,7 @@ sfc_dev_rss_reta_update(struct rte_eth_dev *dev,
                grp = &reta_conf[entry / RTE_RETA_GROUP_SIZE];
 
                if (grp->mask & (1ull << grp_idx)) {
-                       if (grp->reta[grp_idx] >= sa->rss_channels) {
+                       if (grp->reta[grp_idx] >= rss->channels) {
                                rc = EINVAL;
                                goto bad_reta_entry;
                        }
@@ -1256,10 +1540,16 @@ sfc_dev_rss_reta_update(struct rte_eth_dev *dev,
                }
        }
 
-       rc = efx_rx_scale_tbl_set(sa->nic, rss_tbl_new, EFX_RSS_TBL_SIZE);
-       if (rc == 0)
-               rte_memcpy(sa->rss_tbl, rss_tbl_new, sizeof(sa->rss_tbl));
+       if (sa->state == SFC_ADAPTER_STARTED) {
+               rc = efx_rx_scale_tbl_set(sa->nic, EFX_RSS_CONTEXT_DEFAULT,
+                                         rss_tbl_new, EFX_RSS_TBL_SIZE);
+               if (rc != 0)
+                       goto fail_scale_tbl_set;
+       }
+
+       rte_memcpy(rss->tbl, rss_tbl_new, sizeof(rss->tbl));
 
+fail_scale_tbl_set:
 bad_reta_entry:
        sfc_adapter_unlock(sa);
 
@@ -1268,7 +1558,6 @@ bad_reta_entry:
        SFC_ASSERT(rc >= 0);
        return -rc;
 }
-#endif
 
 static int
 sfc_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type,
@@ -1326,6 +1615,21 @@ sfc_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type,
        return -rc;
 }
 
+static int
+sfc_pool_ops_supported(struct rte_eth_dev *dev, const char *pool)
+{
+       struct sfc_adapter *sa = dev->data->dev_private;
+
+       /*
+        * If Rx datapath does not provide callback to check mempool,
+        * all pools are supported.
+        */
+       if (sa->dp_rx->pool_ops_supported == NULL)
+               return 1;
+
+       return sa->dp_rx->pool_ops_supported(pool);
+}
+
 static const struct eth_dev_ops sfc_eth_dev_ops = {
        .dev_configure                  = sfc_dev_configure,
        .dev_start                      = sfc_dev_start,
@@ -1354,28 +1658,57 @@ static const struct eth_dev_ops sfc_eth_dev_ops = {
        .rx_queue_release               = sfc_rx_queue_release,
        .rx_queue_count                 = sfc_rx_queue_count,
        .rx_descriptor_done             = sfc_rx_descriptor_done,
+       .rx_descriptor_status           = sfc_rx_descriptor_status,
+       .tx_descriptor_status           = sfc_tx_descriptor_status,
        .tx_queue_setup                 = sfc_tx_queue_setup,
        .tx_queue_release               = sfc_tx_queue_release,
        .flow_ctrl_get                  = sfc_flow_ctrl_get,
        .flow_ctrl_set                  = sfc_flow_ctrl_set,
        .mac_addr_set                   = sfc_mac_addr_set,
-#if EFSYS_OPT_RX_SCALE
+       .udp_tunnel_port_add            = sfc_dev_udp_tunnel_port_add,
+       .udp_tunnel_port_del            = sfc_dev_udp_tunnel_port_del,
        .reta_update                    = sfc_dev_rss_reta_update,
        .reta_query                     = sfc_dev_rss_reta_query,
        .rss_hash_update                = sfc_dev_rss_hash_update,
        .rss_hash_conf_get              = sfc_dev_rss_hash_conf_get,
-#endif
        .filter_ctrl                    = sfc_dev_filter_ctrl,
        .set_mc_addr_list               = sfc_set_mc_addr_list,
        .rxq_info_get                   = sfc_rx_queue_info_get,
        .txq_info_get                   = sfc_tx_queue_info_get,
        .fw_version_get                 = sfc_fw_version_get,
+       .xstats_get_by_id               = sfc_xstats_get_by_id,
+       .xstats_get_names_by_id         = sfc_xstats_get_names_by_id,
+       .pool_ops_supported             = sfc_pool_ops_supported,
 };
 
+/**
+ * Duplicate a string in potentially shared memory required for
+ * multi-process support.
+ *
+ * strdup() allocates from process-local heap/memory.
+ */
+static char *
+sfc_strdup(const char *str)
+{
+       size_t size;
+       char *copy;
+
+       if (str == NULL)
+               return NULL;
+
+       size = strlen(str) + 1;
+       copy = rte_malloc(__func__, size, 0);
+       if (copy != NULL)
+               rte_memcpy(copy, str, size);
+
+       return copy;
+}
+
 static int
 sfc_eth_dev_set_ops(struct rte_eth_dev *dev)
 {
        struct sfc_adapter *sa = dev->data->dev_private;
+       const efx_nic_cfg_t *encp;
        unsigned int avail_caps = 0;
        const char *rx_name = NULL;
        const char *tx_name = NULL;
@@ -1384,12 +1717,17 @@ sfc_eth_dev_set_ops(struct rte_eth_dev *dev)
        switch (sa->family) {
        case EFX_FAMILY_HUNTINGTON:
        case EFX_FAMILY_MEDFORD:
+       case EFX_FAMILY_MEDFORD2:
                avail_caps |= SFC_DP_HW_FW_CAP_EF10;
                break;
        default:
                break;
        }
 
+       encp = efx_nic_cfg_get(sa->nic);
+       if (encp->enc_rx_es_super_buffer_supported)
+               avail_caps |= SFC_DP_HW_FW_CAP_RX_ES_SUPER_BUFFER;
+
        rc = sfc_kvargs_process(sa, SFC_KVARG_RX_DATAPATH,
                                sfc_kvarg_string_handler, &rx_name);
        if (rc != 0)
@@ -1407,7 +1745,7 @@ sfc_eth_dev_set_ops(struct rte_eth_dev *dev)
                                "Insufficient Hw/FW capabilities to use Rx datapath %s",
                                rx_name);
                        rc = EINVAL;
-                       goto fail_dp_rx;
+                       goto fail_dp_rx_caps;
                }
        } else {
                sa->dp_rx = sfc_dp_find_rx_by_caps(&sfc_dp_head, avail_caps);
@@ -1419,7 +1757,13 @@ sfc_eth_dev_set_ops(struct rte_eth_dev *dev)
                }
        }
 
-       sfc_info(sa, "use %s Rx datapath", sa->dp_rx->dp.name);
+       sa->dp_rx_name = sfc_strdup(sa->dp_rx->dp.name);
+       if (sa->dp_rx_name == NULL) {
+               rc = ENOMEM;
+               goto fail_dp_rx_name;
+       }
+
+       sfc_notice(sa, "use %s Rx datapath", sa->dp_rx_name);
 
        dev->rx_pkt_burst = sa->dp_rx->pkt_burst;
 
@@ -1440,7 +1784,7 @@ sfc_eth_dev_set_ops(struct rte_eth_dev *dev)
                                "Insufficient Hw/FW capabilities to use Tx datapath %s",
                                tx_name);
                        rc = EINVAL;
-                       goto fail_dp_tx;
+                       goto fail_dp_tx_caps;
                }
        } else {
                sa->dp_tx = sfc_dp_find_tx_by_caps(&sfc_dp_head, avail_caps);
@@ -1452,7 +1796,13 @@ sfc_eth_dev_set_ops(struct rte_eth_dev *dev)
                }
        }
 
-       sfc_info(sa, "use %s Tx datapath", sa->dp_tx->dp.name);
+       sa->dp_tx_name = sfc_strdup(sa->dp_tx->dp.name);
+       if (sa->dp_tx_name == NULL) {
+               rc = ENOMEM;
+               goto fail_dp_tx_name;
+       }
+
+       sfc_notice(sa, "use %s Tx datapath", sa->dp_tx_name);
 
        dev->tx_pkt_burst = sa->dp_tx->pkt_burst;
 
@@ -1460,19 +1810,114 @@ sfc_eth_dev_set_ops(struct rte_eth_dev *dev)
 
        return 0;
 
+fail_dp_tx_name:
+fail_dp_tx_caps:
+       sa->dp_tx = NULL;
+
 fail_dp_tx:
 fail_kvarg_tx_datapath:
+       rte_free(sa->dp_rx_name);
+       sa->dp_rx_name = NULL;
+
+fail_dp_rx_name:
+fail_dp_rx_caps:
+       sa->dp_rx = NULL;
+
 fail_dp_rx:
 fail_kvarg_rx_datapath:
        return rc;
 }
 
+static void
+sfc_eth_dev_clear_ops(struct rte_eth_dev *dev)
+{
+       struct sfc_adapter *sa = dev->data->dev_private;
+
+       dev->dev_ops = NULL;
+       dev->rx_pkt_burst = NULL;
+       dev->tx_pkt_burst = NULL;
+
+       rte_free(sa->dp_tx_name);
+       sa->dp_tx_name = NULL;
+       sa->dp_tx = NULL;
+
+       rte_free(sa->dp_rx_name);
+       sa->dp_rx_name = NULL;
+       sa->dp_rx = NULL;
+}
+
+static const struct eth_dev_ops sfc_eth_dev_secondary_ops = {
+       .rxq_info_get                   = sfc_rx_queue_info_get,
+       .txq_info_get                   = sfc_tx_queue_info_get,
+};
+
+static int
+sfc_eth_dev_secondary_set_ops(struct rte_eth_dev *dev)
+{
+       /*
+        * Device private data has really many process-local pointers.
+        * Below code should be extremely careful to use data located
+        * in shared memory only.
+        */
+       struct sfc_adapter *sa = dev->data->dev_private;
+       const struct sfc_dp_rx *dp_rx;
+       const struct sfc_dp_tx *dp_tx;
+       int rc;
+
+       dp_rx = sfc_dp_find_rx_by_name(&sfc_dp_head, sa->dp_rx_name);
+       if (dp_rx == NULL) {
+               sfc_err(sa, "cannot find %s Rx datapath", sa->dp_tx_name);
+               rc = ENOENT;
+               goto fail_dp_rx;
+       }
+       if (~dp_rx->features & SFC_DP_RX_FEAT_MULTI_PROCESS) {
+               sfc_err(sa, "%s Rx datapath does not support multi-process",
+                       sa->dp_tx_name);
+               rc = EINVAL;
+               goto fail_dp_rx_multi_process;
+       }
+
+       dp_tx = sfc_dp_find_tx_by_name(&sfc_dp_head, sa->dp_tx_name);
+       if (dp_tx == NULL) {
+               sfc_err(sa, "cannot find %s Tx datapath", sa->dp_tx_name);
+               rc = ENOENT;
+               goto fail_dp_tx;
+       }
+       if (~dp_tx->features & SFC_DP_TX_FEAT_MULTI_PROCESS) {
+               sfc_err(sa, "%s Tx datapath does not support multi-process",
+                       sa->dp_tx_name);
+               rc = EINVAL;
+               goto fail_dp_tx_multi_process;
+       }
+
+       dev->rx_pkt_burst = dp_rx->pkt_burst;
+       dev->tx_pkt_burst = dp_tx->pkt_burst;
+       dev->dev_ops = &sfc_eth_dev_secondary_ops;
+
+       return 0;
+
+fail_dp_tx_multi_process:
+fail_dp_tx:
+fail_dp_rx_multi_process:
+fail_dp_rx:
+       return rc;
+}
+
+static void
+sfc_eth_dev_secondary_clear_ops(struct rte_eth_dev *dev)
+{
+       dev->dev_ops = NULL;
+       dev->tx_pkt_burst = NULL;
+       dev->rx_pkt_burst = NULL;
+}
+
 static void
 sfc_register_dp(void)
 {
        /* Register once */
        if (TAILQ_EMPTY(&sfc_dp_head)) {
                /* Prefer EF10 datapath */
+               sfc_dp_register(&sfc_dp_head, &sfc_ef10_essb_rx.dp);
                sfc_dp_register(&sfc_dp_head, &sfc_ef10_rx.dp);
                sfc_dp_register(&sfc_dp_head, &sfc_efx_rx.dp);
 
@@ -1486,28 +1931,32 @@ static int
 sfc_eth_dev_init(struct rte_eth_dev *dev)
 {
        struct sfc_adapter *sa = dev->data->dev_private;
-       struct rte_pci_device *pci_dev = SFC_DEV_TO_PCI(dev);
+       struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(dev);
        int rc;
        const efx_nic_cfg_t *encp;
        const struct ether_addr *from;
 
        sfc_register_dp();
 
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+               return -sfc_eth_dev_secondary_set_ops(dev);
+
        /* Required for logging */
+       sa->pci_addr = pci_dev->addr;
+       sa->port_id = dev->data->port_id;
+
        sa->eth_dev = dev;
 
        /* Copy PCI device info to the dev->data */
        rte_eth_copy_pci_info(dev, pci_dev);
 
+       sa->logtype_main = sfc_register_logtype(sa, SFC_LOGTYPE_MAIN_STR,
+                                               RTE_LOG_NOTICE);
+
        rc = sfc_kvargs_parse(sa);
        if (rc != 0)
                goto fail_kvargs_parse;
 
-       rc = sfc_kvargs_process(sa, SFC_KVARG_DEBUG_INIT,
-                               sfc_kvarg_bool_handler, &sa->debug_init);
-       if (rc != 0)
-               goto fail_kvarg_debug_init;
-
        sfc_log_init(sa, "entry");
 
        dev->data->mac_addrs = rte_zmalloc("sfc", ETHER_ADDR_LEN, 0);
@@ -1549,6 +1998,8 @@ sfc_eth_dev_init(struct rte_eth_dev *dev)
        return 0;
 
 fail_attach:
+       sfc_eth_dev_clear_ops(dev);
+
 fail_set_ops:
        sfc_unprobe(sa);
 
@@ -1559,7 +2010,6 @@ fail_probe:
        dev->data->mac_addrs = NULL;
 
 fail_mac_addrs:
-fail_kvarg_debug_init:
        sfc_kvargs_cleanup(sa);
 
 fail_kvargs_parse:
@@ -1571,22 +2021,26 @@ fail_kvargs_parse:
 static int
 sfc_eth_dev_uninit(struct rte_eth_dev *dev)
 {
-       struct sfc_adapter *sa = dev->data->dev_private;
+       struct sfc_adapter *sa;
 
+       if (rte_eal_process_type() != RTE_PROC_PRIMARY) {
+               sfc_eth_dev_secondary_clear_ops(dev);
+               return 0;
+       }
+
+       sa = dev->data->dev_private;
        sfc_log_init(sa, "entry");
 
        sfc_adapter_lock(sa);
 
+       sfc_eth_dev_clear_ops(dev);
+
        sfc_detach(sa);
        sfc_unprobe(sa);
 
        rte_free(dev->data->mac_addrs);
        dev->data->mac_addrs = NULL;
 
-       dev->dev_ops = NULL;
-       dev->rx_pkt_burst = NULL;
-       dev->tx_pkt_burst = NULL;
-
        sfc_kvargs_cleanup(sa);
 
        sfc_adapter_unlock(sa);
@@ -1606,6 +2060,8 @@ static const struct rte_pci_id pci_id_sfc_efx_map[] = {
        { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_GREENPORT_VF) },
        { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD) },
        { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD_VF) },
+       { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD2) },
+       { RTE_PCI_DEVICE(EFX_PCI_VENID_SFC, EFX_PCI_DEVID_MEDFORD2_VF) },
        { .vendor_id = 0 /* sentinel */ }
 };
 
@@ -1632,11 +2088,22 @@ static struct rte_pci_driver sfc_efx_pmd = {
 
 RTE_PMD_REGISTER_PCI(net_sfc_efx, sfc_efx_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_sfc_efx, pci_id_sfc_efx_map);
-RTE_PMD_REGISTER_KMOD_DEP(net_sfc_efx, "* igb_uio | uio_pci_generic | vfio");
+RTE_PMD_REGISTER_KMOD_DEP(net_sfc_efx, "* igb_uio | uio_pci_generic | vfio-pci");
 RTE_PMD_REGISTER_PARAM_STRING(net_sfc_efx,
        SFC_KVARG_RX_DATAPATH "=" SFC_KVARG_VALUES_RX_DATAPATH " "
        SFC_KVARG_TX_DATAPATH "=" SFC_KVARG_VALUES_TX_DATAPATH " "
        SFC_KVARG_PERF_PROFILE "=" SFC_KVARG_VALUES_PERF_PROFILE " "
-       SFC_KVARG_STATS_UPDATE_PERIOD_MS "=<long> "
-       SFC_KVARG_MCDI_LOGGING "=" SFC_KVARG_VALUES_BOOL " "
-       SFC_KVARG_DEBUG_INIT "=" SFC_KVARG_VALUES_BOOL);
+       SFC_KVARG_FW_VARIANT "=" SFC_KVARG_VALUES_FW_VARIANT " "
+       SFC_KVARG_RXD_WAIT_TIMEOUT_NS "=<long> "
+       SFC_KVARG_STATS_UPDATE_PERIOD_MS "=<long>");
+
+RTE_INIT(sfc_driver_register_logtype);
+static void
+sfc_driver_register_logtype(void)
+{
+       int ret;
+
+       ret = rte_log_register_type_and_pick_level(SFC_LOGTYPE_PREFIX "driver",
+                                                  RTE_LOG_NOTICE);
+       sfc_logtype_driver = (ret < 0) ? RTE_LOGTYPE_PMD : ret;
+}