From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 2B35BA3201 for ; Mon, 21 Oct 2019 07:04:00 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id C1DAB2A6C; Mon, 21 Oct 2019 07:03:59 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 872D929D2 for ; Mon, 21 Oct 2019 07:03:58 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Oct 2019 22:03:57 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,322,1566889200"; d="scan'208";a="196007275" Received: from fmsmsx108.amr.corp.intel.com ([10.18.124.206]) by fmsmga008.fm.intel.com with ESMTP; 20 Oct 2019 22:03:57 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by FMSMSX108.amr.corp.intel.com (10.18.124.206) with Microsoft SMTP Server (TLS) id 14.3.439.0; Sun, 20 Oct 2019 22:03:57 -0700 Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1713.5; Sun, 20 Oct 2019 22:03:56 -0700 Received: from shsmsx153.ccr.corp.intel.com (10.239.6.53) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.1713.5 via Frontend Transport; Sun, 20 Oct 2019 22:03:56 -0700 Received: from shsmsx105.ccr.corp.intel.com ([169.254.11.96]) by SHSMSX153.ccr.corp.intel.com ([10.239.6.53]) with mapi id 14.03.0439.000; Mon, 21 Oct 2019 13:03:55 +0800 From: "Pei, Andy" To: Aaron Conole CC: "dev@dpdk.org" , "Xu, Rosen" , "Zhang, Tianfei" , "Ye, Xiaolong" , "Zhang, Qi Z" Thread-Topic: [dpdk-dev] [PATCH v9 12/18] net/ipn3ke: remove configuration for i40e port bonding Thread-Index: AQHVgp1aMT0qEGxG3EuX5CMEXLfAVadklFAw Date: Mon, 21 Oct 2019 05:03:54 +0000 Message-ID: <5941F446C088714A85408FA3132CFCBB0108BB48@SHSMSX105.ccr.corp.intel.com> References: <1570782089-182978-2-git-send-email-andy.pei@intel.com> <1571037064-382519-1-git-send-email-andy.pei@intel.com> <1571037064-382519-13-git-send-email-andy.pei@intel.com> In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH v9 12/18] net/ipn3ke: remove configuration for i40e port bonding X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Hi Conole, Thanks. It will be included in next version. -----Original Message----- From: Aaron Conole [mailto:aconole@redhat.com]=20 Sent: Monday, October 14, 2019 10:40 PM To: Pei, Andy Cc: dev@dpdk.org; Xu, Rosen ; Zhang, Tianfei ; Ye, Xiaolong ; Zhang, Qi Z Subject: Re: [dpdk-dev] [PATCH v9 12/18] net/ipn3ke: remove configuration f= or i40e port bonding Andy Pei writes: > From: Rosen Xu > > The ipn3ke board FPGA and i40e BDF scan has added in ifpga_rawdev, so=20 > it doesn't need to provide configuration for i40e port bonding. > > Signed-off-by: Rosen Xu > Signed-off-by: Andy Pei > --- > drivers/net/ipn3ke/Makefile | 2 + You'll also need to include a change to the meson file to ensure the includ= e path will work for meson based builds. > drivers/net/ipn3ke/ipn3ke_ethdev.c | 289 ++++----------------------= ------ > drivers/net/ipn3ke/ipn3ke_representor.c | 8 +- > 3 files changed, 44 insertions(+), 255 deletions(-) > > diff --git a/drivers/net/ipn3ke/Makefile b/drivers/net/ipn3ke/Makefile=20 > index 8c3ae37..2c65e49 100644 > --- a/drivers/net/ipn3ke/Makefile > +++ b/drivers/net/ipn3ke/Makefile > @@ -19,6 +19,8 @@ CFLAGS +=3D -DALLOW_EXPERIMENTAL_API CFLAGS +=3D -O3 = =20 > CFLAGS +=3D $(WERROR_FLAGS) CFLAGS +=3D -I$(RTE_SDK)/drivers/bus/ifpga > +CFLAGS +=3D -I$(RTE_SDK)/drivers/raw/ifpga CFLAGS +=3D=20 > +-I$(RTE_SDK)/drivers/net/i40e > LDLIBS +=3D -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring LDLIBS +=3D=20 > -lrte_ethdev -lrte_net -lrte_kvargs LDLIBS +=3D -lrte_bus_ifpga diff=20 > --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c=20 > b/drivers/net/ipn3ke/ipn3ke_ethdev.c > index 28d8aaf..3051cdf 100644 > --- a/drivers/net/ipn3ke/ipn3ke_ethdev.c > +++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > =20 > #include "ipn3ke_rawdev_api.h" > #include "ipn3ke_flow.h" > @@ -324,7 +325,8 @@ > "LineSideMACType", &mac_type); > hw->retimer.mac_type =3D (int)mac_type; > =20 > - IPN3KE_AFU_PMD_DEBUG("UPL_version is 0x%x\n", IPN3KE_READ_REG(hw, 0)); > + hw->acc_tm =3D 0; > + hw->acc_flow =3D 0; > =20 > if (afu_dev->id.uuid.uuid_low =3D=3D IPN3KE_UUID_VBNG_LOW && > afu_dev->id.uuid.uuid_high =3D=3D IPN3KE_UUID_VBNG_HIGH) { @@ -342,6=20 > +344,12 @@ > /* After reset, wait until init done */ > if (ipn3ke_vbng_init_done(hw)) > return -1; > + > + hw->acc_tm =3D 1; > + hw->acc_flow =3D 1; > + > + IPN3KE_AFU_PMD_DEBUG("UPL_version is 0x%x\n", > + IPN3KE_READ_REG(hw, 0)); > } > =20 > if (hw->retimer.mac_type =3D=3D IFPGA_RAWDEV_RETIMER_MAC_TYPE_10GE_XFI)= =20 > { @@ -409,9 +417,6 @@ > hw->flow_hw_enable =3D 1; > } > =20 > - hw->acc_tm =3D 0; > - hw->acc_flow =3D 0; > - > return 0; > } > =20 > @@ -462,7 +467,11 @@ static int ipn3ke_vswitch_probe(struct=20 > rte_afu_device *afu_dev) { > char name[RTE_ETH_NAME_MAX_LEN]; > struct ipn3ke_hw *hw; > - int i, retval; > + struct rte_eth_dev *i40e_eth; > + struct ifpga_rawdev *ifpga_dev; > + uint16_t port_id; > + int i, j, retval; > + char *fvl_bdf; > =20 > /* check if the AFU device has been probed already */ > /* allocate shared mcp_vswitch structure */ @@ -489,7 +498,12 @@=20 > static int ipn3ke_vswitch_probe(struct rte_afu_device *afu_dev) > if (retval) > return retval; > =20 > + ifpga_dev =3D ifpga_rawdev_get(hw->rawdev); > + if (!ifpga_dev) > + IPN3KE_AFU_PMD_ERR("failed to find ifpga_device."); > + > /* probe representor ports */ > + j =3D 0; > for (i =3D 0; i < hw->port_num; i++) { > struct ipn3ke_rpst rpst =3D { > .port_id =3D i, > @@ -501,6 +515,22 @@ static int ipn3ke_vswitch_probe(struct rte_afu_devic= e *afu_dev) > snprintf(name, sizeof(name), "net_%s_representor_%d", > afu_dev->device.name, i); > =20 > + for (; j < 8; j++) { > + fvl_bdf =3D ifpga_dev->fvl_bdf[j]; > + retval =3D rte_eth_dev_get_port_by_name(fvl_bdf, > + &port_id); > + if (retval) { > + continue; > + } else { > + i40e_eth =3D &rte_eth_devices[port_id]; > + rpst.i40e_pf_eth =3D i40e_eth; > + rpst.i40e_pf_eth_port_id =3D port_id; > + > + j++; > + break; > + } > + } > + > retval =3D rte_eth_dev_create(&afu_dev->device, name, > sizeof(struct ipn3ke_rpst), NULL, NULL, > ipn3ke_rpst_init, &rpst); > @@ -508,6 +538,7 @@ static int ipn3ke_vswitch_probe(struct rte_afu_device= *afu_dev) > if (retval) > IPN3KE_AFU_PMD_ERR("failed to create ipn3ke representor %s.", > name); > + > } > =20 > return 0; > @@ -553,254 +584,6 @@ static int ipn3ke_vswitch_remove(struct=20 > rte_afu_device *afu_dev) > =20 > RTE_PMD_REGISTER_AFU(net_ipn3ke_afu, afu_ipn3ke_driver); > =20 > -static const char * const valid_args[] =3D { > -#define IPN3KE_AFU_NAME "afu" > - IPN3KE_AFU_NAME, > -#define IPN3KE_FPGA_ACCELERATION_LIST "fpga_acc" > - IPN3KE_FPGA_ACCELERATION_LIST, > -#define IPN3KE_I40E_PF_LIST "i40e_pf" > - IPN3KE_I40E_PF_LIST, > - NULL > -}; > - > -static int > -ipn3ke_cfg_parse_acc_list(const char *afu_name, > - const char *acc_list_name) > -{ > - struct rte_afu_device *afu_dev; > - struct ipn3ke_hw *hw; > - const char *p_source; > - char *p_start; > - char name[RTE_ETH_NAME_MAX_LEN]; > - > - afu_dev =3D rte_ifpga_find_afu_by_name(afu_name); > - if (!afu_dev) > - return -1; > - hw =3D afu_dev->shared.data; > - if (!hw) > - return -1; > - > - p_source =3D acc_list_name; > - while (*p_source) { > - while ((*p_source =3D=3D '{') || (*p_source =3D=3D '|')) > - p_source++; > - p_start =3D name; > - while ((*p_source !=3D '|') && (*p_source !=3D '}')) > - *p_start++ =3D *p_source++; > - *p_start =3D 0; > - if (!strcmp(name, "tm") && hw->tm_hw_enable) > - hw->acc_tm =3D 1; > - > - if (!strcmp(name, "flow") && hw->flow_hw_enable) > - hw->acc_flow =3D 1; > - > - if (*p_source =3D=3D '}') > - return 0; > - } > - > - return 0; > -} > - > -static int > -ipn3ke_cfg_parse_i40e_pf_ethdev(const char *afu_name, > - const char *pf_name) > -{ > - struct rte_eth_dev *i40e_eth, *rpst_eth; > - struct rte_afu_device *afu_dev; > - struct ipn3ke_rpst *rpst; > - struct ipn3ke_hw *hw; > - const char *p_source; > - char *p_start; > - char name[RTE_ETH_NAME_MAX_LEN]; > - uint16_t port_id; > - int i; > - int ret =3D -1; > - > - afu_dev =3D rte_ifpga_find_afu_by_name(afu_name); > - if (!afu_dev) > - return -1; > - hw =3D afu_dev->shared.data; > - if (!hw) > - return -1; > - > - p_source =3D pf_name; > - for (i =3D 0; i < hw->port_num; i++) { > - snprintf(name, sizeof(name), "net_%s_representor_%d", > - afu_name, i); > - ret =3D rte_eth_dev_get_port_by_name(name, &port_id); > - if (ret) > - return -1; > - rpst_eth =3D &rte_eth_devices[port_id]; > - rpst =3D IPN3KE_DEV_PRIVATE_TO_RPST(rpst_eth); > - > - while ((*p_source =3D=3D '{') || (*p_source =3D=3D '|')) > - p_source++; > - p_start =3D name; > - while ((*p_source !=3D '|') && (*p_source !=3D '}')) > - *p_start++ =3D *p_source++; > - *p_start =3D 0; > - > - ret =3D rte_eth_dev_get_port_by_name(name, &port_id); > - if (ret) > - return -1; > - i40e_eth =3D &rte_eth_devices[port_id]; > - > - rpst->i40e_pf_eth =3D i40e_eth; > - rpst->i40e_pf_eth_port_id =3D port_id; > - > - if ((*p_source =3D=3D '}') || !(*p_source)) > - break; > - } > - > - return 0; > -} > - > -static int > -ipn3ke_cfg_probe(struct rte_vdev_device *dev) -{ > - struct rte_devargs *devargs; > - struct rte_kvargs *kvlist =3D NULL; > - char *afu_name =3D NULL; > - char *acc_name =3D NULL; > - char *pf_name =3D NULL; > - int afu_name_en =3D 0; > - int acc_list_en =3D 0; > - int pf_list_en =3D 0; > - int ret =3D -1; > - > - devargs =3D dev->device.devargs; > - > - kvlist =3D rte_kvargs_parse(devargs->args, valid_args); > - if (!kvlist) { > - IPN3KE_AFU_PMD_ERR("error when parsing param"); > - goto end; > - } > - > - if (rte_kvargs_count(kvlist, IPN3KE_AFU_NAME) =3D=3D 1) { > - if (rte_kvargs_process(kvlist, IPN3KE_AFU_NAME, > - &rte_ifpga_get_string_arg, > - &afu_name) < 0) { > - IPN3KE_AFU_PMD_ERR("error to parse %s", > - IPN3KE_AFU_NAME); > - goto end; > - } else { > - afu_name_en =3D 1; > - } > - } > - > - if (rte_kvargs_count(kvlist, IPN3KE_FPGA_ACCELERATION_LIST) =3D=3D 1) { > - if (rte_kvargs_process(kvlist, IPN3KE_FPGA_ACCELERATION_LIST, > - &rte_ifpga_get_string_arg, > - &acc_name) < 0) { > - IPN3KE_AFU_PMD_ERR("error to parse %s", > - IPN3KE_FPGA_ACCELERATION_LIST); > - goto end; > - } else { > - acc_list_en =3D 1; > - } > - } > - > - if (rte_kvargs_count(kvlist, IPN3KE_I40E_PF_LIST) =3D=3D 1) { > - if (rte_kvargs_process(kvlist, IPN3KE_I40E_PF_LIST, > - &rte_ifpga_get_string_arg, > - &pf_name) < 0) { > - IPN3KE_AFU_PMD_ERR("error to parse %s", > - IPN3KE_I40E_PF_LIST); > - goto end; > - } else { > - pf_list_en =3D 1; > - } > - } > - > - if (!afu_name_en) { > - IPN3KE_AFU_PMD_ERR("arg %s is mandatory for ipn3ke", > - IPN3KE_AFU_NAME); > - goto end; > - } > - > - if (!pf_list_en) { > - IPN3KE_AFU_PMD_ERR("arg %s is mandatory for ipn3ke", > - IPN3KE_I40E_PF_LIST); > - goto end; > - } > - > - if (acc_list_en) { > - ret =3D ipn3ke_cfg_parse_acc_list(afu_name, acc_name); > - if (ret) { > - IPN3KE_AFU_PMD_ERR("arg %s parse error for ipn3ke", > - IPN3KE_FPGA_ACCELERATION_LIST); > - goto end; > - } > - } else { > - IPN3KE_AFU_PMD_INFO("arg %s is optional for ipn3ke, using i40e acc", > - IPN3KE_FPGA_ACCELERATION_LIST); > - } > - > - ret =3D ipn3ke_cfg_parse_i40e_pf_ethdev(afu_name, pf_name); > - if (ret) > - goto end; > -end: > - if (kvlist) > - rte_kvargs_free(kvlist); > - if (afu_name) > - free(afu_name); > - if (acc_name) > - free(acc_name); > - > - return ret; > -} > - > -static int > -ipn3ke_cfg_remove(struct rte_vdev_device *dev) -{ > - struct rte_devargs *devargs; > - struct rte_kvargs *kvlist =3D NULL; > - char *afu_name =3D NULL; > - struct rte_afu_device *afu_dev; > - int ret =3D -1; > - > - devargs =3D dev->device.devargs; > - > - kvlist =3D rte_kvargs_parse(devargs->args, valid_args); > - if (!kvlist) { > - IPN3KE_AFU_PMD_ERR("error when parsing param"); > - goto end; > - } > - > - if (rte_kvargs_count(kvlist, IPN3KE_AFU_NAME) =3D=3D 1) { > - if (rte_kvargs_process(kvlist, IPN3KE_AFU_NAME, > - &rte_ifpga_get_string_arg, > - &afu_name) < 0) { > - IPN3KE_AFU_PMD_ERR("error to parse %s", > - IPN3KE_AFU_NAME); > - } else { > - afu_dev =3D rte_ifpga_find_afu_by_name(afu_name); > - if (!afu_dev) > - goto end; > - ret =3D ipn3ke_vswitch_remove(afu_dev); > - } > - } else { > - IPN3KE_AFU_PMD_ERR("Remove ipn3ke_cfg %p error", dev); > - } > - > -end: > - if (kvlist) > - rte_kvargs_free(kvlist); > - > - return ret; > -} > - > -static struct rte_vdev_driver ipn3ke_cfg_driver =3D { > - .probe =3D ipn3ke_cfg_probe, > - .remove =3D ipn3ke_cfg_remove, > -}; > - > -RTE_PMD_REGISTER_VDEV(ipn3ke_cfg, ipn3ke_cfg_driver);=20 > -RTE_PMD_REGISTER_PARAM_STRING(ipn3ke_cfg, > - "afu=3D " > - "fpga_acc=3D" > - "i40e_pf=3D"); > - > RTE_INIT(ipn3ke_afu_init_log) > { > ipn3ke_afu_logtype =3D rte_log_register("pmd.afu.ipn3ke"); > diff --git a/drivers/net/ipn3ke/ipn3ke_representor.c=20 > b/drivers/net/ipn3ke/ipn3ke_representor.c > index d37f5e2..7e5d29d 100644 > --- a/drivers/net/ipn3ke/ipn3ke_representor.c > +++ b/drivers/net/ipn3ke/ipn3ke_representor.c > @@ -20,6 +20,7 @@ > #include > #include > #include > +#include > =20 > #include "ipn3ke_rawdev_api.h" > #include "ipn3ke_flow.h" > @@ -2918,8 +2919,11 @@ static uint16_t ipn3ke_rpst_recv_pkts(__rte_unused= void *rx_q, > rpst->switch_domain_id =3D representor_param->switch_domain_id; > rpst->port_id =3D representor_param->port_id; > rpst->hw =3D representor_param->hw; > - rpst->i40e_pf_eth =3D NULL; > - rpst->i40e_pf_eth_port_id =3D 0xFFFF; > + rpst->i40e_pf_eth =3D representor_param->i40e_pf_eth; > + rpst->i40e_pf_eth_port_id =3D representor_param->i40e_pf_eth_port_id; > + if (rpst->i40e_pf_eth) > + rte_pmd_i40e_set_switch_dev(rpst->i40e_pf_eth_port_id, > + rpst->ethdev); > =20 > ethdev->data->mac_addrs =3D rte_zmalloc("ipn3ke", RTE_ETHER_ADDR_LEN, 0= ); > if (!ethdev->data->mac_addrs) {