From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) by dpdk.org (Postfix) with ESMTP id CB14E2FDD for ; Fri, 7 Apr 2017 08:58:54 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1491548335; x=1523084335; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=utzZmXW9kmCseie1vntugVkw/InV/NCU6PTffh1ar7I=; b=Hk8FcOxC2mpzJHP3Zo+8RPNGS5OLkrtlsDcb+WkGeLInHgnzAeixqnYp /Oxw5r7zUGzxa4XtJMSnjn93VwqQoA==; Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Apr 2017 23:58:53 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,164,1488873600"; d="scan'208";a="85802739" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by fmsmga005.fm.intel.com with ESMTP; 06 Apr 2017 23:58:53 -0700 Received: from fmsmsx115.amr.corp.intel.com (10.18.116.19) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 6 Apr 2017 23:58:52 -0700 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by fmsmsx115.amr.corp.intel.com (10.18.116.19) with Microsoft SMTP Server (TLS) id 14.3.319.2; Thu, 6 Apr 2017 23:58:52 -0700 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.193]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.224]) with mapi id 14.03.0319.002; Fri, 7 Apr 2017 14:58:49 +0800 From: "Yang, Qiming" To: "Zhao1, Wei" , "dev@dpdk.org" CC: "Lu, Wenzhuo" , "Zhao1, Wei" Thread-Topic: [dpdk-dev] [PATCH v6 1/3] lib/librte_ether: add support for port reset Thread-Index: AQHSrqMwiBpdOWxcGE+XmOeXmoFRAqG5eRYw Date: Fri, 7 Apr 2017 06:58:48 +0000 Message-ID: References: <1491460427-38765-1-git-send-email-wei.zhao1@intel.com> <1491461483-39861-1-git-send-email-wei.zhao1@intel.com> <1491461483-39861-2-git-send-email-wei.zhao1@intel.com> In-Reply-To: <1491461483-39861-2-git-send-email-wei.zhao1@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMzJlZjk5MjYtOTZlMi00YmU5LThmOWUtNjAzMjhkMDM1YzkyIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE1LjkuNi42IiwiVHJ1c3RlZExhYmVsSGFzaCI6ImR3T0RpTWhPZ2xOYmdBVVJPWUZyaVdEZG1MZllOakYrMXhHY0NXbkVUemM9In0= x-ctpclassification: CTP_IC 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 v6 1/3] lib/librte_ether: add support for port reset 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: , X-List-Received-Date: Fri, 07 Apr 2017 06:58:55 -0000 Hi, Wei > -----Original Message----- > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wei Zhao > Sent: Thursday, April 6, 2017 2:51 PM > To: dev@dpdk.org > Cc: Lu, Wenzhuo ; Zhao1, Wei > > Subject: [dpdk-dev] [PATCH v6 1/3] lib/librte_ether: add support for port > reset >=20 > Add support for port reset in rte layer.This reset feature can not only u= sed in > vf port reset in later code develop, but alsopf port.But in this patch se= t, we > only limit the discussion scope to vf reset. > This patch Add an API to restart the device. ' alsopf' should add space. 'Add' should be lowercase. > It's for VF device in this scenario, kernel PF + DPDK VF. > When the PF port down->up, APP should call this API to restart VF port. M= ost > likely, APP should call it in its management thread and guarantee the thr= ead > safe. It means APP should stop the rx/tx and the device, then restart the > device, then recover the device and rx/tx.This API can also do some resto= re > work for the port. Please check the grammar problems in this paragraph. >=20 > Signed-off-by: Wenzhuo Lu > Signed-off-by: Wei Zhao > --- > lib/librte_ether/rte_ethdev.c | 17 +++++++++++++++++ > lib/librte_ether/rte_ethdev.h | 28 ++++++++++++++++++++++++++++ > lib/librte_ether/rte_ether_version.map | 6 ++++++ > 3 files changed, 51 insertions(+) >=20 > diff --git a/lib/librte_ether/rte_ethdev.c b/lib/librte_ether/rte_ethdev.= c > index eb0a94a..2e06dca 100644 > --- a/lib/librte_ether/rte_ethdev.c > +++ b/lib/librte_ether/rte_ethdev.c > @@ -3273,3 +3273,20 @@ rte_eth_dev_l2_tunnel_offload_set(uint8_t > port_id, > -ENOTSUP); > return (*dev->dev_ops->l2_tunnel_offload_set)(dev, l2_tunnel, > mask, en); } > + > +int > +rte_eth_dev_reset(uint8_t port_id) > +{ > + struct rte_eth_dev *dev; > + int diag; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port_id, -ENODEV); > + > + dev =3D &rte_eth_devices[port_id]; > + > + RTE_FUNC_PTR_OR_ERR_RET(*dev->dev_ops->dev_reset, - > ENOTSUP); > + > + diag =3D (*dev->dev_ops->dev_reset)(dev); > + > + return diag; > +} > diff --git a/lib/librte_ether/rte_ethdev.h b/lib/librte_ether/rte_ethdev.= h > index 4be217c..8287c50 100644 > --- a/lib/librte_ether/rte_ethdev.h > +++ b/lib/librte_ether/rte_ethdev.h > @@ -1367,6 +1367,9 @@ typedef int (*eth_l2_tunnel_offload_set_t) > uint8_t en); > /**< @internal enable/disable the l2 tunnel offload functions */ >=20 > +typedef int (*eth_dev_reset_t)(struct rte_eth_dev *dev); /**< > +@internal Function used to reset a configured Ethernet device. */ > + > #ifdef RTE_NIC_BYPASS >=20 > enum { > @@ -1509,6 +1512,9 @@ struct eth_dev_ops { > eth_l2_tunnel_offload_set_t l2_tunnel_offload_set; > /** Enable/disable l2 tunnel offload functions. */ >=20 > + /** Reset device. */ > + eth_dev_reset_t dev_reset; > + > eth_set_queue_rate_limit_t set_queue_rate_limit; /**< Set queue > rate limit. */ >=20 > rss_hash_update_t rss_hash_update; /** Configure RSS hash > protocols. */ > @@ -4413,6 +4419,28 @@ int > rte_eth_dev_get_name_by_port(uint8_t port_id, char *name); >=20 > /** > + * Reset an ethernet device when it's not working. One scenario is, > +after PF > + * port is down and up, the related VF port should be reset. Is there have other scenario? I don't know what is 'down and up' means? Can= you put it another way?=20 > + * The API will stop the port, clear the rx/tx queues, re-setup the > +rx/tx > + * queues, restart the port. > + * Before calling this API, APP should stop the rx/tx. When tx is being > +stopped, > + * APP can drop the packets and release the buffer instead of sending th= em. > + * This function can also do some restore work for the port, for > +example, it can > + * restore the added parameters of vlan, mac_addrs, > +promisc_unicast_enabled > + * flag and promisc_multicast_enabled flag. > + * > + * @param port_id > + * The port identifier of the Ethernet device. > + * > + * @return > + * - (0) if successful. > + * - (-ENODEV) if port identifier is invalid. > + * - (-ENOTSUP) if hardware doesn't support this function. > + */ > +int > +rte_eth_dev_reset(uint8_t port_id); > + > +/** > * @internal > * Wrapper for use by pci drivers as a .probe function to attach to a et= hdev > * interface. > diff --git a/lib/librte_ether/rte_ether_version.map > b/lib/librte_ether/rte_ether_version.map > index c6c9d0d..529b27f 100644 > --- a/lib/librte_ether/rte_ether_version.map > +++ b/lib/librte_ether/rte_ether_version.map > @@ -154,3 +154,9 @@ DPDK_17.02 { > rte_flow_validate; >=20 > } DPDK_16.11; > + > +DPDK_17.05 { > + global: > + > + rte_eth_dev_reset; > +} DPDK_17.02; > \ No newline at end of file > -- > 2.9.3