DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH 0/2] enable VLAN offload in DCF
@ 2020-09-02  6:38 Qiming Yang
  2020-09-02  6:38 ` [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor infrastructure Qiming Yang
  2020-09-02  6:38 ` [dpdk-dev] [PATCH 2/2] net/ice: add VLAN config for DCF Qiming Yang
  0 siblings, 2 replies; 6+ messages in thread
From: Qiming Yang @ 2020-09-02  6:38 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

This patch set enabled port representor and vlan offload
base on DCF port representor.

Qiming Yang (2):
  net/ice: add dcf port representor infrastructure
  net/ice: add VLAN config for DCF

 drivers/net/ice/Makefile                 |   1 +
 drivers/net/ice/ice_dcf.h                |   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 | 365 +++++++++++++++++++++++
 5 files changed, 442 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ice/ice_dcf_vf_representor.c

-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor infrastructure
  2020-09-02  6:38 [dpdk-dev] [PATCH 0/2] enable VLAN offload in DCF Qiming Yang
@ 2020-09-02  6:38 ` Qiming Yang
  2020-09-08 11:35   ` Xing, Beilei
  2020-10-20  8:18   ` Xing, Beilei
  2020-09-02  6:38 ` [dpdk-dev] [PATCH 2/2] net/ice: add VLAN config for DCF Qiming Yang
  1 sibling, 2 replies; 6+ messages in thread
From: Qiming Yang @ 2020-09-02  6:38 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

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
 
 # 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)
 {
+	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,
+					       &eth_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[] = {
diff --git a/drivers/net/ice/ice_dcf_ethdev.h b/drivers/net/ice/ice_dcf_ethdev.h
index b54528bea..bf6e6982f 100644
--- a/drivers/net/ice/ice_dcf_ethdev.h
+++ b/drivers/net/ice/ice_dcf_ethdev.h
@@ -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_ */
diff --git a/drivers/net/ice/ice_dcf_vf_representor.c b/drivers/net/ice/ice_dcf_vf_representor.c
new file mode 100644
index 000000000..ceb54ab15
--- /dev/null
+++ b/drivers/net/ice/ice_dcf_vf_representor.c
@@ -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;
+}
+
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH 2/2] net/ice: add VLAN config for DCF
  2020-09-02  6:38 [dpdk-dev] [PATCH 0/2] enable VLAN offload in DCF Qiming Yang
  2020-09-02  6:38 ` [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor infrastructure Qiming Yang
@ 2020-09-02  6:38 ` Qiming Yang
  1 sibling, 0 replies; 6+ messages in thread
From: Qiming Yang @ 2020-09-02  6:38 UTC (permalink / raw)
  To: dev; +Cc: qi.z.zhang, Qiming Yang

This patch add support for VF VLAN offload, port VLAN id set and
VLAN ethertype set in DCF.

This patch depend on base code update.

Signed-off-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/ice_dcf.h                |   1 +
 drivers/net/ice/ice_dcf_vf_representor.c | 120 +++++++++++++++++++++++
 2 files changed, 121 insertions(+)

diff --git a/drivers/net/ice/ice_dcf.h b/drivers/net/ice/ice_dcf.h
index a44a01e90..b960cf7cf 100644
--- a/drivers/net/ice/ice_dcf.h
+++ b/drivers/net/ice/ice_dcf.h
@@ -59,6 +59,7 @@ struct ice_dcf_hw {
 	uint16_t nb_msix;
 	uint16_t rxq_map[16];
 	struct virtchnl_eth_stats eth_stats_offset;
+	struct virtchnl_dcf_vlan_offload vlan_config;
 };
 
 int ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,
diff --git a/drivers/net/ice/ice_dcf_vf_representor.c b/drivers/net/ice/ice_dcf_vf_representor.c
index ceb54ab15..53d0db85f 100644
--- a/drivers/net/ice/ice_dcf_vf_representor.c
+++ b/drivers/net/ice/ice_dcf_vf_representor.c
@@ -185,6 +185,123 @@ ice_dcf_representor_dev_info_get(struct rte_eth_dev *dev,
 	return 0;
 }
 
+static int
+ice_dcf_config_vlan_offload(struct ice_dcf_hw *hw,
+		struct virtchnl_dcf_vlan_offload *vlan_config)
+{
+	struct dcf_virtchnl_cmd args;
+	int err;
+
+	memset(&args, 0, sizeof(args));
+	args.v_op = VIRTCHNL_OP_DCF_VLAN_OFFLOAD;
+	args.req_msg = (uint8_t *)vlan_config;
+	args.req_msglen = sizeof(vlan_config);
+	err = ice_dcf_execute_virtchnl_cmd(hw, &args);
+	if (err)
+		PMD_DRV_LOG(ERR, "fail to execute command %s",
+				 "VIRTCHNL_OP_DCF_VLAN_OFFLOAD");
+	return err;
+}
+
+static int
+ice_dcf_representor_vlan_offload_set(struct rte_eth_dev *dev, int mask)
+{
+	struct ice_dcf_vf_representor *representor = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &representor->adapter->real_hw;
+	struct virtchnl_dcf_vlan_offload vlan_config;
+	int ret = 0;
+
+	vlan_config.vf_id = representor->vf_id;
+
+	if (hw->vlan_config.tx_flags == VIRTCHNL_VLAN_TX_INSERT) {
+		PMD_DRV_LOG(ERR, "Please clear pvid before set vlan offload.");
+		return -EINVAL;
+	}
+
+	if (mask & ETH_VLAN_STRIP_MASK) {
+		if (hw->vf_res->vf_cap_flags & VIRTCHNL_VF_OFFLOAD_VLAN) {
+			vlan_config.type = VIRTCHNL_VLAN_OUTER_TYPE;
+			vlan_config.rx_flags = VIRTCHNL_VLAN_RX_STRIP_IN_DESC;
+			vlan_config.tx_flags = VIRTCHNL_VLAN_TX_INSERT_BY_DESC;
+		} else {
+			vlan_config.type = VIRTCHNL_VLAN_OUTER_TYPE;
+			vlan_config.rx_flags = VIRTCHNL_VLAN_RX_NO_STRIP;
+			vlan_config.tx_flags = VIRTCHNL_VLAN_TX_INSERT_BY_DESC;
+		}
+		ret = ice_dcf_config_vlan_offload(hw, &vlan_config);
+		if (ret < 0) {
+			PMD_DRV_LOG(ERR, "Failed to set vlan offload.");
+			return -EINVAL;
+		}
+	}
+
+	rte_memcpy(&hw->vlan_config, &vlan_config, sizeof(vlan_config));
+
+	return ret;
+}
+
+static int
+ice_dcf_representor_vlan_pvid_set(struct rte_eth_dev *dev,
+				  uint16_t pvid, int on)
+{
+	struct ice_dcf_vf_representor *representor = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &representor->adapter->real_hw;
+	struct virtchnl_dcf_vlan_offload vlan_config;
+	int ret;
+
+	vlan_config.vf_id = representor->vf_id;
+	vlan_config.type = VIRTCHNL_VLAN_OUTER_TYPE;
+	vlan_config.vlan_id = pvid;
+	if (on) {
+		vlan_config.rx_flags = VIRTCHNL_VLAN_RX_STRIP_ONLY;
+		vlan_config.tx_flags = VIRTCHNL_VLAN_TX_INSERT;
+	} else {
+		vlan_config.rx_flags = VIRTCHNL_VLAN_RX_NO_STRIP;
+		vlan_config.tx_flags = VIRTCHNL_VLAN_TX_INSERT_BY_DESC;
+	}
+
+	ret = ice_dcf_config_vlan_offload(hw, &vlan_config);
+	if (ret < 0) {
+		PMD_DRV_LOG(ERR, "Failed to set pvid.");
+		return -EINVAL;
+	}
+
+	rte_memcpy(&hw->vlan_config, &vlan_config, sizeof(vlan_config));
+
+	return 0;
+}
+
+static int
+ice_dcf_representor_vlan_tpid_set(struct rte_eth_dev *dev,
+				  enum rte_vlan_type vlan_type,
+				  uint16_t tpid)
+{
+	struct ice_dcf_vf_representor *representor = dev->data->dev_private;
+	struct ice_dcf_hw *hw = &representor->adapter->real_hw;
+	struct virtchnl_dcf_vlan_offload vlan_config;
+	int ret;
+
+	if (vlan_type != ETH_VLAN_TYPE_INNER &&
+	    vlan_type != ETH_VLAN_TYPE_OUTER) {
+		PMD_DRV_LOG(ERR,
+			    "Unsupported vlan type.");
+		return -EINVAL;
+	}
+
+	vlan_config.vf_id = representor->vf_id;
+	vlan_config.ether_type = tpid;
+	ret = ice_dcf_config_vlan_offload(hw, &vlan_config);
+	if (ret < 0) {
+		PMD_DRV_LOG(ERR,
+			    "Set tpid fail\n");
+		return ret;
+	}
+
+	rte_memcpy(&hw->vlan_config, &vlan_config, sizeof(vlan_config));
+
+	return ret;
+}
+
 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,
@@ -195,6 +312,9 @@ static const struct eth_dev_ops ice_dcf_representor_dev_ops = {
 	.promiscuous_enable   = ice_dcf_representor_promiscuous_enable,
 	.promiscuous_disable  = ice_dcf_representor_promiscuous_disable,
 	.link_update          = ice_dcf_representor_link_update,
+	.vlan_offload_set     = ice_dcf_representor_vlan_offload_set,
+	.vlan_pvid_set        = ice_dcf_representor_vlan_pvid_set,
+	.vlan_tpid_set        = ice_dcf_representor_vlan_tpid_set,
 };
 
 int
-- 
2.17.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor infrastructure
  2020-09-02  6:38 ` [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor infrastructure Qiming Yang
@ 2020-09-08 11:35   ` Xing, Beilei
  2020-09-09  7:18     ` Yang, Qiming
  2020-10-20  8:18   ` Xing, Beilei
  1 sibling, 1 reply; 6+ messages in thread
From: Xing, Beilei @ 2020-09-08 11:35 UTC (permalink / raw)
  To: Yang, Qiming, dev; +Cc: Zhang, Qi Z, Yang, Qiming



> -----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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor infrastructure
  2020-09-08 11:35   ` Xing, Beilei
@ 2020-09-09  7:18     ` Yang, Qiming
  0 siblings, 0 replies; 6+ messages in thread
From: Yang, Qiming @ 2020-09-09  7:18 UTC (permalink / raw)
  To: Xing, Beilei, dev; +Cc: Zhang, Qi Z

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor infrastructure
  2020-09-02  6:38 ` [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor infrastructure Qiming Yang
  2020-09-08 11:35   ` Xing, Beilei
@ 2020-10-20  8:18   ` Xing, Beilei
  1 sibling, 0 replies; 6+ messages in thread
From: Xing, Beilei @ 2020-10-20  8:18 UTC (permalink / raw)
  To: Yang, Qiming, dev; +Cc: Zhang, Qi Z, Yang, Qiming



> -----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>

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-10-20  8:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-02  6:38 [dpdk-dev] [PATCH 0/2] enable VLAN offload in DCF Qiming Yang
2020-09-02  6:38 ` [dpdk-dev] [PATCH 1/2] net/ice: add dcf port representor infrastructure Qiming Yang
2020-09-08 11:35   ` Xing, Beilei
2020-09-09  7:18     ` Yang, Qiming
2020-10-20  8:18   ` Xing, Beilei
2020-09-02  6:38 ` [dpdk-dev] [PATCH 2/2] net/ice: add VLAN config for DCF Qiming Yang

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git