[1/2] net/ice: add dcf port representor infrastructure
Checks
Commit Message
Defines data structures and code to init/uninit
VF representors during pci_probe and pci_remove
respectively.
Most of the dev_ops for the VF representor are just
stubs for now and will be will be filled out in next patch
Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
drivers/net/ice/Makefile | 1 +
drivers/net/ice/ice_dcf_ethdev.c | 66 +++++-
drivers/net/ice/ice_dcf_ethdev.h | 11 +
drivers/net/ice/ice_dcf_vf_representor.c | 245 +++++++++++++++++++++++
4 files changed, 321 insertions(+), 2 deletions(-)
create mode 100644 drivers/net/ice/ice_dcf_vf_representor.c
Comments
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Qiming Yang
> Sent: Wednesday, September 2, 2020 2:38 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> Subject: [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor
> infrastructure
>
> Defines data structures and code to init/uninit VF representors during
> pci_probe and pci_remove respectively.
> Most of the dev_ops for the VF representor are just stubs for now and will be
> will be filled out in next patch
>
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
> drivers/net/ice/Makefile | 1 +
> drivers/net/ice/ice_dcf_ethdev.c | 66 +++++-
> drivers/net/ice/ice_dcf_ethdev.h | 11 +
> drivers/net/ice/ice_dcf_vf_representor.c | 245 +++++++++++++++++++++++
> 4 files changed, 321 insertions(+), 2 deletions(-) create mode 100644
> drivers/net/ice/ice_dcf_vf_representor.c
>
> diff --git a/drivers/net/ice/Makefile b/drivers/net/ice/Makefile index
> 34cd4024b..f9eb34a87 100644
> --- a/drivers/net/ice/Makefile
> +++ b/drivers/net/ice/Makefile
> @@ -88,6 +88,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) +=
> ice_generic_flow.c
>
> SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf.c
> SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf_ethdev.c
> +SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf_vf_representor.c
> SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf_parent.c
>
<...>
> +
> +static int
> +ice_dcf_representor_tx_queue_setup(__rte_unused struct rte_eth_dev *dev,
> + __rte_unused uint16_t rx_queue_id,
Should be tx_queue_id which is more readable?
> + __rte_unused uint16_t nb_rx_desc,
Should be nb_tx_desc?
> + __rte_unused unsigned int socket_id,
> + __rte_unused const struct rte_eth_txconf *tx_conf) {
> + return 0;
> +}
> +
<...>
> +
> + /* No data-path, but need stub Rx/Tx functions to avoid crash
> + * when testing with the likes of testpmd.
> + */
> + ethdev->rx_pkt_burst = ice_dcf_representor_rx_burst;
> + ethdev->tx_pkt_burst = ice_dcf_representor_tx_burst;
> +
> + ethdev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR;
> + ethdev->data->representor_id = representor->vf_id;
> +
> + struct rte_ether_addr mac_addr;
Why not move this to the beginning of the function?
> +
> + memset(&mac_addr, 0, sizeof(mac_addr));
> + ethdev->data->mac_addrs = &mac_addr;
> +
> + return 0;
> +}
> +
> +int
> +ice_dcf_vf_representor_uninit(struct rte_eth_dev *ethdev) {
> + ethdev->data->mac_addrs = NULL;
> +
> + return 0;
> +}
> +
> --
> 2.17.1
All the format issue will be rechecked in the next version
> -----Original Message-----
> From: Xing, Beilei <beilei.xing@intel.com>
> Sent: Tuesday, September 8, 2020 19:35
> To: Yang, Qiming <qiming.yang@intel.com>; dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> Subject: RE: [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor
> infrastructure
>
>
>
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Qiming Yang
> > Sent: Wednesday, September 2, 2020 2:38 PM
> > To: dev@dpdk.org
> > Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> > <qiming.yang@intel.com>
> > Subject: [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor
> > infrastructure
> >
> > Defines data structures and code to init/uninit VF representors during
> > pci_probe and pci_remove respectively.
> > Most of the dev_ops for the VF representor are just stubs for now and
> > will be will be filled out in next patch
> >
> > Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> > ---
> > drivers/net/ice/Makefile | 1 +
> > drivers/net/ice/ice_dcf_ethdev.c | 66 +++++-
> > drivers/net/ice/ice_dcf_ethdev.h | 11 +
> > drivers/net/ice/ice_dcf_vf_representor.c | 245
> > +++++++++++++++++++++++
> > 4 files changed, 321 insertions(+), 2 deletions(-) create mode
> > 100644 drivers/net/ice/ice_dcf_vf_representor.c
> >
> > diff --git a/drivers/net/ice/Makefile b/drivers/net/ice/Makefile index
> > 34cd4024b..f9eb34a87 100644
> > --- a/drivers/net/ice/Makefile
> > +++ b/drivers/net/ice/Makefile
> > @@ -88,6 +88,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) +=
> > ice_generic_flow.c
> >
> > SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf.c
> > SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf_ethdev.c
> > +SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf_vf_representor.c
> > SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf_parent.c
> >
>
> <...>
>
> > +
> > +static int
> > +ice_dcf_representor_tx_queue_setup(__rte_unused struct rte_eth_dev
> *dev,
> > + __rte_unused uint16_t rx_queue_id,
> Should be tx_queue_id which is more readable?
>
> > + __rte_unused uint16_t nb_rx_desc,
> Should be nb_tx_desc?
typo
>
> > + __rte_unused unsigned int socket_id,
> > + __rte_unused const struct rte_eth_txconf *tx_conf)
> {
> > + return 0;
> > +}
> > +
>
> <...>
>
> > +
> > + /* No data-path, but need stub Rx/Tx functions to avoid crash
> > + * when testing with the likes of testpmd.
> > + */
> > + ethdev->rx_pkt_burst = ice_dcf_representor_rx_burst;
> > + ethdev->tx_pkt_burst = ice_dcf_representor_tx_burst;
> > +
> > + ethdev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR;
> > + ethdev->data->representor_id = representor->vf_id;
> > +
> > + struct rte_ether_addr mac_addr;
> Why not move this to the beginning of the function?
Format error
>
> > +
> > + memset(&mac_addr, 0, sizeof(mac_addr));
> > + ethdev->data->mac_addrs = &mac_addr;
> > +
> > + return 0;
> > +}
> > +
> > +int
> > +ice_dcf_vf_representor_uninit(struct rte_eth_dev *ethdev) {
> > + ethdev->data->mac_addrs = NULL;
> > +
> > + return 0;
> > +}
> > +
> > --
> > 2.17.1
> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Qiming Yang
> Sent: Wednesday, September 2, 2020 2:38 PM
> To: dev@dpdk.org
> Cc: Zhang, Qi Z <qi.z.zhang@intel.com>; Yang, Qiming
> <qiming.yang@intel.com>
> Subject: [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor
> infrastructure
>
> Defines data structures and code to init/uninit VF representors during
> pci_probe and pci_remove respectively.
> Most of the dev_ops for the VF representor are just stubs for now and will be
> will be filled out in next patch
>
> Signed-off-by: Qiming Yang <qiming.yang@intel.com>
> ---
> drivers/net/ice/Makefile | 1 +
> drivers/net/ice/ice_dcf_ethdev.c | 66 +++++-
> drivers/net/ice/ice_dcf_ethdev.h | 11 +
> drivers/net/ice/ice_dcf_vf_representor.c | 245 +++++++++++++++++++++++
> 4 files changed, 321 insertions(+), 2 deletions(-) create mode 100644
> drivers/net/ice/ice_dcf_vf_representor.c
>
> diff --git a/drivers/net/ice/Makefile b/drivers/net/ice/Makefile index
> 34cd4024b..f9eb34a87 100644
> --- a/drivers/net/ice/Makefile
> +++ b/drivers/net/ice/Makefile
> @@ -88,6 +88,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) +=
> ice_generic_flow.c
>
> SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf.c
> SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf_ethdev.c
> +SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf_vf_representor.c
> SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf_parent.c
Need to change in meson.build.
>
> # install this header file
> diff --git a/drivers/net/ice/ice_dcf_ethdev.c b/drivers/net/ice/ice_dcf_ethdev.c
> index 2faed3cc7..73af87785 100644
> --- a/drivers/net/ice/ice_dcf_ethdev.c
> +++ b/drivers/net/ice/ice_dcf_ethdev.c
> @@ -973,17 +973,79 @@ ice_dcf_cap_selected(struct rte_devargs *devargs)
> static int eth_ice_dcf_pci_probe(__rte_unused struct rte_pci_driver *pci_drv,
> struct rte_pci_device *pci_dev) {
<snip>
>
> static int eth_ice_dcf_pci_remove(struct rte_pci_device *pci_dev) {
> - return rte_eth_dev_pci_generic_remove(pci_dev, ice_dcf_dev_uninit);
> + struct rte_eth_dev *ethdev;
> +
> + ethdev = rte_eth_dev_allocated(pci_dev->device.name);
> + if (!ethdev)
> + return 0;
> +
> + if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
> + return rte_eth_dev_pci_generic_remove(pci_dev,
> + ice_dcf_dev_uninit);
Should be ice_dcf_vf_representor_uninit here and
ice_dcf_dev_uninit below ?
> + else
> + return rte_eth_dev_pci_generic_remove(pci_dev,
> +
> ice_dcf_vf_representor_uninit);
> }
>
<snip>
@@ -88,6 +88,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_generic_flow.c
SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf.c
SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf_ethdev.c
+SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf_vf_representor.c
SRCS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += ice_dcf_parent.c
# install this header file
@@ -973,17 +973,79 @@ ice_dcf_cap_selected(struct rte_devargs *devargs)
static int eth_ice_dcf_pci_probe(__rte_unused struct rte_pci_driver *pci_drv,
struct rte_pci_device *pci_dev)
{
+ struct rte_eth_devargs eth_da = { .nb_representor_ports = 0 };
+ char name[RTE_ETH_NAME_MAX_LEN];
+ int i, retval;
+
if (!ice_dcf_cap_selected(pci_dev->device.devargs))
return 1;
- return rte_eth_dev_pci_generic_probe(pci_dev,
+ if (pci_dev->device.devargs) {
+ retval = rte_eth_devargs_parse(pci_dev->device.devargs->args,
+ ð_da);
+ if (retval)
+ return retval;
+ }
+
+ retval = rte_eth_dev_pci_generic_probe(pci_dev,
sizeof(struct ice_dcf_adapter),
ice_dcf_dev_init);
+ if (retval)
+ return retval;
+
+ /* probe VF representor ports */
+ struct rte_eth_dev *dcf_ethdev =
+ rte_eth_dev_allocated(pci_dev->device.name);
+
+ if (dcf_ethdev == NULL) {
+ PMD_DRV_LOG(ERR, "failed to allocate ethdev.\n");
+ return -ENODEV;
+ }
+
+ for (i = 0; i < eth_da.nb_representor_ports; i++) {
+ if (eth_da.representor_ports[i] == 0) {
+ PMD_DRV_LOG(ERR, "vf 0 can't be a vf representor.\n");
+ continue;
+ }
+
+ struct ice_dcf_vf_representor representor = {
+ .vf_id = eth_da.representor_ports[i],
+ .switch_domain_id = 0,
+ .adapter = (struct ice_dcf_adapter *)
+ dcf_ethdev->data->dev_private
+ };
+
+ snprintf(name, sizeof(name), "net_%s_representor_%d",
+ pci_dev->device.name, eth_da.representor_ports[i]);
+
+ retval = rte_eth_dev_create(&pci_dev->device, name,
+ sizeof(struct ice_dcf_vf_representor),
+ NULL, NULL, ice_dcf_vf_representor_init,
+ &representor);
+
+ if (retval)
+ PMD_DRV_LOG(ERR,
+ "failed to create dcf vf representor %s.\n",
+ name);
+ }
+
+ return 0;
}
static int eth_ice_dcf_pci_remove(struct rte_pci_device *pci_dev)
{
- return rte_eth_dev_pci_generic_remove(pci_dev, ice_dcf_dev_uninit);
+ struct rte_eth_dev *ethdev;
+
+ ethdev = rte_eth_dev_allocated(pci_dev->device.name);
+ if (!ethdev)
+ return 0;
+
+ if (ethdev->data->dev_flags & RTE_ETH_DEV_REPRESENTOR)
+ return rte_eth_dev_pci_generic_remove(pci_dev,
+ ice_dcf_dev_uninit);
+ else
+ return rte_eth_dev_pci_generic_remove(pci_dev,
+ ice_dcf_vf_representor_uninit);
}
static const struct rte_pci_id pci_id_ice_dcf_map[] = {
@@ -22,9 +22,20 @@ struct ice_dcf_adapter {
struct ice_dcf_hw real_hw;
};
+/**
+ * Struct to store private data for each VF representor instance
+ */
+struct ice_dcf_vf_representor {
+ struct ice_dcf_adapter *adapter;
+ uint16_t switch_domain_id;
+ uint16_t vf_id;
+};
+
void ice_dcf_handle_pf_event_msg(struct ice_dcf_hw *dcf_hw,
uint8_t *msg, uint16_t msglen);
int ice_dcf_init_parent_adapter(struct rte_eth_dev *eth_dev);
void ice_dcf_uninit_parent_adapter(struct rte_eth_dev *eth_dev);
+int ice_dcf_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params);
+int ice_dcf_vf_representor_uninit(struct rte_eth_dev *ethdev);
#endif /* _ICE_DCF_ETHDEV_H_ */
new file mode 100644
@@ -0,0 +1,245 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2020 Intel Corporation
+ */
+
+#include <errno.h>
+#include <stdbool.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+
+#include <rte_interrupts.h>
+#include <rte_debug.h>
+#include <rte_pci.h>
+#include <rte_atomic.h>
+#include <rte_eal.h>
+#include <rte_ether.h>
+#include <rte_ethdev_pci.h>
+#include <rte_kvargs.h>
+#include <rte_malloc.h>
+#include <rte_memzone.h>
+#include <rte_dev.h>
+
+#include <iavf_devids.h>
+
+#include "ice_generic_flow.h"
+#include "ice_dcf_ethdev.h"
+#include "ice_rxtx.h"
+
+static uint16_t
+ice_dcf_representor_rx_burst(__rte_unused void *rxq,
+ __rte_unused struct rte_mbuf **rx_pkts,
+ __rte_unused uint16_t nb_pkts)
+{
+ return 0;
+}
+
+static uint16_t
+ice_dcf_representor_tx_burst(__rte_unused void *txq,
+ __rte_unused struct rte_mbuf **tx_pkts,
+ __rte_unused uint16_t nb_pkts)
+{
+ return 0;
+}
+
+static int
+ice_dcf_representor_dev_configure(__rte_unused struct rte_eth_dev *dev)
+{
+ return 0;
+}
+
+static int
+ice_dcf_representor_dev_start(struct rte_eth_dev *dev)
+{
+ dev->data->dev_link.link_status = ETH_LINK_UP;
+
+ return 0;
+}
+
+static void
+ice_dcf_representor_dev_stop(struct rte_eth_dev *dev)
+{
+ dev->data->dev_link.link_status = ETH_LINK_DOWN;
+}
+
+static int
+ice_dcf_representor_rx_queue_setup(__rte_unused struct rte_eth_dev *dev,
+ __rte_unused uint16_t rx_queue_id,
+ __rte_unused uint16_t nb_rx_desc,
+ __rte_unused unsigned int socket_id,
+ __rte_unused const struct rte_eth_rxconf *rx_conf,
+ __rte_unused struct rte_mempool *mb_pool)
+{
+ return 0;
+}
+
+static int
+ice_dcf_representor_tx_queue_setup(__rte_unused struct rte_eth_dev *dev,
+ __rte_unused uint16_t rx_queue_id,
+ __rte_unused uint16_t nb_rx_desc,
+ __rte_unused unsigned int socket_id,
+ __rte_unused const struct rte_eth_txconf *tx_conf)
+{
+ return 0;
+}
+
+static int
+ice_dcf_representor_promiscuous_enable(__rte_unused struct rte_eth_dev *ethdev)
+{
+ return 0;
+}
+
+static int
+ice_dcf_representor_promiscuous_disable(__rte_unused struct rte_eth_dev *ethdev)
+{
+ return 0;
+}
+
+static int
+ice_dcf_representor_link_update(__rte_unused struct rte_eth_dev *ethdev,
+ __rte_unused int wait_to_complete)
+{
+ return 0;
+}
+
+static int
+ice_dcf_representor_dev_info_get(struct rte_eth_dev *dev,
+ struct rte_eth_dev_info *dev_info)
+{
+ struct ice_dcf_vf_representor *representor = dev->data->dev_private;
+ struct ice_dcf_hw *hw = &representor->adapter->real_hw;
+
+ dev_info->device = dev->device;
+ dev_info->max_mac_addrs = 1;
+ dev_info->max_rx_queues = hw->vsi_res->num_queue_pairs;
+ dev_info->max_tx_queues = hw->vsi_res->num_queue_pairs;
+ dev_info->min_rx_bufsize = ICE_BUF_SIZE_MIN;
+ dev_info->max_rx_pktlen = ICE_FRAME_SIZE_MAX;
+ dev_info->hash_key_size = hw->vf_res->rss_key_size;
+ dev_info->reta_size = hw->vf_res->rss_lut_size;
+ dev_info->flow_type_rss_offloads = ICE_RSS_OFFLOAD_ALL;
+
+ dev_info->rx_offload_capa =
+ DEV_RX_OFFLOAD_VLAN_STRIP |
+ DEV_RX_OFFLOAD_IPV4_CKSUM |
+ DEV_RX_OFFLOAD_UDP_CKSUM |
+ DEV_RX_OFFLOAD_TCP_CKSUM |
+ DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
+ DEV_RX_OFFLOAD_SCATTER |
+ DEV_RX_OFFLOAD_JUMBO_FRAME |
+ DEV_RX_OFFLOAD_VLAN_FILTER |
+ DEV_RX_OFFLOAD_RSS_HASH;
+ dev_info->tx_offload_capa =
+ DEV_TX_OFFLOAD_VLAN_INSERT |
+ DEV_TX_OFFLOAD_IPV4_CKSUM |
+ DEV_TX_OFFLOAD_UDP_CKSUM |
+ DEV_TX_OFFLOAD_TCP_CKSUM |
+ DEV_TX_OFFLOAD_SCTP_CKSUM |
+ DEV_TX_OFFLOAD_OUTER_IPV4_CKSUM |
+ DEV_TX_OFFLOAD_TCP_TSO |
+ DEV_TX_OFFLOAD_VXLAN_TNL_TSO |
+ DEV_TX_OFFLOAD_GRE_TNL_TSO |
+ DEV_TX_OFFLOAD_IPIP_TNL_TSO |
+ DEV_TX_OFFLOAD_GENEVE_TNL_TSO |
+ DEV_TX_OFFLOAD_MULTI_SEGS;
+
+ dev_info->default_rxconf = (struct rte_eth_rxconf) {
+ .rx_thresh = {
+ .pthresh = ICE_DEFAULT_RX_PTHRESH,
+ .hthresh = ICE_DEFAULT_RX_HTHRESH,
+ .wthresh = ICE_DEFAULT_RX_WTHRESH,
+ },
+ .rx_free_thresh = ICE_DEFAULT_RX_FREE_THRESH,
+ .rx_drop_en = 0,
+ .offloads = 0,
+ };
+
+ dev_info->default_txconf = (struct rte_eth_txconf) {
+ .tx_thresh = {
+ .pthresh = ICE_DEFAULT_TX_PTHRESH,
+ .hthresh = ICE_DEFAULT_TX_HTHRESH,
+ .wthresh = ICE_DEFAULT_TX_WTHRESH,
+ },
+ .tx_free_thresh = ICE_DEFAULT_TX_FREE_THRESH,
+ .tx_rs_thresh = ICE_DEFAULT_TX_RSBIT_THRESH,
+ .offloads = 0,
+ };
+
+ dev_info->rx_desc_lim = (struct rte_eth_desc_lim) {
+ .nb_max = ICE_MAX_RING_DESC,
+ .nb_min = ICE_MIN_RING_DESC,
+ .nb_align = ICE_ALIGN_RING_DESC,
+ };
+
+ dev_info->tx_desc_lim = (struct rte_eth_desc_lim) {
+ .nb_max = ICE_MAX_RING_DESC,
+ .nb_min = ICE_MIN_RING_DESC,
+ .nb_align = ICE_ALIGN_RING_DESC,
+ };
+
+ dev_info->switch_info.name =
+ representor->adapter->real_hw.eth_dev->device->name;
+ dev_info->switch_info.domain_id = representor->switch_domain_id;
+ dev_info->switch_info.port_id = representor->vf_id;
+
+ return 0;
+}
+
+static const struct eth_dev_ops ice_dcf_representor_dev_ops = {
+ .dev_configure = ice_dcf_representor_dev_configure,
+ .dev_start = ice_dcf_representor_dev_start,
+ .dev_stop = ice_dcf_representor_dev_stop,
+ .dev_infos_get = ice_dcf_representor_dev_info_get,
+ .rx_queue_setup = ice_dcf_representor_rx_queue_setup,
+ .tx_queue_setup = ice_dcf_representor_tx_queue_setup,
+ .promiscuous_enable = ice_dcf_representor_promiscuous_enable,
+ .promiscuous_disable = ice_dcf_representor_promiscuous_disable,
+ .link_update = ice_dcf_representor_link_update,
+};
+
+int
+ice_dcf_vf_representor_init(struct rte_eth_dev *ethdev, void *init_params)
+{
+ struct ice_dcf_vf_representor *representor = ethdev->data->dev_private;
+ struct ice_dcf_hw *real_hw;
+
+ representor->adapter =
+ ((struct ice_dcf_vf_representor *)init_params)->adapter;
+ representor->switch_domain_id =
+ ((struct ice_dcf_vf_representor *)
+ init_params)->switch_domain_id;
+ representor->vf_id =
+ ((struct ice_dcf_vf_representor *)init_params)->vf_id;
+
+ real_hw = &representor->adapter->real_hw;
+
+ if (representor->vf_id >= real_hw->num_vfs)
+ return -ENODEV;
+
+ ethdev->dev_ops = &ice_dcf_representor_dev_ops;
+
+ /* No data-path, but need stub Rx/Tx functions to avoid crash
+ * when testing with the likes of testpmd.
+ */
+ ethdev->rx_pkt_burst = ice_dcf_representor_rx_burst;
+ ethdev->tx_pkt_burst = ice_dcf_representor_tx_burst;
+
+ ethdev->data->dev_flags |= RTE_ETH_DEV_REPRESENTOR;
+ ethdev->data->representor_id = representor->vf_id;
+
+ struct rte_ether_addr mac_addr;
+
+ memset(&mac_addr, 0, sizeof(mac_addr));
+ ethdev->data->mac_addrs = &mac_addr;
+
+ return 0;
+}
+
+int
+ice_dcf_vf_representor_uninit(struct rte_eth_dev *ethdev)
+{
+ ethdev->data->mac_addrs = NULL;
+
+ return 0;
+}
+