From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id E7AD7A00E6 for ; Tue, 11 Jun 2019 03:00:25 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 1955F1C1E2; Tue, 11 Jun 2019 03:00:25 +0200 (CEST) Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by dpdk.org (Postfix) with ESMTP id CE2AD1C1A0; Tue, 11 Jun 2019 03:00:22 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Jun 2019 18:00:21 -0700 X-ExtLoop1: 1 Received: from fmsmsx106.amr.corp.intel.com ([10.18.124.204]) by orsmga006.jf.intel.com with ESMTP; 10 Jun 2019 18:00:21 -0700 Received: from shsmsx106.ccr.corp.intel.com (10.239.4.159) by FMSMSX106.amr.corp.intel.com (10.18.124.204) with Microsoft SMTP Server (TLS) id 14.3.408.0; Mon, 10 Jun 2019 18:00:20 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.10]) by SHSMSX106.ccr.corp.intel.com ([169.254.10.113]) with mapi id 14.03.0415.000; Tue, 11 Jun 2019 09:00:18 +0800 From: "Wang, Haiyue" To: "Zhang, Qi Z" , "dev@dpdk.org" , "Lu, Wenzhuo" , "Wang, Liang-min" , "daniels@research.att.com" , "ktraynor@redhat.com" CC: "stable@dpdk.org" Thread-Topic: [PATCH v2] net/ixgbevf: add an option pflink_fullchk to get link status nowait Thread-Index: AQHVHUotS/q6PC3lqEuYqSnGvpE7PaaUO3wAgAFpYeA= Date: Tue, 11 Jun 2019 01:00:17 +0000 Message-ID: References: <1559922981-101848-1-git-send-email-haiyue.wang@intel.com> <039ED4275CED7440929022BC67E7061153399BF8@SHSMSX103.ccr.corp.intel.com> In-Reply-To: <039ED4275CED7440929022BC67E7061153399BF8@SHSMSX103.ccr.corp.intel.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiZTdlM2Q1OWUtMjJjNC00MWQ0LThhZDctNTZmMWJlNjdjNDc0IiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiK2JScFM1anlGcm5uRFwvWkhzbzZ3RXppR2M1R2I3RWpRNlwvZnU3RTB1UlNmOWdncm9FWFhSQmgrdVZ4MHVyaFErIn0= x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.2.0.6 dlp-reaction: no-action 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 v2] net/ixgbevf: add an option pflink_fullchk to get link status nowait 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" > -----Original Message----- > From: Zhang, Qi Z > Sent: Monday, June 10, 2019 19:17 > To: Wang, Haiyue ; dev@dpdk.org; Lu, Wenzhuo ; Wang, > Liang-min ; daniels@research.att.com; ktraynor@= redhat.com > Cc: stable@dpdk.org > Subject: RE: [PATCH v2] net/ixgbevf: add an option pflink_fullchk to get = link status nowait >=20 >=20 >=20 > > -----Original Message----- > > From: Wang, Haiyue > > Sent: Friday, June 7, 2019 11:56 PM > > To: dev@dpdk.org; Zhang, Qi Z ; Lu, Wenzhuo > > ; Wang, Liang-min ; > > daniels@research.att.com; ktraynor@redhat.com > > Cc: Wang, Haiyue ; stable@dpdk.org > > Subject: [PATCH v2] net/ixgbevf: add an option pflink_fullchk to get li= nk status > > nowait > > > > To get the VF's link status by calling 'rte_eth_link_get_nowait()', the= VF not > > only check PF's physical link status, but also check the mailbox runnin= g status. > > And mailbox checking will generate mailbox interrupt in PF, it will be = worse if > > many VFs are running in the system, the PF will have to handle many > > interrrupts. > > > > Normally, checking the PF's physical link status is enough for nowait. > > For different scenarios, adding an 'pflink_fullchk' option to control w= hether to > > check the link fully or not. >=20 > Seems the patch change the default behavior which is always "fully check"= , > I assume a no fully check does not guarantee the link status is synced co= rrectly, right? > should we implement this devargs in an inverse way to avoid the inconsist= ent with previous version? > From my view correctness should take high priority than performance. >=20 >=20 In fact, 91546fb62e67 (in Fixes) breaks the default behavior, change it to = "fully check" in nowait. This patch switches to "meaningful check" PF's physical link sta= tus by default. So now, we can meet three scenarios: 1. Sync with PF's physical link status in nowait, (Default), no mailbox in= terrupt handling in PF, the fastest way. 2. Sync with PF's physical link status & mailbox (PF's service running) st= atus in nowait, will consume the host's interrupt handling, if many VFs are run= ning and checking frequently, system load may be heavy. 3. Wait mode, it will be slow, not only #2 actions, but also wait the link= status stable in some time. > > > > Fixes: 91546fb62e67 ("net/ixgbevf: fix link state") > > Cc: stable@dpdk.org > > > > Signed-off-by: Haiyue Wang > > --- > > doc/guides/nics/ixgbe.rst | 25 ++++++++++++++++ > > drivers/net/ixgbe/ixgbe_ethdev.c | 63 > > ++++++++++++++++++++++++++++++++++++++++ > > drivers/net/ixgbe/ixgbe_ethdev.h | 5 ++++ > > 3 files changed, 93 insertions(+) > > > > diff --git a/doc/guides/nics/ixgbe.rst b/doc/guides/nics/ixgbe.rst inde= x > > 975143f..5c3a7e4 100644 > > --- a/doc/guides/nics/ixgbe.rst > > +++ b/doc/guides/nics/ixgbe.rst > > @@ -82,6 +82,31 @@ To guarantee the constraint, capabilities in > > dev_conf.rxmode.offloads will be ch > > > > fdir_conf->mode will also be checked. > > > > +VF Runtime Options > > +^^^^^^^^^^^^^^^^^^ > > + > > +The following ``devargs`` options can be enabled at runtime. They must > > +be passed as part of EAL arguments. For example, > > + > > +.. code-block:: console > > + > > + testpmd -w af:10.0,pflink_fullchk=3D1 -- -i > > + > > +- ``pflink_fullchk`` (default **0**) > > + > > + When calling ``rte_eth_link_get_nowait()`` to get VF link status, > > + this option is used to control how VF synchronizes its status with > > + PF's. If set, VF will not only check the PF's physical link status b= y > > + reading related register, but also check the mailbox status. We call > > + this behavior as fully checking. And checking mailbox will trigger > > + PF's mailbox interrupt generation. If unset, the application can get > > + the VF's link status quickly by just reading the PF's link status > > + register, this will avoid the whole system's mailbox interrupt > > + generation. > > + > > + ``rte_eth_link_get()`` will still use the mailbox method regardless > > + of the pflink_fullchk setting. > > + > > RX Burst Size > > ^^^^^^^^^^^^^ > > > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c > > b/drivers/net/ixgbe/ixgbe_ethdev.c > > index 3636b50..ade119d 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.c > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.c > > @@ -23,6 +23,7 @@ > > #include > > #include > > #include > > +#include > > #include > > #include > > #include > > @@ -127,6 +128,13 @@ > > #define IXGBE_EXVET_VET_EXT_SHIFT 16 > > #define IXGBE_DMATXCTL_VT_MASK 0xFFFF0000 > > > > +#define IXGBEVF_DEVARG_PFLINK_FULLCHK "pflink_fullchk" > > + > > +static const char * const ixgbevf_valid_arguments[] =3D { > > + IXGBEVF_DEVARG_PFLINK_FULLCHK, > > + NULL > > +}; > > + > > static int eth_ixgbe_dev_init(struct rte_eth_dev *eth_dev, void *init_= params); > > static int eth_ixgbe_dev_uninit(struct rte_eth_dev *eth_dev); static i= nt > > ixgbe_fdir_filter_init(struct rte_eth_dev *eth_dev); @@ -1550,6 +1558,4= 5 > > @@ generate_random_mac_addr(struct rte_ether_addr *mac_addr) > > memcpy(&mac_addr->addr_bytes[3], &random, 3); } > > > > +static int > > +devarg_handle_int(__rte_unused const char *key, const char *value, > > + void *extra_args) > > +{ > > + uint16_t *n =3D extra_args; > > + > > + if (value =3D=3D NULL || extra_args =3D=3D NULL) > > + return -EINVAL; > > + > > + *n =3D (uint16_t)strtoul(value, NULL, 0); > > + if (*n =3D=3D USHRT_MAX && errno =3D=3D ERANGE) > > + return -1; > > + > > + return 0; > > +} > > + > > +static void > > +ixgbevf_parse_devargs(struct ixgbe_adapter *adapter, > > + struct rte_devargs *devargs) > > +{ > > + struct rte_kvargs *kvlist; > > + uint16_t pflink_fullchk; > > + > > + if (devargs =3D=3D NULL) > > + return; > > + > > + kvlist =3D rte_kvargs_parse(devargs->args, ixgbevf_valid_arguments); > > + if (kvlist =3D=3D NULL) > > + return; > > + > > + if (rte_kvargs_count(kvlist, IXGBEVF_DEVARG_PFLINK_FULLCHK) =3D=3D 1 = && > > + rte_kvargs_process(kvlist, IXGBEVF_DEVARG_PFLINK_FULLCHK, > > + devarg_handle_int, &pflink_fullchk) =3D=3D 0 && > > + pflink_fullchk =3D=3D 1) > > + adapter->pflink_fullchk =3D 1; > > + > > + rte_kvargs_free(kvlist); > > +} > > + > > /* > > * Virtual Function device init > > */ > > @@ -1598,6 +1645,9 @@ eth_ixgbevf_dev_init(struct rte_eth_dev *eth_dev) > > return 0; > > } > > > > + ixgbevf_parse_devargs(eth_dev->data->dev_private, > > + pci_dev->device.devargs); > > + > > rte_eth_copy_pci_info(eth_dev, pci_dev); > > > > hw->device_id =3D pci_dev->id.device_id; @@ -3910,6 +3960,8 @@ static > > int ixgbevf_check_link(struct ixgbe_hw *hw, ixgbe_link_speed *speed, > > int *link_up, int wait_to_complete) { > > + struct ixgbe_adapter *adapter =3D container_of(hw, > > + struct ixgbe_adapter, hw); > > struct ixgbe_mbx_info *mbx =3D &hw->mbx; > > struct ixgbe_mac_info *mac =3D &hw->mac; > > uint32_t links_reg, in_msg; > > @@ -3970,6 +4022,15 @@ ixgbevf_check_link(struct ixgbe_hw *hw, > > ixgbe_link_speed *speed, > > *speed =3D IXGBE_LINK_SPEED_UNKNOWN; > > } > > > > + if (wait_to_complete =3D=3D 0 && adapter->pflink_fullchk =3D=3D 0) { > > + if (*speed =3D=3D IXGBE_LINK_SPEED_UNKNOWN) > > + mac->get_link_status =3D true; > > + else > > + mac->get_link_status =3D false; > > + > > + goto out; > > + } > > + > > /* if the read failed it could just be a mailbox collision, best wait > > * until we are called again and don't report an error > > */ > > @@ -8671,6 +8732,8 @@ RTE_PMD_REGISTER_KMOD_DEP(net_ixgbe, "* > > igb_uio | uio_pci_generic | vfio-pci"); RTE_PMD_REGISTER_PCI(net_ixgbe= _vf, > > rte_ixgbevf_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_ixgbe_vf, > > pci_id_ixgbevf_map); RTE_PMD_REGISTER_KMOD_DEP(net_ixgbe_vf, "* > > igb_uio | vfio-pci"); > > +RTE_PMD_REGISTER_PARAM_STRING(net_ixgbe_vf, > > + IXGBEVF_DEVARG_PFLINK_FULLCHK "=3D<0|1>"); > > > > RTE_INIT(ixgbe_init_log) > > { > > diff --git a/drivers/net/ixgbe/ixgbe_ethdev.h > > b/drivers/net/ixgbe/ixgbe_ethdev.h > > index fdad94d..6e9ed2e 100644 > > --- a/drivers/net/ixgbe/ixgbe_ethdev.h > > +++ b/drivers/net/ixgbe/ixgbe_ethdev.h > > @@ -498,6 +498,11 @@ struct ixgbe_adapter { > > > > /* For RSS reta table update */ > > uint8_t rss_reta_updated; > > + > > + /* Used for VF link sync with PF's physical and logical (by checking > > + * mailbox status) link status. > > + */ > > + uint8_t pflink_fullchk; > > }; > > > > struct ixgbe_vf_representor { > > -- > > 2.7.4