add Intel DCF PMD support
Subsystems (2)
Hi Xiaolong,
Yes, found the root cause. Will fix it next version.
BR,
Haiyue
Quoted 97 lines
-----Original Message-----
From: Ye, Xiaolong <[email protected]>
Sent: Thursday, March 26, 2020 13:06
To: Wang, Haiyue <[email protected]>
Cc: [email protected]; Zhang, Qi Z <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>; Zhao1, Wei <[email protected]>
Subject: Re: [PATCH v4 0/7] add Intel DCF PMD supportThere is build error about this patchset, could you double check?
OS: CENTOS77-64
Target: x86_64-native-linuxapp-gcc+shared
LD librte_pmd_ice.so.20.0.2
CC sfc_ev.o
ice_dcf_parent.o: In function `ice_dcf_handle_pf_event_msg':
ice_dcf_parent.c:(.text+0x556): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
make[6]: *** [librte_pmd_ice.so.20.0.2] Error 1
make[5]: *** [ice] Error 2
make[5]: *** Waiting for unfinished jobs....
CC sfc_port.o
CC bnxt_rxtx_vec_sse.o
CC sfc_rx.o
CC nicvf_hw.o
--
CC medford2_nic.o
LD librte_pmd_octeontx2.so.20.0.2
INSTALL-LIB librte_pmd_octeontx2.so.20.0.2
LD librte_pmd_sfc_efx.so.20.0.2
INSTALL-LIB librte_pmd_sfc_efx.so.20.0.2
make[4]: *** [net] Error 2
make[3]: *** [drivers] Error 2
make[2]: *** [all] Error 2
make[1]: *** [pre_install] Error 2
make: *** [install] Error 2http://mails.dpdk.org/archives/test-report/2020-March/122145.html
Quoted 56 lines · Haiyue Wang
A DCF (Device Config Function) based approach is proposed where a device bound to the device's VF0 can act as a sole controlling entity to exercise advance functionality (such as switch, ACL) for rest of the VFs.
The DCF works as a standalone PMD to support this function, which shares the ice PMD flow control core function and the iavf virtchnl mailbox core module.
v4:
Change the alarm handler to thread service, since it will need to do more work.v3:
1. Fixed the error log message format.
2. Fixed some memory allocation check.
3. Fixed some code style issue and commmit message description.v2:
1. update the iavf patchset link.
2. split more patches for making this work be more understandable
3. fix the log function usage, devargs checking from v1.Haiyue Wang (7):
net/iavf: stop the PCI probe in DCF mode
net/ice: add the DCF hardware initialization
net/ice: acquire and disable the DCF capability
net/ice: handle the AdminQ command by DCF
net/ice: export the DDP definition symbols
net/ice: handle the PF initialization by DCF
net/ice: get the VF hardware index in DCFdoc/guides/nics/ice.rst | 47 ++ doc/guides/nics/img/ice_dcf.png | Bin 0 -> 39168 bytes doc/guides/rel_notes/release_20_05.rst | 5 + drivers/common/Makefile | 1 + drivers/net/iavf/iavf_ethdev.c | 43 ++ drivers/net/ice/Makefile | 6 + drivers/net/ice/ice_dcf.c | 658 +++++++++++++++++++++++++ drivers/net/ice/ice_dcf.h | 63 +++ drivers/net/ice/ice_dcf_ethdev.c | 321 ++++++++++++ drivers/net/ice/ice_dcf_ethdev.h | 33 ++ drivers/net/ice/ice_dcf_parent.c | 351 +++++++++++++ drivers/net/ice/ice_ethdev.c | 9 +- drivers/net/ice/ice_ethdev.h | 8 + drivers/net/ice/meson.build | 8 +- mk/rte.app.mk | 1 + 15 files changed, 1544 insertions(+), 10 deletions(-)create mode 100644 doc/guides/nics/img/ice_dcf.png create mode 100644
drivers/net/ice/ice_dcf.ccreate mode 100644drivers/net/ice/ice_dcf.hcreate mode 100644drivers/net/ice/ice_dcf_ethdev.ccreate mode 100644drivers/net/ice/ice_dcf_ethdev.hcreate mode 100644drivers/net/ice/ice_dcf_parent.c--
2.26.0
v5 cover add Intel DCF PMD support
In reply to Haiyue WangA DCF (Device Config Function) based approach is proposed where a device bound to the device's VF0 can act as a sole controlling entity to exercise advance functionality (such as switch, ACL) for rest of the VFs.
The DCF works as a standalone PMD to support this function, which shares the ice PMD flow control core function and the iavf virtchnl mailbox core module.
v5:
Fixed the shared module compile errror.
v4:
Change the alarm handler to thread service, since it will need to do more work.
v3:
1. Fixed the error log message format.
2. Fixed some memory allocation check.
3. Fixed some code style issue and commmit message description.
v2:
1. update the iavf patchset link.
2. split more patches for making this work be more understandable
3. fix the log function usage, devargs checking from v1.
Haiyue Wang (7):
net/iavf: stop the PCI probe in DCF mode
net/ice: add the DCF hardware initialization
net/ice: acquire and disable the DCF capability
net/ice: handle the AdminQ command by DCF
net/ice: export the DDP definition symbols
net/ice: handle the PF initialization by DCF
net/ice: get the VF hardware index in DCF
doc/guides/nics/ice.rst | 47 ++ doc/guides/nics/img/ice_dcf.png | Bin 0 -> 39168 bytes doc/guides/rel_notes/release_20_05.rst | 5 + drivers/common/Makefile | 1 + drivers/net/iavf/iavf_ethdev.c | 43 ++ drivers/net/ice/Makefile | 7 + drivers/net/ice/ice_dcf.c | 658 +++++++++++++++++++++++++ drivers/net/ice/ice_dcf.h | 63 +++ drivers/net/ice/ice_dcf_ethdev.c | 321 ++++++++++++ drivers/net/ice/ice_dcf_ethdev.h | 33 ++ drivers/net/ice/ice_dcf_parent.c | 351 +++++++++++++ drivers/net/ice/ice_ethdev.c | 9 +- drivers/net/ice/ice_ethdev.h | 8 + drivers/net/ice/meson.build | 8 +- mk/rte.app.mk | 1 + 15 files changed, 1545 insertions(+), 10 deletions(-) create mode 100644 doc/guides/nics/img/ice_dcf.png create mode 100644 drivers/net/ice/ice_dcf.c create mode 100644 drivers/net/ice/ice_dcf.h create mode 100644 drivers/net/ice/ice_dcf_ethdev.c create mode 100644 drivers/net/ice/ice_dcf_ethdev.h create mode 100644 drivers/net/ice/ice_dcf_parent.c
Signature · 1 line
2.26.0
PATCH v5 1/7 net/iavf: stop the PCI probe in DCF mode
A new DCF PMD will be introduced, which runs on Intel VF hardware, and it is a pure software design to control the advance functionality (such as switch, ACL) for rest of the VFs.
So if the DCF (Device Config Function) mode is specified by the devarg 'cap=dcf', then it will stop the PCI probe in the iavf PMD.
--- drivers/net/iavf/iavf_ethdev.c | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/net/iavf/iavf_ethdev.c +43 -0
@@ -1416,9 +1416,51 @@ iavf_dev_uninit(struct rte_eth_dev *dev)return 0 ; } +static int +iavf_dcf_cap_check_handler(__rte_unused const char *key, + const char *value, __rte_unused void *opaque) +{ +if (strcmp (value,"dcf" )) +return -1 ; + +return 0 ; +} + +static int +iavf_dcf_cap_selected (struct rte_devargs *devargs) +{ +struct rte_kvargs *kvlist; +const char *key ="cap" ; +int ret =0 ; + +if (devargs ==NULL ) +return 0 ; + + kvlist =rte_kvargs_parse (devargs->args,NULL ); +if (kvlist ==NULL ) +return 0 ; + +if (!rte_kvargs_count (kvlist, key)) + goto exit; + +/* dcf capability selected when there's a key-value pair: cap=dcf */ +if (rte_kvargs_process (kvlist, key, + iavf_dcf_cap_check_handler,NULL ) <0 ) + goto exit; + + ret =1 ; + +exit: +rte_kvargs_free (kvlist); +return ret; +} + static int eth_iavf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,struct rte_pci_device *pci_dev) { +if (iavf_dcf_cap_selected (pci_dev->device.devargs)) +return 1 ; +return rte_eth_dev_pci_generic_probe (pci_dev,sizeof (struct iavf_adapter ), iavf_dev_init); }
@@ -1439,6 +1481,7 @@ static struct rte_pci_driver rte_iavf_pmd = {RTE_PMD_REGISTER_PCI (net_iavf, rte_iavf_pmd);RTE_PMD_REGISTER_PCI_TABLE (net_iavf, pci_id_iavf_map);RTE_PMD_REGISTER_KMOD_DEP (net_iavf,"* igb_uio | vfio-pci" ); +RTE_PMD_REGISTER_PARAM_STRING (net_iavf,"cap=dcf" );RTE_INIT (iavf_init_log) { iavf_logtype_init =rte_log_register ("pmd.net.iavf.init" );
Signature · 1 line
2.26.0
PATCH v5 2/7 net/ice: add the DCF hardware initialization
In reply to Haiyue WangIntroduce the DCF (Device Config Function) feature in the ice PMD, it works as a standalone PMD which doesn't handle the packet Rx/Tx related things. Its hardware entity is the VF.
Add the basic DCF hardware initialization, this is specified by devarg 'cap=dcf'.
--- doc/guides/nics/ice.rst | 47 +++ doc/guides/nics/img/ice_dcf.png | Bin 0 -> 39168 bytes doc/guides/rel_notes/release_20_05.rst | 5 + drivers/common/Makefile | 1 + drivers/net/ice/Makefile | 5 + drivers/net/ice/ice_dcf.c | 474 +++++++++++++++++++++++++ drivers/net/ice/ice_dcf.h | 52 +++ drivers/net/ice/ice_dcf_ethdev.c | 317 +++++++++++++++++ drivers/net/ice/ice_dcf_ethdev.h | 24 ++ drivers/net/ice/meson.build | 7 +- mk/rte.app.mk | 1 + 11 files changed, 931 insertions(+), 2 deletions(-) create mode 100644 doc/guides/nics/img/ice_dcf.png create mode 100644 drivers/net/ice/ice_dcf.c create mode 100644 drivers/net/ice/ice_dcf.h create mode 100644 drivers/net/ice/ice_dcf_ethdev.c create mode 100644 drivers/net/ice/ice_dcf_ethdev.h
doc/guides/nics/ice.rst +47 -0
@@ -240,6 +240,53 @@ report a MDD event and drop the packets. The APPs based on DPDK should avoid providing such packets. +Device Config Function (DCF) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This section demonstrates ICE DCF PMD, which shares the core module with ICE +PMD and iAVF PMD. + +A DCF (Device Config Function) PMD bounds to the device's trusted VF with ID 0, +it can act as a sole controlling entity to exercise advance functionality (such +as switch, ACL) for the rest VFs. + +The DCF PMD needs to advertise and acquire DCF capability which allows DCF to +send AdminQ commands that it would like to execute over to the PF and receive +responses for the same from PF. + +.. _figure_ice_dcf: + +.. figure:: img/ice_dcf.* + + DCF Communication flow. + +#. Create the VFs:: + + echo 4 > /sys/bus/pci/devices/0000\:18\:00.0/sriov_numvfs + +#. Enable the VF0 trust on:: + + ip link set dev enp24s0f0 vf 0 trust on + +#. Bind the VF0, and run testpmd with 'cap=dcf' devarg:: + + testpmd -l 22-25 -n 4 -w 18:01.0,cap=dcf -- -i + +#. Monitor the VF2 interface network traffic:: + + tcpdump -e -nn -i enp24s1f2 + +#. Create one flow to redirect the traffic to VF2 by DCF:: + + flow create 0 priority 0 ingress pattern eth / ipv4 src is 192.168.0.2 \ + dst is 192.168.0.3 / end actions vf id 2 / end + +#. Send the packet, and it should be displayed on tcpdump:: + + sendp(Ether(src='3c:fd:fe:aa:bb:78', dst='00:00:00:01:02:03')/IP(src=' \ + 192.168.0.2', dst="192.168.0.3")/TCP(flags='S')/Raw(load='XXXXXXXXXX'), \ + iface="enp24s0f0", count=10) + Sample Application Notes ------------------------
doc/guides/nics/img/ice_dcf.png new file binary +0 -0
doc/guides/rel_notes/release_20_05.rst +5 -0
@@ -62,6 +62,11 @@ New Features * Added support for matching on IPv4 Time To Live and IPv6 Hop Limit. +* **Updated the Intel ice driver.** + + Updated the Intel ice driver with new features and improvements, including: + + * Added support for DCF (Device Config Function) feature. Removed Items -------------
drivers/common/Makefile +1 -0
@@ -31,6 +31,7 @@ DIRS-y += dpaax endif IAVF-y := $(CONFIG_RTE_LIBRTE_IAVF_PMD) +IAVF-y += $(CONFIG_RTE_LIBRTE_ICE_PMD) ifneq (,$(findstring y,$(IAVF-y))) DIRS-y += iavf endif
drivers/net/ice/Makefile +5 -0
@@ -11,9 +11,11 @@ LIB = librte_pmd_ice.a CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -I$(RTE_SDK)/drivers/common/iavf LDLIBS += -lrte_eal -lrte_mbuf -lrte_ethdev -lrte_kvargs LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_hash +LDLIBS += -lrte_net -lrte_common_iavf EXPORT_MAP := rte_pmd_ice_version.map
@@ -84,6 +86,9 @@ ifeq ($(CC_AVX2_SUPPORT), 1) endif 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 + # install this header file SYMLINK-$(CONFIG_RTE_LIBRTE_ICE_PMD)-include := rte_pmd_ice.h
drivers/net/ice/ice_dcf.c new file +474 -0
474 lines not on this page · raw message
drivers/net/ice/ice_dcf.h new file +52 -0
52 lines not on this page · raw message
drivers/net/ice/ice_dcf_ethdev.c new file +317 -0
317 lines not on this page · raw message
drivers/net/ice/ice_dcf_ethdev.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2020 Intel Corporation +*/ + +#ifndef _ICE_DCF_ETHDEV_H_ +#define _ICE_DCF_ETHDEV_H_ + +#include "ice_ethdev.h" +#include "ice_dcf.h" + +#define ICE_DCF_MAX_RINGS 1 + +struct ice_dcf_queue { +uint64_t dummy; +}; + +struct ice_dcf_adapter { +struct ice_dcf_hw real_hw; +struct rte_ether_addr mac_addr; +struct ice_dcf_queue rxqs[ICE_DCF_MAX_RINGS ]; +struct ice_dcf_queue txqs[ICE_DCF_MAX_RINGS ]; +}; + +#endif /* _ICE_DCF_ETHDEV_H_ */
drivers/net/ice/meson.build +5 -2
@@ -15,8 +15,8 @@ sources = files( 'ice_hash.c' ) -deps += ['hash'] -includes += include_directories('base') +deps += ['hash', 'net', 'common_iavf'] +includes += include_directories('base', '../../common/iavf') if arch_subdir == 'x86' sources += files('ice_rxtx_vec_sse.c')
@@ -37,4 +37,7 @@ if arch_subdir == 'x86' endif endif +sources += files('ice_dcf.c', + 'ice_dcf_ethdev.c') + install_headers('rte_pmd_ice.h')
mk/rte.app.mk +1 -0
@@ -185,6 +185,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e _LDLIBS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) += -lrte_pmd_iavf _LDLIBS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += -lrte_pmd_ice IAVF-y := $(CONFIG_RTE_LIBRTE_IAVF_PMD) +IAVF-y += $(CONFIG_RTE_LIBRTE_ICE_PMD) ifeq ($(findstring y,$(IAVF-y)),y) _LDLIBS-y += -lrte_common_iavf endif
Signature · 1 line
2.26.0
PATCH v5 3/7 net/ice: acquire and disable the DCF capability
In reply to Haiyue WangSince the DCF (Device Config Function) controls the flow setting of other VFs by the mailbox with PF, for security, it needs to acquire the DCF capability from PF when starts, and disable it when exits.
--- drivers/net/ice/ice_dcf.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +26 -1
@@ -227,7 +227,7 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)int err, i; caps =VIRTCHNL_VF_OFFLOAD_WB_ON_ITR |VIRTCHNL_VF_OFFLOAD_RX_POLLING | -VIRTCHNL_VF_CAP_ADV_LINK_SPEED | +VIRTCHNL_VF_CAP_ADV_LINK_SPEED |VIRTCHNL_VF_CAP_DCF |VF_BASE_MODE_OFFLOADS ; err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES,
@@ -264,6 +264,30 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)return 0 ; } +static int +ice_dcf_mode_disable (struct ice_dcf_hw *hw) +{ +int err; + + err =ice_dcf_send_cmd_req_no_irq (hw,VIRTCHNL_OP_DCF_DISABLE , +NULL ,0 ); +if (err) { +PMD_DRV_LOG (ERR ,"Failed to send msg OP_DCF_DISABLE" ); +return err; + } + + err =ice_dcf_recv_cmd_rsp_no_irq (hw,VIRTCHNL_OP_DCF_DISABLE , + hw->arq_buf,ICE_DCF_AQ_BUF_SZ ,NULL ); +if (err) { +PMD_DRV_LOG (ERR , +"Failed to get response of OP_DCF_DISABLE %d" , + err); +return -1 ; + } + +return 0 ; +} +static int ice_dcf_check_reset_done (struct ice_dcf_hw *hw) {
@@ -467,6 +491,7 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)rte_intr_callback_unregister (intr_handle, ice_dcf_dev_interrupt_handler, hw); +ice_dcf_mode_disable (hw);iavf_shutdown_adminq (&hw->avf);rte_free (hw->arq_buf);
Signature · 1 line
2.26.0
PATCH v5 4/7 net/ice: handle the AdminQ command by DCF
In reply to Haiyue WangThe DCF (Device Config Function) splits the AdminQ command into two
parts: one is the descriptor of AdminQ command, the other is the buffer of AdminQ command (the descriptor has BUF flag set). When both of them are received by the PF, the PF will handle them as one command.
And also, the filled descriptor and buffer of the response will be sent back to DCF one by one through the virtchnl from PF.
--- drivers/net/ice/ice_dcf.c | 65 +++++++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_dcf.h | 4 ++- 2 files changed, 68 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +65 -0
@@ -396,6 +396,71 @@ ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,return err; } +int +ice_dcf_send_aq_cmd (void *dcf_hw,struct ice_aq_desc *desc, +void *buf,uint16_t buf_size) +{ +struct dcf_virtchnl_cmd desc_cmd, buff_cmd; +struct ice_dcf_hw *hw = dcf_hw; +int err =0 ; +int i =0 ; + +if ((buf && !buf_size) || (!buf && buf_size) || + buf_size >ICE_DCF_AQ_BUF_SZ ) +return -EINVAL ; + + desc_cmd.v_op =VIRTCHNL_OP_DCF_CMD_DESC ; + desc_cmd.req_msglen =sizeof (*desc); + desc_cmd.req_msg = (uint8_t *)desc; + desc_cmd.rsp_buflen =sizeof (*desc); + desc_cmd.rsp_msgbuf = (uint8_t *)desc; + +if (buf ==NULL ) +return ice_dcf_execute_virtchnl_cmd (hw, &desc_cmd); + + desc->flags |=rte_cpu_to_le_16 (ICE_AQ_FLAG_BUF ); + + buff_cmd.v_op =VIRTCHNL_OP_DCF_CMD_BUFF ; + buff_cmd.req_msglen = buf_size; + buff_cmd.req_msg = buf; + buff_cmd.rsp_buflen = buf_size; + buff_cmd.rsp_msgbuf = buf; + +rte_spinlock_lock (&hw->vc_cmd_send_lock); +ice_dcf_vc_cmd_set (hw, &desc_cmd); +ice_dcf_vc_cmd_set (hw, &buff_cmd); + +if (ice_dcf_vc_cmd_send (hw, &desc_cmd) || +ice_dcf_vc_cmd_send (hw, &buff_cmd)) { + err =-1 ; +PMD_DRV_LOG (ERR ,"fail to send OP_DCF_CMD_DESC/BUFF" ); + goto ret; + } + +do { +if ((!desc_cmd.pending && !buff_cmd.pending) || + (!desc_cmd.pending && desc_cmd.v_ret !=IAVF_SUCCESS ) || + (!buff_cmd.pending && buff_cmd.v_ret !=IAVF_SUCCESS )) +break ; + +rte_delay_ms (ICE_DCF_ARQ_CHECK_TIME ); + }while (i++ <ICE_DCF_ARQ_MAX_RETRIES ); + +if (desc_cmd.v_ret !=IAVF_SUCCESS || buff_cmd.v_ret !=IAVF_SUCCESS ) { + err =-1 ; +PMD_DRV_LOG (ERR , +"No response (%d times) or return failure (desc: %d / buff: %d)" , + i, desc_cmd.v_ret, buff_cmd.v_ret); + } + +ret: +ice_dcf_aq_cmd_clear (hw, &desc_cmd); +ice_dcf_aq_cmd_clear (hw, &buff_cmd); +rte_spinlock_unlock (&hw->vc_cmd_send_lock); + +return err; +} +int ice_dcf_init_hw (struct rte_eth_dev *eth_dev,struct ice_dcf_hw *hw) {
drivers/net/ice/ice_dcf.h +3 -1
@@ -11,6 +11,7 @@#include <iavf_adminq_cmd.h> #include <iavf_type.h> +#include "base/ice_type.h" #include "ice_logs.h" struct dcf_virtchnl_cmd {
@@ -45,7 +46,8 @@ struct ice_dcf_hw {int ice_dcf_execute_virtchnl_cmd (struct ice_dcf_hw *hw,struct dcf_virtchnl_cmd *cmd); - +int ice_dcf_send_aq_cmd (void *dcf_hw,struct ice_aq_desc *desc, +void *buf,uint16_t buf_size);int ice_dcf_init_hw (struct rte_eth_dev *eth_dev,struct ice_dcf_hw *hw);void ice_dcf_uninit_hw (struct rte_eth_dev *eth_dev,struct ice_dcf_hw *hw);
Signature · 1 line
2.26.0
PATCH v5 5/7 net/ice: export the DDP definition symbols
In reply to Haiyue WangA new DCF PMD will be introduced, which runs on Intel VF hardware, and it is a pure software design to control the advance functionality (such as switch, ACL) for rest of the VFs.
The DCF (Device Config Function) feature shares the core functions of the ICE PMD, like it needs to export the DDP definition symbols for the new DCF PMD use.
--- drivers/net/ice/ice_ethdev.c | 9 +-------- drivers/net/ice/ice_ethdev.h | 8 ++++++++ 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/net/ice/ice_ethdev.c +1 -8
@@ -67,15 +67,8 @@ static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = {#define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100 -/* DDP package search path */ -#define ICE_PKG_FILE_DEFAULT "/lib/firmware/intel/ice/ddp/ice.pkg" -#define ICE_PKG_FILE_UPDATES "/lib/firmware/updates/intel/ice/ddp/ice.pkg" -#define ICE_PKG_FILE_SEARCH_PATH_DEFAULT "/lib/firmware/intel/ice/ddp/" -#define ICE_PKG_FILE_SEARCH_PATH_UPDATES "/lib/firmware/updates/intel/ice/ddp/" -#define ICE_OS_DEFAULT_PKG_NAME "ICE OS Default Package"#define ICE_COMMS_PKG_NAME "ICE COMMS Package" -#define ICE_MAX_PKG_FILENAME_SIZE 256#define ICE_MAX_RES_DESC_NUM 1024int ice_logtype_init;
@@ -1833,7 +1826,7 @@ ice_pkg_file_search_path(struct rte_pci_device *pci_dev, char *pkg_file)return 0 ; } -static enum ice_pkg_type +enum ice_pkg_type ice_load_pkg_type (struct ice_hw *hw) {enum ice_pkg_type package_type;
drivers/net/ice/ice_ethdev.h +8 -0
@@ -42,6 +42,13 @@#define ICE_MAX_PKT_TYPE 1024 +/* DDP package search path */ +#define ICE_PKG_FILE_DEFAULT "/lib/firmware/intel/ice/ddp/ice.pkg" +#define ICE_PKG_FILE_UPDATES "/lib/firmware/updates/intel/ice/ddp/ice.pkg" +#define ICE_PKG_FILE_SEARCH_PATH_DEFAULT "/lib/firmware/intel/ice/ddp/" +#define ICE_PKG_FILE_SEARCH_PATH_UPDATES "/lib/firmware/updates/intel/ice/ddp/" +#define ICE_MAX_PKG_FILENAME_SIZE 256 +/** * vlan_id is a 12 bit number. * The VFTA array is actually a 4096 bit array, 128 of 32bit elements.
@@ -457,6 +464,7 @@ struct ice_vsi_vlan_pvid_info {#define ICE_PF_TO_ETH_DEV (pf) \ (((struct ice_pf *)pf)->adapter->eth_dev) +enum ice_pkg_type ice_load_pkg_type (struct ice_hw *hw);struct ice_vsi *ice_setup_vsi (struct ice_pf *pf,enum ice_vsi_type type);int
Signature · 1 line
2.26.0
PATCH v5 6/7 net/ice: handle the PF initialization by DCF
In reply to Haiyue WangThe DCF (Device Config Function) works at the user PF level, it can't access the real PF hardware directly. So it will pass through the PF's AdminQ command by the DCF's mailbox.
And the DCF is mainly used to control the flow setting of other VFs, so it only needs to initialize some core functions related to the flow.
--- drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_dcf.c | 7 +- drivers/net/ice/ice_dcf.h | 3 + drivers/net/ice/ice_dcf_ethdev.c | 10 +- drivers/net/ice/ice_dcf_ethdev.h | 11 +- drivers/net/ice/ice_dcf_parent.c | 263 +++++++++++++++++++++++++++++++ drivers/net/ice/meson.build | 3 +- 7 files changed, 292 insertions(+), 6 deletions(-) create mode 100644 drivers/net/ice/ice_dcf_parent.c
drivers/net/ice/Makefile +1 -0
@@ -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_parent.c # install this header file SYMLINK-$(CONFIG_RTE_LIBRTE_ICE_PMD)-include := rte_pmd_ice.h
drivers/net/ice/ice_dcf.c +6 -1
@@ -124,8 +124,13 @@ ice_dcf_aq_cmd_handle(struct ice_dcf_hw *hw, struct iavf_arq_event_info *info) } v_op =rte_le_to_cpu_32 (info->desc.cookie_high); -if (unlikely (v_op ==VIRTCHNL_OP_EVENT )) +if (v_op ==VIRTCHNL_OP_EVENT ) { +if (hw->vc_event_msg_cb !=NULL ) + hw->vc_event_msg_cb (hw, + info->msg_buf, + info->msg_len);return ; + } v_ret =rte_le_to_cpu_32 (info->desc.cookie_low);
drivers/net/ice/ice_dcf.h +3 -0
@@ -36,6 +36,9 @@ struct ice_dcf_hw {rte_spinlock_t vc_cmd_send_lock;rte_spinlock_t vc_cmd_queue_lock; TAILQ_HEAD(, dcf_virtchnl_cmd) vc_cmd_queue; +void (*vc_event_msg_cb)(struct ice_dcf_hw *dcf_hw, +uint8_t *msg,uint16_t msglen); +uint8_t *arq_buf;struct virtchnl_version_info virtchnl_version;
drivers/net/ice/ice_dcf_ethdev.c +7 -3
@@ -145,8 +145,8 @@ ice_dcf_dev_close(struct rte_eth_dev *dev) dev->dev_ops =NULL ; dev->rx_pkt_burst =NULL ; dev->tx_pkt_burst =NULL ; - dev->data->mac_addrs =NULL ; +ice_dcf_uninit_parent_adapter (dev);ice_dcf_uninit_hw (dev, &adapter->real_hw); }
@@ -225,13 +225,17 @@ ice_dcf_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->dev_flags |=RTE_ETH_DEV_CLOSE_REMOVE ; + adapter->real_hw.vc_event_msg_cb = ice_dcf_handle_pf_event_msg;if (ice_dcf_init_hw (eth_dev, &adapter->real_hw) !=0 ) {PMD_INIT_LOG (ERR ,"Failed to init DCF hardware" );return -1 ; } -rte_eth_random_addr (adapter->mac_addr.addr_bytes); - eth_dev->data->mac_addrs = &adapter->mac_addr; +if (ice_dcf_init_parent_adapter (eth_dev) !=0 ) { +PMD_INIT_LOG (ERR ,"Failed to init DCF parent adapter" ); +ice_dcf_uninit_hw (eth_dev, &adapter->real_hw); +return -1 ; + }return 0 ; }
drivers/net/ice/ice_dcf_ethdev.h +10 -1
@@ -5,6 +5,9 @@#ifndef _ICE_DCF_ETHDEV_H_#define _ICE_DCF_ETHDEV_H_ +#include "base/ice_common.h" +#include "base/ice_adminq_cmd.h" +#include "ice_ethdev.h" #include "ice_dcf.h"
@@ -15,10 +18,16 @@ struct ice_dcf_queue { };struct ice_dcf_adapter { +struct ice_adapter parent;/* Must be first */ +struct ice_dcf_hw real_hw; -struct rte_ether_addr mac_addr;struct ice_dcf_queue rxqs[ICE_DCF_MAX_RINGS ];struct ice_dcf_queue txqs[ICE_DCF_MAX_RINGS ]; }; +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); +#endif /* _ICE_DCF_ETHDEV_H_ */
drivers/net/ice/ice_dcf_parent.c new file +263 -0
263 lines not on this page · raw message
drivers/net/ice/meson.build +2 -1
@@ -38,6 +38,7 @@ if arch_subdir == 'x86' endif sources += files('ice_dcf.c', - 'ice_dcf_ethdev.c') + 'ice_dcf_ethdev.c', + 'ice_dcf_parent.c') install_headers('rte_pmd_ice.h')
Signature · 1 line
2.26.0
PATCH v5 7/7 net/ice: get the VF hardware index in DCF
In reply to Haiyue WangThe DCF (Device Config Function) needs the hardware index of the VFs to control the flow setting. And also if the VF resets, the index may be changed, so it should handle this in VF reset event.
--- drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_dcf.c | 89 +++++++++++++++++++++++++++++++ drivers/net/ice/ice_dcf.h | 6 +++ drivers/net/ice/ice_dcf_parent.c | 90 +++++++++++++++++++++++++++++++- 4 files changed, 185 insertions(+), 1 deletion(-)
drivers/net/ice/Makefile +1 -0
@@ -16,6 +16,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/common/iavf LDLIBS += -lrte_eal -lrte_mbuf -lrte_ethdev -lrte_kvargs LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_hash LDLIBS += -lrte_net -lrte_common_iavf +LDLIBS += -lpthread EXPORT_MAP := rte_pmd_ice_version.map
drivers/net/ice/ice_dcf.c +89 -0
112 lines not on this page · raw message
drivers/net/ice/ice_dcf.h +6 -0
@@ -41,16 +41,22 @@ struct ice_dcf_hw {uint8_t *arq_buf; +uint16_t num_vfs; +uint16_t *vf_vsi_map; +struct virtchnl_version_info virtchnl_version;struct virtchnl_vf_resource *vf_res;/* VF resource */ struct virtchnl_vsi_resource *vsi_res;/* LAN VSI */ uint16_t vsi_id; + +struct rte_eth_dev *eth_dev; };int ice_dcf_execute_virtchnl_cmd (struct ice_dcf_hw *hw,struct dcf_virtchnl_cmd *cmd);int ice_dcf_send_aq_cmd (void *dcf_hw,struct ice_aq_desc *desc,void *buf,uint16_t buf_size); +int ice_dcf_handle_vsi_update_event (struct ice_dcf_hw *hw);int ice_dcf_init_hw (struct rte_eth_dev *eth_dev,struct ice_dcf_hw *hw);void ice_dcf_uninit_hw (struct rte_eth_dev *eth_dev,struct ice_dcf_hw *hw);
drivers/net/ice/ice_dcf_parent.c +89 -1
122 lines not on this page · raw message
Signature · 1 line
2.26.0
v6 cover add Intel DCF PMD support
In reply to Haiyue WangA DCF (Device Config Function) based approach is proposed where a device bound to the device's VF0 can act as a sole controlling entity to exercise advance functionality (such as switch, ACL) for rest of the VFs.
The DCF works as a standalone PMD to support this function, which shares the ice PMD flow control core function and the iavf virtchnl mailbox core module.
v6:
No change, but to resend the same patchset again to trigger ci/Performance-Testing by using the new code base:
https://lab.dpdk.org/results/dashboard/patchsets/10120/
v5:
Fixed the shared module compile errror.
v4:
Change the alarm handler to thread service, since it will need to do more work.
v3:
1. Fixed the error log message format.
2. Fixed some memory allocation check.
3. Fixed some code style issue and commmit message description.
v2:
1. update the iavf patchset link.
2. split more patches for making this work be more understandable
3. fix the log function usage, devargs checking from v1.
Haiyue Wang (7):
net/iavf: stop the PCI probe in DCF mode
net/ice: add the DCF hardware initialization
net/ice: acquire and disable the DCF capability
net/ice: handle the AdminQ command by DCF
net/ice: export the DDP definition symbols
net/ice: handle the PF initialization by DCF
net/ice: get the VF hardware index in DCF
doc/guides/nics/ice.rst | 47 ++ doc/guides/nics/img/ice_dcf.png | Bin 0 -> 39168 bytes doc/guides/rel_notes/release_20_05.rst | 5 + drivers/common/Makefile | 1 + drivers/net/iavf/iavf_ethdev.c | 43 ++ drivers/net/ice/Makefile | 7 + drivers/net/ice/ice_dcf.c | 658 +++++++++++++++++++++++++ drivers/net/ice/ice_dcf.h | 63 +++ drivers/net/ice/ice_dcf_ethdev.c | 321 ++++++++++++ drivers/net/ice/ice_dcf_ethdev.h | 33 ++ drivers/net/ice/ice_dcf_parent.c | 351 +++++++++++++ drivers/net/ice/ice_ethdev.c | 9 +- drivers/net/ice/ice_ethdev.h | 8 + drivers/net/ice/meson.build | 8 +- mk/rte.app.mk | 1 + 15 files changed, 1545 insertions(+), 10 deletions(-) create mode 100644 doc/guides/nics/img/ice_dcf.png create mode 100644 drivers/net/ice/ice_dcf.c create mode 100644 drivers/net/ice/ice_dcf.h create mode 100644 drivers/net/ice/ice_dcf_ethdev.c create mode 100644 drivers/net/ice/ice_dcf_ethdev.h create mode 100644 drivers/net/ice/ice_dcf_parent.c
Signature · 1 line
2.26.0
PATCH v6 1/7 net/iavf: stop the PCI probe in DCF mode
A new DCF PMD will be introduced, which runs on Intel VF hardware, and it is a pure software design to control the advance functionality (such as switch, ACL) for rest of the VFs.
So if the DCF (Device Config Function) mode is specified by the devarg 'cap=dcf', then it will stop the PCI probe in the iavf PMD.
--- drivers/net/iavf/iavf_ethdev.c | 43 ++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+)
drivers/net/iavf/iavf_ethdev.c +43 -0
@@ -1416,9 +1416,51 @@ iavf_dev_uninit(struct rte_eth_dev *dev)return 0 ; } +static int +iavf_dcf_cap_check_handler(__rte_unused const char *key, + const char *value, __rte_unused void *opaque) +{ +if (strcmp (value,"dcf" )) +return -1 ; + +return 0 ; +} + +static int +iavf_dcf_cap_selected (struct rte_devargs *devargs) +{ +struct rte_kvargs *kvlist; +const char *key ="cap" ; +int ret =0 ; + +if (devargs ==NULL ) +return 0 ; + + kvlist =rte_kvargs_parse (devargs->args,NULL ); +if (kvlist ==NULL ) +return 0 ; + +if (!rte_kvargs_count (kvlist, key)) + goto exit; + +/* dcf capability selected when there's a key-value pair: cap=dcf */ +if (rte_kvargs_process (kvlist, key, + iavf_dcf_cap_check_handler,NULL ) <0 ) + goto exit; + + ret =1 ; + +exit: +rte_kvargs_free (kvlist); +return ret; +} + static int eth_iavf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,struct rte_pci_device *pci_dev) { +if (iavf_dcf_cap_selected (pci_dev->device.devargs)) +return 1 ; +return rte_eth_dev_pci_generic_probe (pci_dev,sizeof (struct iavf_adapter ), iavf_dev_init); }
@@ -1439,6 +1481,7 @@ static struct rte_pci_driver rte_iavf_pmd = {RTE_PMD_REGISTER_PCI (net_iavf, rte_iavf_pmd);RTE_PMD_REGISTER_PCI_TABLE (net_iavf, pci_id_iavf_map);RTE_PMD_REGISTER_KMOD_DEP (net_iavf,"* igb_uio | vfio-pci" ); +RTE_PMD_REGISTER_PARAM_STRING (net_iavf,"cap=dcf" );RTE_INIT (iavf_init_log) { iavf_logtype_init =rte_log_register ("pmd.net.iavf.init" );
Signature · 1 line
2.26.0
PATCH v6 2/7 net/ice: add the DCF hardware initialization
In reply to Haiyue WangIntroduce the DCF (Device Config Function) feature in the ice PMD, it works as a standalone PMD which doesn't handle the packet Rx/Tx related things. Its hardware entity is the VF.
Add the basic DCF hardware initialization, this is specified by devarg 'cap=dcf'.
--- doc/guides/nics/ice.rst | 47 +++ doc/guides/nics/img/ice_dcf.png | Bin 0 -> 39168 bytes doc/guides/rel_notes/release_20_05.rst | 5 + drivers/common/Makefile | 1 + drivers/net/ice/Makefile | 5 + drivers/net/ice/ice_dcf.c | 474 +++++++++++++++++++++++++ drivers/net/ice/ice_dcf.h | 52 +++ drivers/net/ice/ice_dcf_ethdev.c | 317 +++++++++++++++++ drivers/net/ice/ice_dcf_ethdev.h | 24 ++ drivers/net/ice/meson.build | 7 +- mk/rte.app.mk | 1 + 11 files changed, 931 insertions(+), 2 deletions(-) create mode 100644 doc/guides/nics/img/ice_dcf.png create mode 100644 drivers/net/ice/ice_dcf.c create mode 100644 drivers/net/ice/ice_dcf.h create mode 100644 drivers/net/ice/ice_dcf_ethdev.c create mode 100644 drivers/net/ice/ice_dcf_ethdev.h
doc/guides/nics/ice.rst +47 -0
@@ -240,6 +240,53 @@ report a MDD event and drop the packets. The APPs based on DPDK should avoid providing such packets. +Device Config Function (DCF) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +This section demonstrates ICE DCF PMD, which shares the core module with ICE +PMD and iAVF PMD. + +A DCF (Device Config Function) PMD bounds to the device's trusted VF with ID 0, +it can act as a sole controlling entity to exercise advance functionality (such +as switch, ACL) for the rest VFs. + +The DCF PMD needs to advertise and acquire DCF capability which allows DCF to +send AdminQ commands that it would like to execute over to the PF and receive +responses for the same from PF. + +.. _figure_ice_dcf: + +.. figure:: img/ice_dcf.* + + DCF Communication flow. + +#. Create the VFs:: + + echo 4 > /sys/bus/pci/devices/0000\:18\:00.0/sriov_numvfs + +#. Enable the VF0 trust on:: + + ip link set dev enp24s0f0 vf 0 trust on + +#. Bind the VF0, and run testpmd with 'cap=dcf' devarg:: + + testpmd -l 22-25 -n 4 -w 18:01.0,cap=dcf -- -i + +#. Monitor the VF2 interface network traffic:: + + tcpdump -e -nn -i enp24s1f2 + +#. Create one flow to redirect the traffic to VF2 by DCF:: + + flow create 0 priority 0 ingress pattern eth / ipv4 src is 192.168.0.2 \ + dst is 192.168.0.3 / end actions vf id 2 / end + +#. Send the packet, and it should be displayed on tcpdump:: + + sendp(Ether(src='3c:fd:fe:aa:bb:78', dst='00:00:00:01:02:03')/IP(src=' \ + 192.168.0.2', dst="192.168.0.3")/TCP(flags='S')/Raw(load='XXXXXXXXXX'), \ + iface="enp24s0f0", count=10) + Sample Application Notes ------------------------
doc/guides/nics/img/ice_dcf.png new file binary +0 -0
doc/guides/rel_notes/release_20_05.rst +5 -0
@@ -62,6 +62,11 @@ New Features * Added support for matching on IPv4 Time To Live and IPv6 Hop Limit. +* **Updated the Intel ice driver.** + + Updated the Intel ice driver with new features and improvements, including: + + * Added support for DCF (Device Config Function) feature. Removed Items -------------
drivers/common/Makefile +1 -0
@@ -31,6 +31,7 @@ DIRS-y += dpaax endif IAVF-y := $(CONFIG_RTE_LIBRTE_IAVF_PMD) +IAVF-y += $(CONFIG_RTE_LIBRTE_ICE_PMD) ifneq (,$(findstring y,$(IAVF-y))) DIRS-y += iavf endif
drivers/net/ice/Makefile +5 -0
@@ -11,9 +11,11 @@ LIB = librte_pmd_ice.a CFLAGS += -O3 CFLAGS += $(WERROR_FLAGS) CFLAGS += -DALLOW_EXPERIMENTAL_API +CFLAGS += -I$(RTE_SDK)/drivers/common/iavf LDLIBS += -lrte_eal -lrte_mbuf -lrte_ethdev -lrte_kvargs LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_hash +LDLIBS += -lrte_net -lrte_common_iavf EXPORT_MAP := rte_pmd_ice_version.map
@@ -84,6 +86,9 @@ ifeq ($(CC_AVX2_SUPPORT), 1) endif 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 + # install this header file SYMLINK-$(CONFIG_RTE_LIBRTE_ICE_PMD)-include := rte_pmd_ice.h
drivers/net/ice/ice_dcf.c new file +474 -0
474 lines not on this page · raw message
drivers/net/ice/ice_dcf.h new file +52 -0
52 lines not on this page · raw message
drivers/net/ice/ice_dcf_ethdev.c new file +317 -0
317 lines not on this page · raw message
drivers/net/ice/ice_dcf_ethdev.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2020 Intel Corporation +*/ + +#ifndef _ICE_DCF_ETHDEV_H_ +#define _ICE_DCF_ETHDEV_H_ + +#include "ice_ethdev.h" +#include "ice_dcf.h" + +#define ICE_DCF_MAX_RINGS 1 + +struct ice_dcf_queue { +uint64_t dummy; +}; + +struct ice_dcf_adapter { +struct ice_dcf_hw real_hw; +struct rte_ether_addr mac_addr; +struct ice_dcf_queue rxqs[ICE_DCF_MAX_RINGS ]; +struct ice_dcf_queue txqs[ICE_DCF_MAX_RINGS ]; +}; + +#endif /* _ICE_DCF_ETHDEV_H_ */
drivers/net/ice/meson.build +5 -2
@@ -15,8 +15,8 @@ sources = files( 'ice_hash.c' ) -deps += ['hash'] -includes += include_directories('base') +deps += ['hash', 'net', 'common_iavf'] +includes += include_directories('base', '../../common/iavf') if arch_subdir == 'x86' sources += files('ice_rxtx_vec_sse.c')
@@ -37,4 +37,7 @@ if arch_subdir == 'x86' endif endif +sources += files('ice_dcf.c', + 'ice_dcf_ethdev.c') + install_headers('rte_pmd_ice.h')
mk/rte.app.mk +1 -0
@@ -185,6 +185,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += -lrte_pmd_i40e _LDLIBS-$(CONFIG_RTE_LIBRTE_IAVF_PMD) += -lrte_pmd_iavf _LDLIBS-$(CONFIG_RTE_LIBRTE_ICE_PMD) += -lrte_pmd_ice IAVF-y := $(CONFIG_RTE_LIBRTE_IAVF_PMD) +IAVF-y += $(CONFIG_RTE_LIBRTE_ICE_PMD) ifeq ($(findstring y,$(IAVF-y)),y) _LDLIBS-y += -lrte_common_iavf endif
Signature · 1 line
2.26.0
Re: [dpdk-dev] [PATCH v6 2/7] net/ice: add the DCF hardware initialization
Quoted 4 lines · Haiyue Wang
Introduce the DCF (Device Config Function) feature in the ice PMD, it works as a standalone PMD which doesn't handle the packet Rx/Tx related things. Its hardware entity is the VF.
Quoted 8 lines
Add the basic DCF hardware initialization, this is specified by devarg 'cap=dcf'.
Signed-off-by Haiyue Wang <[email protected]>Acked-by Qi Zhang <[email protected]>--- doc/guides/nics/ice.rst | 47 +++ doc/guides/nics/img/ice_dcf.png | Bin 0 -> 39168 bytes
Hi Haiyue,
We prefer .svg files as image instead of binary formats (like .png), can you please make a patch to replace .png with .svg, I will update it in next-net before it merged in to the master?
Thanks,
ferruh
Re: [dpdk-dev] [PATCH v6 2/7] net/ice: add the DCF hardware initialization
Hi Ferruh,
Quoted 23 lines
-----Original Message-----
From: Yigit, Ferruh <[email protected]>
Sent: Tuesday, March 31, 2020 16:50
To: Wang, Haiyue <[email protected]>; [email protected]; Ye, Xiaolong <[email protected]>; Zhang, Qi Z <[email protected]>; Wu, Jingjing <[email protected]>; Yang, Qiming <[email protected]>; Xing, Beilei <[email protected]>
Cc: Zhao1, Wei <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v6 2/7] net/ice: add the DCF hardware initializationQuoted 4 lines · Haiyue Wang
Introduce the DCF (Device Config Function) feature in the ice PMD, it works as a standalone PMD which doesn't handle the packet Rx/Tx related things. Its hardware entity is the VF.
Quoted 8 lines
Add the basic DCF hardware initialization, this is specified by devarg 'cap=dcf'.
Signed-off-by Haiyue Wang <[email protected]>Acked-by Qi Zhang <[email protected]>--- doc/guides/nics/ice.rst | 47 +++ doc/guides/nics/img/ice_dcf.png | Bin 0 -> 39168 bytes
Quoted 5 lines
Hi Haiyue,
We prefer .svg files as image instead of binary formats (like .png), can you please make a patch to replace .png with .svg, I will update it in next-net before it merged in to the master?
Done. https://patchwork.dpdk.org/patch/67477/
And I think checkpatch should ignore to check *svg file. ;-)
WARNING:TYPO_SPELLING: 'whe' may be misspelled - perhaps 'when'? #1075: FILE: doc/guides/nics/img/ice_dcf.svg:255:
+imrp6JqROV/TKVAhhEZTPTIajV/4whe2bdv23HPPrVu3btasWcPWgTiOq6+vf+211xoaGlJTUymK
total: 0 errors, 1 warnings, 727 lines checked
Quoted 3 lines
Thanks,
ferruh
PATCH v6 3/7 net/ice: acquire and disable the DCF capability
In reply to Haiyue WangSince the DCF (Device Config Function) controls the flow setting of other VFs by the mailbox with PF, for security, it needs to acquire the DCF capability from PF when starts, and disable it when exits.
--- drivers/net/ice/ice_dcf.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +26 -1
@@ -227,7 +227,7 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)int err, i; caps =VIRTCHNL_VF_OFFLOAD_WB_ON_ITR |VIRTCHNL_VF_OFFLOAD_RX_POLLING | -VIRTCHNL_VF_CAP_ADV_LINK_SPEED | +VIRTCHNL_VF_CAP_ADV_LINK_SPEED |VIRTCHNL_VF_CAP_DCF |VF_BASE_MODE_OFFLOADS ; err = ice_dcf_send_cmd_req_no_irq(hw, VIRTCHNL_OP_GET_VF_RESOURCES,
@@ -264,6 +264,30 @@ ice_dcf_get_vf_resource(struct ice_dcf_hw *hw)return 0 ; } +static int +ice_dcf_mode_disable (struct ice_dcf_hw *hw) +{ +int err; + + err =ice_dcf_send_cmd_req_no_irq (hw,VIRTCHNL_OP_DCF_DISABLE , +NULL ,0 ); +if (err) { +PMD_DRV_LOG (ERR ,"Failed to send msg OP_DCF_DISABLE" ); +return err; + } + + err =ice_dcf_recv_cmd_rsp_no_irq (hw,VIRTCHNL_OP_DCF_DISABLE , + hw->arq_buf,ICE_DCF_AQ_BUF_SZ ,NULL ); +if (err) { +PMD_DRV_LOG (ERR , +"Failed to get response of OP_DCF_DISABLE %d" , + err); +return -1 ; + } + +return 0 ; +} +static int ice_dcf_check_reset_done (struct ice_dcf_hw *hw) {
@@ -467,6 +491,7 @@ ice_dcf_uninit_hw(struct rte_eth_dev *eth_dev, struct ice_dcf_hw *hw)rte_intr_callback_unregister (intr_handle, ice_dcf_dev_interrupt_handler, hw); +ice_dcf_mode_disable (hw);iavf_shutdown_adminq (&hw->avf);rte_free (hw->arq_buf);
Signature · 1 line
2.26.0
PATCH v6 4/7 net/ice: handle the AdminQ command by DCF
In reply to Haiyue WangThe DCF (Device Config Function) splits the AdminQ command into two
parts: one is the descriptor of AdminQ command, the other is the buffer of AdminQ command (the descriptor has BUF flag set). When both of them are received by the PF, the PF will handle them as one command.
And also, the filled descriptor and buffer of the response will be sent back to DCF one by one through the virtchnl from PF.
--- drivers/net/ice/ice_dcf.c | 65 +++++++++++++++++++++++++++++++++++++++ drivers/net/ice/ice_dcf.h | 4 ++- 2 files changed, 68 insertions(+), 1 deletion(-)
drivers/net/ice/ice_dcf.c +65 -0
@@ -396,6 +396,71 @@ ice_dcf_execute_virtchnl_cmd(struct ice_dcf_hw *hw,return err; } +int +ice_dcf_send_aq_cmd (void *dcf_hw,struct ice_aq_desc *desc, +void *buf,uint16_t buf_size) +{ +struct dcf_virtchnl_cmd desc_cmd, buff_cmd; +struct ice_dcf_hw *hw = dcf_hw; +int err =0 ; +int i =0 ; + +if ((buf && !buf_size) || (!buf && buf_size) || + buf_size >ICE_DCF_AQ_BUF_SZ ) +return -EINVAL ; + + desc_cmd.v_op =VIRTCHNL_OP_DCF_CMD_DESC ; + desc_cmd.req_msglen =sizeof (*desc); + desc_cmd.req_msg = (uint8_t *)desc; + desc_cmd.rsp_buflen =sizeof (*desc); + desc_cmd.rsp_msgbuf = (uint8_t *)desc; + +if (buf ==NULL ) +return ice_dcf_execute_virtchnl_cmd (hw, &desc_cmd); + + desc->flags |=rte_cpu_to_le_16 (ICE_AQ_FLAG_BUF ); + + buff_cmd.v_op =VIRTCHNL_OP_DCF_CMD_BUFF ; + buff_cmd.req_msglen = buf_size; + buff_cmd.req_msg = buf; + buff_cmd.rsp_buflen = buf_size; + buff_cmd.rsp_msgbuf = buf; + +rte_spinlock_lock (&hw->vc_cmd_send_lock); +ice_dcf_vc_cmd_set (hw, &desc_cmd); +ice_dcf_vc_cmd_set (hw, &buff_cmd); + +if (ice_dcf_vc_cmd_send (hw, &desc_cmd) || +ice_dcf_vc_cmd_send (hw, &buff_cmd)) { + err =-1 ; +PMD_DRV_LOG (ERR ,"fail to send OP_DCF_CMD_DESC/BUFF" ); + goto ret; + } + +do { +if ((!desc_cmd.pending && !buff_cmd.pending) || + (!desc_cmd.pending && desc_cmd.v_ret !=IAVF_SUCCESS ) || + (!buff_cmd.pending && buff_cmd.v_ret !=IAVF_SUCCESS )) +break ; + +rte_delay_ms (ICE_DCF_ARQ_CHECK_TIME ); + }while (i++ <ICE_DCF_ARQ_MAX_RETRIES ); + +if (desc_cmd.v_ret !=IAVF_SUCCESS || buff_cmd.v_ret !=IAVF_SUCCESS ) { + err =-1 ; +PMD_DRV_LOG (ERR , +"No response (%d times) or return failure (desc: %d / buff: %d)" , + i, desc_cmd.v_ret, buff_cmd.v_ret); + } + +ret: +ice_dcf_aq_cmd_clear (hw, &desc_cmd); +ice_dcf_aq_cmd_clear (hw, &buff_cmd); +rte_spinlock_unlock (&hw->vc_cmd_send_lock); + +return err; +} +int ice_dcf_init_hw (struct rte_eth_dev *eth_dev,struct ice_dcf_hw *hw) {
drivers/net/ice/ice_dcf.h +3 -1
@@ -11,6 +11,7 @@#include <iavf_adminq_cmd.h> #include <iavf_type.h> +#include "base/ice_type.h" #include "ice_logs.h" struct dcf_virtchnl_cmd {
@@ -45,7 +46,8 @@ struct ice_dcf_hw {int ice_dcf_execute_virtchnl_cmd (struct ice_dcf_hw *hw,struct dcf_virtchnl_cmd *cmd); - +int ice_dcf_send_aq_cmd (void *dcf_hw,struct ice_aq_desc *desc, +void *buf,uint16_t buf_size);int ice_dcf_init_hw (struct rte_eth_dev *eth_dev,struct ice_dcf_hw *hw);void ice_dcf_uninit_hw (struct rte_eth_dev *eth_dev,struct ice_dcf_hw *hw);
Signature · 1 line
2.26.0
PATCH v6 5/7 net/ice: export the DDP definition symbols
In reply to Haiyue WangA new DCF PMD will be introduced, which runs on Intel VF hardware, and it is a pure software design to control the advance functionality (such as switch, ACL) for rest of the VFs.
The DCF (Device Config Function) feature shares the core functions of the ICE PMD, like it needs to export the DDP definition symbols for the new DCF PMD use.
--- drivers/net/ice/ice_ethdev.c | 9 +-------- drivers/net/ice/ice_ethdev.h | 8 ++++++++ 2 files changed, 9 insertions(+), 8 deletions(-)
drivers/net/ice/ice_ethdev.c +1 -8
@@ -67,15 +67,8 @@ static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = {#define ICE_DFLT_OUTER_TAG_TYPE ICE_AQ_VSI_OUTER_TAG_VLAN_9100 -/* DDP package search path */ -#define ICE_PKG_FILE_DEFAULT "/lib/firmware/intel/ice/ddp/ice.pkg" -#define ICE_PKG_FILE_UPDATES "/lib/firmware/updates/intel/ice/ddp/ice.pkg" -#define ICE_PKG_FILE_SEARCH_PATH_DEFAULT "/lib/firmware/intel/ice/ddp/" -#define ICE_PKG_FILE_SEARCH_PATH_UPDATES "/lib/firmware/updates/intel/ice/ddp/" -#define ICE_OS_DEFAULT_PKG_NAME "ICE OS Default Package"#define ICE_COMMS_PKG_NAME "ICE COMMS Package" -#define ICE_MAX_PKG_FILENAME_SIZE 256#define ICE_MAX_RES_DESC_NUM 1024int ice_logtype_init;
@@ -1833,7 +1826,7 @@ ice_pkg_file_search_path(struct rte_pci_device *pci_dev, char *pkg_file)return 0 ; } -static enum ice_pkg_type +enum ice_pkg_type ice_load_pkg_type (struct ice_hw *hw) {enum ice_pkg_type package_type;
drivers/net/ice/ice_ethdev.h +8 -0
@@ -42,6 +42,13 @@#define ICE_MAX_PKT_TYPE 1024 +/* DDP package search path */ +#define ICE_PKG_FILE_DEFAULT "/lib/firmware/intel/ice/ddp/ice.pkg" +#define ICE_PKG_FILE_UPDATES "/lib/firmware/updates/intel/ice/ddp/ice.pkg" +#define ICE_PKG_FILE_SEARCH_PATH_DEFAULT "/lib/firmware/intel/ice/ddp/" +#define ICE_PKG_FILE_SEARCH_PATH_UPDATES "/lib/firmware/updates/intel/ice/ddp/" +#define ICE_MAX_PKG_FILENAME_SIZE 256 +/** * vlan_id is a 12 bit number. * The VFTA array is actually a 4096 bit array, 128 of 32bit elements.
@@ -457,6 +464,7 @@ struct ice_vsi_vlan_pvid_info {#define ICE_PF_TO_ETH_DEV (pf) \ (((struct ice_pf *)pf)->adapter->eth_dev) +enum ice_pkg_type ice_load_pkg_type (struct ice_hw *hw);struct ice_vsi *ice_setup_vsi (struct ice_pf *pf,enum ice_vsi_type type);int
Signature · 1 line
2.26.0
PATCH v6 6/7 net/ice: handle the PF initialization by DCF
In reply to Haiyue WangThe DCF (Device Config Function) works at the user PF level, it can't access the real PF hardware directly. So it will pass through the PF's AdminQ command by the DCF's mailbox.
And the DCF is mainly used to control the flow setting of other VFs, so it only needs to initialize some core functions related to the flow.
--- drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_dcf.c | 7 +- drivers/net/ice/ice_dcf.h | 3 + drivers/net/ice/ice_dcf_ethdev.c | 10 +- drivers/net/ice/ice_dcf_ethdev.h | 11 +- drivers/net/ice/ice_dcf_parent.c | 263 +++++++++++++++++++++++++++++++ drivers/net/ice/meson.build | 3 +- 7 files changed, 292 insertions(+), 6 deletions(-) create mode 100644 drivers/net/ice/ice_dcf_parent.c
drivers/net/ice/Makefile +1 -0
@@ -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_parent.c # install this header file SYMLINK-$(CONFIG_RTE_LIBRTE_ICE_PMD)-include := rte_pmd_ice.h
drivers/net/ice/ice_dcf.c +6 -1
@@ -124,8 +124,13 @@ ice_dcf_aq_cmd_handle(struct ice_dcf_hw *hw, struct iavf_arq_event_info *info) } v_op =rte_le_to_cpu_32 (info->desc.cookie_high); -if (unlikely (v_op ==VIRTCHNL_OP_EVENT )) +if (v_op ==VIRTCHNL_OP_EVENT ) { +if (hw->vc_event_msg_cb !=NULL ) + hw->vc_event_msg_cb (hw, + info->msg_buf, + info->msg_len);return ; + } v_ret =rte_le_to_cpu_32 (info->desc.cookie_low);
drivers/net/ice/ice_dcf.h +3 -0
@@ -36,6 +36,9 @@ struct ice_dcf_hw {rte_spinlock_t vc_cmd_send_lock;rte_spinlock_t vc_cmd_queue_lock; TAILQ_HEAD(, dcf_virtchnl_cmd) vc_cmd_queue; +void (*vc_event_msg_cb)(struct ice_dcf_hw *dcf_hw, +uint8_t *msg,uint16_t msglen); +uint8_t *arq_buf;struct virtchnl_version_info virtchnl_version;
drivers/net/ice/ice_dcf_ethdev.c +7 -3
@@ -145,8 +145,8 @@ ice_dcf_dev_close(struct rte_eth_dev *dev) dev->dev_ops =NULL ; dev->rx_pkt_burst =NULL ; dev->tx_pkt_burst =NULL ; - dev->data->mac_addrs =NULL ; +ice_dcf_uninit_parent_adapter (dev);ice_dcf_uninit_hw (dev, &adapter->real_hw); }
@@ -225,13 +225,17 @@ ice_dcf_dev_init(struct rte_eth_dev *eth_dev) eth_dev->data->dev_flags |=RTE_ETH_DEV_CLOSE_REMOVE ; + adapter->real_hw.vc_event_msg_cb = ice_dcf_handle_pf_event_msg;if (ice_dcf_init_hw (eth_dev, &adapter->real_hw) !=0 ) {PMD_INIT_LOG (ERR ,"Failed to init DCF hardware" );return -1 ; } -rte_eth_random_addr (adapter->mac_addr.addr_bytes); - eth_dev->data->mac_addrs = &adapter->mac_addr; +if (ice_dcf_init_parent_adapter (eth_dev) !=0 ) { +PMD_INIT_LOG (ERR ,"Failed to init DCF parent adapter" ); +ice_dcf_uninit_hw (eth_dev, &adapter->real_hw); +return -1 ; + }return 0 ; }
drivers/net/ice/ice_dcf_ethdev.h +10 -1
@@ -5,6 +5,9 @@#ifndef _ICE_DCF_ETHDEV_H_#define _ICE_DCF_ETHDEV_H_ +#include "base/ice_common.h" +#include "base/ice_adminq_cmd.h" +#include "ice_ethdev.h" #include "ice_dcf.h"
@@ -15,10 +18,16 @@ struct ice_dcf_queue { };struct ice_dcf_adapter { +struct ice_adapter parent;/* Must be first */ +struct ice_dcf_hw real_hw; -struct rte_ether_addr mac_addr;struct ice_dcf_queue rxqs[ICE_DCF_MAX_RINGS ];struct ice_dcf_queue txqs[ICE_DCF_MAX_RINGS ]; }; +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); +#endif /* _ICE_DCF_ETHDEV_H_ */
drivers/net/ice/ice_dcf_parent.c new file +263 -0
263 lines not on this page · raw message
drivers/net/ice/meson.build +2 -1
@@ -38,6 +38,7 @@ if arch_subdir == 'x86' endif sources += files('ice_dcf.c', - 'ice_dcf_ethdev.c') + 'ice_dcf_ethdev.c', + 'ice_dcf_parent.c') install_headers('rte_pmd_ice.h')
Signature · 1 line
2.26.0
PATCH v6 7/7 net/ice: get the VF hardware index in DCF
In reply to Haiyue WangThe DCF (Device Config Function) needs the hardware index of the VFs to control the flow setting. And also if the VF resets, the index may be changed, so it should handle this in VF reset event.
--- drivers/net/ice/Makefile | 1 + drivers/net/ice/ice_dcf.c | 89 +++++++++++++++++++++++++++++++ drivers/net/ice/ice_dcf.h | 6 +++ drivers/net/ice/ice_dcf_parent.c | 90 +++++++++++++++++++++++++++++++- 4 files changed, 185 insertions(+), 1 deletion(-)
drivers/net/ice/Makefile +1 -0
@@ -16,6 +16,7 @@ CFLAGS += -I$(RTE_SDK)/drivers/common/iavf LDLIBS += -lrte_eal -lrte_mbuf -lrte_ethdev -lrte_kvargs LDLIBS += -lrte_bus_pci -lrte_mempool -lrte_hash LDLIBS += -lrte_net -lrte_common_iavf +LDLIBS += -lpthread EXPORT_MAP := rte_pmd_ice_version.map
drivers/net/ice/ice_dcf.c +89 -0
112 lines not on this page · raw message
drivers/net/ice/ice_dcf.h +6 -0
@@ -41,16 +41,22 @@ struct ice_dcf_hw {uint8_t *arq_buf; +uint16_t num_vfs; +uint16_t *vf_vsi_map; +struct virtchnl_version_info virtchnl_version;struct virtchnl_vf_resource *vf_res;/* VF resource */ struct virtchnl_vsi_resource *vsi_res;/* LAN VSI */ uint16_t vsi_id; + +struct rte_eth_dev *eth_dev; };int ice_dcf_execute_virtchnl_cmd (struct ice_dcf_hw *hw,struct dcf_virtchnl_cmd *cmd);int ice_dcf_send_aq_cmd (void *dcf_hw,struct ice_aq_desc *desc,void *buf,uint16_t buf_size); +int ice_dcf_handle_vsi_update_event (struct ice_dcf_hw *hw);int ice_dcf_init_hw (struct rte_eth_dev *eth_dev,struct ice_dcf_hw *hw);void ice_dcf_uninit_hw (struct rte_eth_dev *eth_dev,struct ice_dcf_hw *hw);
drivers/net/ice/ice_dcf_parent.c +89 -1
122 lines not on this page · raw message
Signature · 1 line
2.26.0
Ye Xiaolong
AppliedQuoted 54 lines · Haiyue Wang
A DCF (Device Config Function) based approach is proposed where a device bound to the device's VF0 can act as a sole controlling entity to exercise advance functionality (such as switch, ACL) for rest of the VFs.
The DCF works as a standalone PMD to support this function, which shares the ice PMD flow control core function and the iavf virtchnl mailbox core module.
v6:
No change, but to resend the same patchset again to trigger ci/Performance-Testing by using the new code base:https://lab.dpdk.org/results/dashboard/patchsets/10120/v5:
Fixed the shared module compile errror.v4:
Change the alarm handler to thread service, since it will need to do more work.v3:
1. Fixed the error log message format.
2. Fixed some memory allocation check.
3. Fixed some code style issue and commmit message description.v2:
1. update the iavf patchset link.
2. split more patches for making this work be more understandable
3. fix the log function usage, devargs checking from v1.Haiyue Wang (7):
net/iavf: stop the PCI probe in DCF mode
net/ice: add the DCF hardware initialization
net/ice: acquire and disable the DCF capability
net/ice: handle the AdminQ command by DCF
net/ice: export the DDP definition symbols
net/ice: handle the PF initialization by DCF
net/ice: get the VF hardware index in DCFdoc/guides/nics/ice.rst | 47 ++ doc/guides/nics/img/ice_dcf.png | Bin 0 -> 39168 bytes doc/guides/rel_notes/release_20_05.rst | 5 + drivers/common/Makefile | 1 + drivers/net/iavf/iavf_ethdev.c | 43 ++ drivers/net/ice/Makefile | 7 + drivers/net/ice/ice_dcf.c | 658 +++++++++++++++++++++++++ drivers/net/ice/ice_dcf.h | 63 +++ drivers/net/ice/ice_dcf_ethdev.c | 321 ++++++++++++ drivers/net/ice/ice_dcf_ethdev.h | 33 ++ drivers/net/ice/ice_dcf_parent.c | 351 +++++++++++++ drivers/net/ice/ice_ethdev.c | 9 +- drivers/net/ice/ice_ethdev.h | 8 + drivers/net/ice/meson.build | 8 +- mk/rte.app.mk | 1 + 15 files changed, 1545 insertions(+), 10 deletions(-)
Quoted 10 lines
create mode 100644 doc/guides/nics/img/ice_dcf.png create mode 100644
drivers/net/ice/ice_dcf.ccreate mode 100644drivers/net/ice/ice_dcf.hcreate mode 100644drivers/net/ice/ice_dcf_ethdev.ccreate mode 100644drivers/net/ice/ice_dcf_ethdev.hcreate mode 100644drivers/net/ice/ice_dcf_parent.cSignature · 1 line
2.26.0
Applied to dpdk-next-net-intel, Thanks.