From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id E73FE7CD6 for ; Mon, 21 May 2018 15:11:36 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 21 May 2018 06:11:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,426,1520924400"; d="scan'208";a="40970386" Received: from fmsmsx107.amr.corp.intel.com ([10.18.124.205]) by fmsmga007.fm.intel.com with ESMTP; 21 May 2018 06:11:35 -0700 Received: from fmsmsx156.amr.corp.intel.com (10.18.116.74) by fmsmsx107.amr.corp.intel.com (10.18.124.205) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 21 May 2018 06:11:35 -0700 Received: from shsmsx101.ccr.corp.intel.com (10.239.4.153) by fmsmsx156.amr.corp.intel.com (10.18.116.74) with Microsoft SMTP Server (TLS) id 14.3.319.2; Mon, 21 May 2018 06:11:35 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.210]) by SHSMSX101.ccr.corp.intel.com ([169.254.1.40]) with mapi id 14.03.0319.002; Mon, 21 May 2018 21:11:33 +0800 From: "Zhang, Qi Z" To: Zijie Pan , "dev@dpdk.org" CC: "Xing, Beilei" , Laurent Hardy Thread-Topic: [PATCH] net/i40e: add a specific API to control the LLDP agent Thread-Index: AQHT7pEJPD5k6IWeDUyi8o+YoX7RbqQ6KiiQ Date: Mon, 21 May 2018 13:11:32 +0000 Message-ID: <039ED4275CED7440929022BC67E70611531B55D5@SHSMSX103.ccr.corp.intel.com> References: <1526638447-31246-1-git-send-email-zijie.pan@6wind.com> In-Reply-To: <1526638447-31246-1-git-send-email-zijie.pan@6wind.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiYWVjODkzYmEtZmE2OC00N2FjLTg4MmMtMDM5Y2Y4NzViMTRhIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoiYVRTTmJYcldIN2p6NFhGeWZ2K0ROZ1JyTnNPTlE4QUdQT3o4ZU9LQklpcUZMNmxHRUN6UXJaRjhYdW9LV3FxVCJ9 x-ctpclassification: CTP_NT dlp-product: dlpe-windows dlp-version: 11.0.200.100 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] net/i40e: add a specific API to control the LLDP agent 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: Mon, 21 May 2018 13:11:37 -0000 Hi Zijie: > -----Original Message----- > From: Zijie Pan [mailto:zijie.pan@6wind.com] > Sent: Friday, May 18, 2018 6:14 PM > To: dev@dpdk.org > Cc: Xing, Beilei ; Zhang, Qi Z ; > Laurent Hardy > Subject: [PATCH] net/i40e: add a specific API to control the LLDP agent >=20 > Add a new API rte_pmd_i40e_set_lldp_cmd to control LLDP agent for i40e. > It supports the following i40e debug lldp commands: I'm not very sure if it is necessary to expose more APIs just for debug? As you know we have the patch Fixes: 4861cde46116 ("i40e: new poll mode dri= ver") for the knowing issue. Now, if new firmware fix this, we properly can add LLDP disable back with p= roperly firmware check branch (of cause with enough test first) Regards Qi > - start/stop of the LLDP agent. > - get local/remote of the LLDP MIB (Management Information Base). >=20 > Signed-off-by: Laurent Hardy > Signed-off-by: Zijie Pan > --- > drivers/net/i40e/i40e_ethdev.h | 19 +++++++++ > drivers/net/i40e/rte_pmd_i40e.c | 64 > +++++++++++++++++++++++++++++ > drivers/net/i40e/rte_pmd_i40e.h | 22 ++++++++++ > drivers/net/i40e/rte_pmd_i40e_version.map | 8 +++- > 4 files changed, 112 insertions(+), 1 deletion(-) >=20 > diff --git a/drivers/net/i40e/i40e_ethdev.h b/drivers/net/i40e/i40e_ethde= v.h > index 55c8875..459b3ff 100644 > --- a/drivers/net/i40e/i40e_ethdev.h > +++ b/drivers/net/i40e/i40e_ethdev.h > @@ -267,6 +267,25 @@ enum i40e_flxpld_layer_idx { struct i40e_adapter; >=20 > /** > + * LLDP command type > + */ > +enum i40_lldp_cmd_type { > + I40E_LLDP_CMD_START =3D 0, > + I40E_LLDP_CMD_STOP, > + I40E_LLDP_CMD_GET_LOCAL, > + I40E_LLDP_CMD_GET_REMOTE, > + I40E_LLDP_CMD_UNKNOWN, > +}; > + > +/** > + * LLDP command structure > + */ > +struct i40e_lldp_cmd { > + const char *name; > + enum i40_lldp_cmd_type cmd; > +}; > + > +/** > * MAC filter structure > */ > struct i40e_mac_filter_info { > diff --git a/drivers/net/i40e/rte_pmd_i40e.c > b/drivers/net/i40e/rte_pmd_i40e.c index 7aa1a75..307c597 100644 > --- a/drivers/net/i40e/rte_pmd_i40e.c > +++ b/drivers/net/i40e/rte_pmd_i40e.c > @@ -12,6 +12,14 @@ > #include "i40e_rxtx.h" > #include "rte_pmd_i40e.h" >=20 > +static const struct i40e_lldp_cmd lldp_cmds_table[] =3D { > + {"start", I40E_LLDP_CMD_START}, > + {"stop", I40E_LLDP_CMD_STOP}, > + {"get local", I40E_LLDP_CMD_GET_LOCAL}, > + {"get remote", I40E_LLDP_CMD_GET_REMOTE}, > + {"", I40E_LLDP_CMD_UNKNOWN}, > +}; > + > int > rte_pmd_i40e_ping_vfs(uint16_t port, uint16_t vf) { @@ -3192,3 +3200,59 > @@ int rte_pmd_i40e_flow_add_del_packet_template( > I40E_WRITE_FLUSH(hw); > return 0; > } > + > +int __rte_experimental > +rte_pmd_i40e_set_lldp_cmd(uint16_t port, const char *cmd, void > +*lldpmib) { > + struct rte_eth_dev *dev; > + struct i40e_hw *hw; > + uint8_t br_type; > + int i, ret; > + > + RTE_ETH_VALID_PORTID_OR_ERR_RET(port, -ENODEV); > + > + dev =3D &rte_eth_devices[port]; > + > + if (!is_i40e_supported(dev)) > + return -ENOTSUP; > + > + hw =3D I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private); > + > + for (i =3D 0; i < I40E_LLDP_CMD_UNKNOWN; i++) { > + if (!strcmp(cmd, lldp_cmds_table[i].name)) > + break; > + } > + > + if (lldp_cmds_table[i].cmd =3D=3D I40E_LLDP_CMD_UNKNOWN) { > + PMD_DRV_LOG(ERR, "Unknown LLDP command\n"); > + return -EINVAL; > + } > + > + switch (lldp_cmds_table[i].cmd) { > + case I40E_LLDP_CMD_START: > + ret =3D i40e_aq_start_lldp(hw, NULL); > + break; > + case I40E_LLDP_CMD_STOP: > + ret =3D i40e_aq_stop_lldp(hw, true, NULL); > + break; > + case I40E_LLDP_CMD_GET_LOCAL: > + ret =3D i40e_aq_get_lldp_mib(hw, 0, > + I40E_AQ_LLDP_MIB_LOCAL, > + lldpmib, I40E_LLDPDU_SIZE, > + NULL, NULL, NULL); > + break; > + case I40E_LLDP_CMD_GET_REMOTE: > + br_type =3D I40E_AQ_LLDP_BRIDGE_TYPE_NEAREST_BRIDGE; > + ret =3D i40e_aq_get_lldp_mib(hw, br_type, > + I40E_AQ_LLDP_MIB_REMOTE, > + lldpmib, I40E_LLDPDU_SIZE, > + NULL, NULL, NULL); > + break; > + default: > + PMD_DRV_LOG(ERR, "Unknown LLDP command\n"); > + ret =3D -EINVAL; > + break; > + } > + > + return ret; > +} > diff --git a/drivers/net/i40e/rte_pmd_i40e.h > b/drivers/net/i40e/rte_pmd_i40e.h index be4a602..59b2eee 100644 > --- a/drivers/net/i40e/rte_pmd_i40e.h > +++ b/drivers/net/i40e/rte_pmd_i40e.h > @@ -1061,4 +1061,26 @@ int rte_pmd_i40e_inset_set(uint16_t port, uint8_t > pctype, > return 0; > } >=20 > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Process the LLDP commands, including "lldp start", "lldp stop", > + * "lldp get local" and "lldp get remote". > + * > + * @param port > + * The port identifier of the Ethernet device. > + * @param cmd > + * The LLDP command. > + * @param lldpmib > + * The pointer to return the LLDP MIB. > + * @return > + * - (0) if successful. > + * - (-ENODEV) if *port* invalid. > + * - (-EINVAL) if *cmd* invalid. > + * - (-ENOTSUP) not supported by firmware. > + */ > +int __rte_experimental > +rte_pmd_i40e_set_lldp_cmd(uint16_t port, const char *cmd, void > +*lldpmib); > + > #endif /* _PMD_I40E_H_ */ > diff --git a/drivers/net/i40e/rte_pmd_i40e_version.map > b/drivers/net/i40e/rte_pmd_i40e_version.map > index cccd576..1ffa02a 100644 > --- a/drivers/net/i40e/rte_pmd_i40e_version.map > +++ b/drivers/net/i40e/rte_pmd_i40e_version.map > @@ -64,4 +64,10 @@ DPDK_18.02 { >=20 > rte_pmd_i40e_inset_get; > rte_pmd_i40e_inset_set; > -} DPDK_17.11; > \ No newline at end of file > +} DPDK_17.11; > + > +EXPERIMENTAL { > + global: > + > + rte_pmd_i40e_set_lldp_cmd; > +}; > -- > 1.7.10.4