From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 1607545E94; Fri, 13 Dec 2024 22:06:36 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9919640E31; Fri, 13 Dec 2024 22:06:06 +0100 (CET) Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by mails.dpdk.org (Postfix) with ESMTP id DDD0940E2A for ; Fri, 13 Dec 2024 22:06:04 +0100 (CET) Received: by mail-pf1-f170.google.com with SMTP id d2e1a72fcca58-72764c995e5so1379224b3a.2 for ; Fri, 13 Dec 2024 13:06:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1734123964; x=1734728764; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=CE28vQC1xhFjHuHMUR5YDOihcz75+cKKWeJ8O5qKeks=; b=Mkdw0iRUY+BNUn9RwNXpVpqdtF2A9h8X2XeW1DQHrV1Y7sFoQA/JQlerzr6Cym27Qa uoQ+xfJUY2LT29qyrmgiUsOuPi6CAPXy+EBUhGKxjgP13OWRON+tI7VPvLVU5+0zTg0Z 2B+1/rFSo2SCSxIPn/UW7hCX6aT+2udAs5cC5I5Z4Bt9MikpnJr3PUh4ABFD4YQuJbwx crjv8hS8NrzZmmVZP+CnZEobsqRSFp0iNcuEZG1yXvfWlP7VcWj/37YRQoeWUGfEimPP OaIIEL0xFXifWvYeGbO+18l9o9cCILgSfitTxwrBLPlo0CIPn0JvTlMnT1Bkv3yP4D9T Xzxw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734123964; x=1734728764; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CE28vQC1xhFjHuHMUR5YDOihcz75+cKKWeJ8O5qKeks=; b=CgiuzhDxOHcBarNjeIxf7ahCtBGkBYzqFXtUSa1BZRzBJF3bwalktsYtZrhxzzFl8K +d3Z4iqazNdpollHeydZxIdy/Bp+FLnhPFIhCr+28utmGC68IKmVCsI0jngKpk2LkT8y KgcQKe94MWzRm6E2A0AJT9ZOe96lT81+OphYt6pVXpMDkStej9qnTKkL5RMhpDSh/HN8 mK6xjnQWtw0KHkZHZXeXHwsckYhjyfrjGBYY+1SHwGfxLTJRxfXhTgnIeWok+mc1+ee/ qt/4AqpVPO8AsoIlxd1zTvTG9plcv5/O5ZY2v1mMMKs9nuZx1JG/mtAKbOvq3wLzPWei 2sxw== X-Forwarded-Encrypted: i=1; AJvYcCV02CYrKZ3ORTSpEry4zrqADWchntG65liigoNa7LBfRJXmHvhqWQF87SaVt05J6TPzB6E=@dpdk.org X-Gm-Message-State: AOJu0YwfmDMyX80oBeDNGRK4tmaznLecrLqPvYkPIUXcH1Nu2KXZThv0 niRHczoOoEb+GJBXi4BEF48uCuyF0rMiiucmwzGdaBze7E7tZDVvHPLI6aNNOF7WXhUb2PO0S+p O X-Gm-Gg: ASbGncvtydxJ6EY5e13qjg2dqcMucFOj4yXvjdJChE4Zy+SgcrZsWjjqiD8DnZj/jTP R7rtnbvYk4FJJ5a2rklx5P0MlM7h3/dB+dHcTvQpgy0gLR6tCM1p06/dE+rSsltpZ91k6EvdTwt 8JJhwz6BERYTabyyE2dr4FQjxjZNNIils1l2i+plbCSUeNwCv13yJX34pfUZot7FgeStUc+AUKU kBBkwwEDblIENB9CiJARp+c1Y6NHG4DJn4CTv5HtPEAfWEyBKp8ye5yFq8q7pDJoGzEufk9utXi w8tuldPL5qdSpXP9qI/nV0FygFNKVPjKbQ== X-Google-Smtp-Source: AGHT+IHkIHRYunrmt5hpmN/9JlXlBlDh5Ifh6nemADuItdhKIQh6kxnvDj933AWIEgHPuVTt4xA/Cw== X-Received: by 2002:a05:6a00:13a4:b0:725:f1ca:fd76 with SMTP id d2e1a72fcca58-7290be7b151mr6444975b3a.0.1734123964076; Fri, 13 Dec 2024 13:06:04 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-72918bc020csm210583b3a.178.2024.12.13.13.06.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 13:06:03 -0800 (PST) Date: Fri, 13 Dec 2024 11:48:14 -0800 From: Stephen Hemminger To: Junlong Wang Cc: ferruh.yigit@amd.com, dev@dpdk.org Subject: Re: [PATCH v2 04/15] net/zxdh: port tables unint implementations Message-ID: <20241213114814.2cc3e5e1@hermes.local> In-Reply-To: <20241210055333.782901-5-wang.junlong1@zte.com.cn> References: <20241206055715.506961-2-wang.junlong1@zte.com.cn> <20241210055333.782901-1-wang.junlong1@zte.com.cn> <20241210055333.782901-5-wang.junlong1@zte.com.cn> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, 10 Dec 2024 13:53:22 +0800 Junlong Wang wrote: > delete port tables in host. > > Signed-off-by: Junlong Wang > --- > drivers/net/zxdh/zxdh_ethdev.c | 19 ++++++ > drivers/net/zxdh/zxdh_msg.h | 1 + > drivers/net/zxdh/zxdh_np.c | 113 +++++++++++++++++++++++++++++++++ > drivers/net/zxdh/zxdh_np.h | 9 +++ > drivers/net/zxdh/zxdh_tables.c | 36 ++++++++++- > drivers/net/zxdh/zxdh_tables.h | 1 + > 6 files changed, 177 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/zxdh/zxdh_ethdev.c b/drivers/net/zxdh/zxdh_ethdev.c > index 8a9ca87183..a72319758a 100644 > --- a/drivers/net/zxdh/zxdh_ethdev.c > +++ b/drivers/net/zxdh/zxdh_ethdev.c > @@ -887,12 +887,31 @@ zxdh_np_uninit(struct rte_eth_dev *dev) > zxdh_np_dtb_data_res_free(hw); > } > > +static int > +zxdh_tables_uninit(struct rte_eth_dev *dev) > +{ > + int ret = 0; > + > + ret = zxdh_port_attr_uninit(dev); > + if (ret) { > + PMD_DRV_LOG(ERR, "zxdh_port_attr_uninit failed"); > + return ret; > + } > + return ret; > +} > + > static int > zxdh_dev_close(struct rte_eth_dev *dev) > { > struct zxdh_hw *hw = dev->data->dev_private; > int ret = 0; > > + ret = zxdh_tables_uninit(dev); > + if (ret != 0) { > + PMD_DRV_LOG(ERR, "%s :tables uninit %s failed ", __func__, dev->device->name); > + return -1; > + } > + > zxdh_intr_release(dev); > zxdh_np_uninit(dev); > zxdh_pci_reset(hw); > diff --git a/drivers/net/zxdh/zxdh_msg.h b/drivers/net/zxdh/zxdh_msg.h > index 35ed5d1a1c..9997417f28 100644 > --- a/drivers/net/zxdh/zxdh_msg.h > +++ b/drivers/net/zxdh/zxdh_msg.h > @@ -167,6 +167,7 @@ enum pciebar_layout_type { > enum zxdh_msg_type { > ZXDH_NULL = 0, > ZXDH_VF_PORT_INIT = 1, > + ZXDH_VF_PORT_UNINIT = 2, > > ZXDH_MSG_TYPE_END, > } __rte_packed; > diff --git a/drivers/net/zxdh/zxdh_np.c b/drivers/net/zxdh/zxdh_np.c > index 736994643d..1c1c3cbbcc 100644 > --- a/drivers/net/zxdh/zxdh_np.c > +++ b/drivers/net/zxdh/zxdh_np.c > @@ -24,6 +24,7 @@ ZXDH_RISCV_DTB_MGR *p_riscv_dtb_queue_mgr[ZXDH_DEV_CHANNEL_MAX] = {NULL}; > ZXDH_TLB_MGR_T *g_p_dpp_tlb_mgr[ZXDH_DEV_CHANNEL_MAX] = {NULL}; > ZXDH_REG_T g_dpp_reg_info[4]; > ZXDH_DTB_TABLE_T g_dpp_dtb_table_info[4]; > +ZXDH_SDT_TBL_DATA_T g_sdt_info[ZXDH_DEV_CHANNEL_MAX][ZXDH_DEV_SDT_ID_MAX]; > > #define ZXDH_COMM_ASSERT(x) assert(x) > #define ZXDH_SDT_MGR_PTR_GET() (&g_sdt_mgr) > @@ -1497,3 +1498,115 @@ zxdh_np_dtb_table_entry_write(uint32_t dev_id, > > return rc; > } > + > +static uint32_t > +zxdh_np_sdt_tbl_data_get(uint32_t dev_id, uint32_t sdt_no, ZXDH_SDT_TBL_DATA_T *p_sdt_data) > +{ > + uint32_t rc = 0; > + > + p_sdt_data->data_high32 = g_sdt_info[dev_id][sdt_no].data_high32; > + p_sdt_data->data_low32 = g_sdt_info[dev_id][sdt_no].data_low32; > + > + return rc; > +} > + > +int > +zxdh_np_dtb_table_entry_delete(uint32_t dev_id, > + uint32_t queue_id, > + uint32_t entrynum, > + ZXDH_DTB_USER_ENTRY_T *delete_entries) > +{ > + uint32_t rc = 0; > + uint32_t entry_index = 0; > + uint32_t sdt_no = 0; > + uint32_t tbl_type = 0; > + uint32_t element_id = 0xff; > + uint32_t one_dtb_len = 0; > + uint32_t dtb_len = 0; > + uint32_t addr_offset = 0; > + uint32_t max_size = 0; > + uint8_t *p_data_buff = NULL; > + uint8_t *p_data_buff_ex = NULL; > + ZXDH_DTB_LPM_ENTRY_T lpm_entry = {0}; > + > + uint8_t entry_cmd[ZXDH_DTB_TABLE_CMD_SIZE_BIT / 8] = {0}; > + uint8_t entry_data[ZXDH_ETCAM_WIDTH_MAX / 8] = {0}; > + ZXDH_SDT_TBL_DATA_T sdt_tbl = {0}; > + ZXDH_DTB_USER_ENTRY_T *pentry = NULL; > + ZXDH_DTB_ENTRY_T dtb_one_entry = {0}; > + > + ZXDH_COMM_CHECK_POINT(delete_entries); > + > + p_data_buff = (uint8_t *)rte_malloc(NULL, ZXDH_DTB_TABLE_DATA_BUFF_SIZE, 0); cast not needed. > + ZXDH_COMM_CHECK_POINT(p_data_buff); > + memset(p_data_buff, 0, ZXDH_DTB_TABLE_DATA_BUFF_SIZE); If you use rte_calloc() the memset is not needed. > + > + p_data_buff_ex = > + (uint8_t *)rte_malloc(NULL, ZXDH_DTB_TABLE_DATA_BUFF_SIZE * sizeof(uint8_t), 0); cast not needed. > + memset(p_data_buff_ex, 0, ZXDH_DTB_TABLE_DATA_BUFF_SIZE); use rte_calloc instead. > + > + memset((uint8_t *)&lpm_entry, 0x0, sizeof(ZXDH_DTB_LPM_ENTRY_T)); unnecessary, you already initialized this. > + memset((uint8_t *)&dtb_one_entry, 0x0, sizeof(ZXDH_DTB_ENTRY_T)); Also already internalized. > + memset(entry_cmd, 0x0, sizeof(entry_cmd)); > + memset(entry_data, 0x0, sizeof(entry_data)); ditto