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 11D8C45FF7; Mon, 6 Jan 2025 03:20:39 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A767F40654; Mon, 6 Jan 2025 03:20:38 +0100 (CET) Received: from lf-2-51.ptr.blmpb.com (lf-2-51.ptr.blmpb.com [101.36.218.51]) by mails.dpdk.org (Postfix) with ESMTP id 6C1164014F for ; Mon, 6 Jan 2025 03:20:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=feishu2403070942; d=yunsilicon.com; t=1736130030; h=from:subject: mime-version:from:date:message-id:subject:to:cc:reply-to:content-type: mime-version:in-reply-to:message-id; bh=YyuVsNBwa0IAETZyAntQSzNiZ9WgiZIsFK3Xv1+bV6A=; b=BTvMumAmMGAZJXoD4q3yxHpENwKykrxsWSi66T3DM3id2yRgXQZbwkjuTzJ3Ei+AX2aRuK us4/80KLFk5f4314KiAXdMW1cFnttfQvJiUdtpLMcs10F8wo1NoQiXz7ION6uqTcpVeVP8 dKshwUq8HE7Ta5oWON+ouwzpuUKrShlS/dPXuEB3ihWcOzSxLFJCOx7Yt/AA9T2Fz8eDP3 XRDqapEXi/BCrDpCMGTM30XYVcgYcjeyVAvp6iOZD0NMcLcETz9QB0aTS/pA15v7HlG99H uyeuG0aPQceTjW+cx65GipQt2lECSEYe5y2KBYu9/EzMa9mjB2rRnibGpd2lJQ== To: "Stephen Hemminger" Cc: , , , , , , , , Message-Id: <7c9193d1-40ca-42c8-923d-90ae75131330@yunsilicon.com> Mime-Version: 1.0 Date: Mon, 6 Jan 2025 10:20:29 +0800 In-Reply-To: <20250103111428.36035eaa@pi5> Received: from [127.0.0.1] ([116.231.104.97]) by smtp.feishu.cn with ESMTPS; Mon, 06 Jan 2025 10:20:27 +0800 References: <20250103150404.1529663-1-wanry@yunsilicon.com> <20250103150418.1529663-8-wanry@yunsilicon.com> <20250103111428.36035eaa@pi5> X-Original-From: WanRenyong User-Agent: Mozilla Thunderbird From: "WanRenyong" Subject: Re: [PATCH v4 07/15] net/xsc: add ethdev configure and RSS ops Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=UTF-8 X-Lms-Return-Path: 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 2025/1/4 3:14, Stephen Hemminger wrote: > On Fri, 03 Jan 2025 23:04:19 +0800 > "WanRenyong" wrote: > >> +static int >> +xsc_ethdev_rss_hash_conf_get(struct rte_eth_dev *dev, >> + struct rte_eth_rss_conf *rss_conf) >> +{ >> + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev); >> + >> + if (!rss_conf) { >> + rte_errno = EINVAL; >> + return -rte_errno; >> + } > The parameter rss_conf is already checked for null in rte_eth_dev_rss_hash_conf_get(). will remove rss_conf check in the next version. > >> +static int >> +xsc_ethdev_rss_hash_update(struct rte_eth_dev *dev, >> + struct rte_eth_rss_conf *rss_conf) >> +{ >> + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev); >> + int ret = 0; >> + >> + if (rss_conf->rss_key_len > XSC_RSS_HASH_KEY_LEN || rss_conf->rss_key == NULL) { >> + PMD_DRV_LOG(ERR, "Xsc pmd key len is %d bigger than %d", >> + rss_conf->rss_key_len, XSC_RSS_HASH_KEY_LEN); >> + return -EINVAL; >> + } > Key length is already validated against value returned from dev_info.hash_key_size before > this is called by rte_eth_dev_rss_hash_update(). will remove the key length validation in the next version. >> +static int >> +xsc_ethdev_configure(struct rte_eth_dev *dev) >> +{ >> + struct xsc_ethdev_priv *priv = TO_XSC_ETHDEV_PRIV(dev); >> + struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode; >> + int ret; >> + struct rte_eth_rss_conf *rss_conf; >> + >> + priv->num_sq = dev->data->nb_tx_queues; >> + priv->num_rq = dev->data->nb_rx_queues; >> + >> + if (dev->data->dev_conf.rxmode.mq_mode & RTE_ETH_MQ_RX_RSS_FLAG) >> + dev->data->dev_conf.rxmode.offloads |= RTE_ETH_RX_OFFLOAD_RSS_HASH; >> + >> + if (priv->rss_conf.rss_key == NULL) { >> + priv->rss_conf.rss_key = rte_zmalloc(NULL, XSC_RSS_HASH_KEY_LEN, >> + RTE_CACHE_LINE_SIZE); >> + if (priv->rss_conf.rss_key == NULL) { >> + PMD_DRV_LOG(ERR, "Failed to alloc rss key"); >> + rte_errno = ENOMEM; >> + ret = -rte_errno; >> + goto error; >> + } >> + priv->rss_conf.rss_key_len = XSC_RSS_HASH_KEY_LEN; >> + } >> + >> + if (dev->data->dev_conf.rx_adv_conf.rss_conf.rss_key != NULL) { >> + rss_conf = &dev->data->dev_conf.rx_adv_conf.rss_conf; >> + ret = xsc_ethdev_rss_hash_update(dev, rss_conf); >> + if (ret != 0) { >> + PMD_DRV_LOG(ERR, "Xsc pmd set rss key error!"); >> + rte_errno = -ENOEXEC; >> + goto error; >> + } >> + } >> + >> + if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_FILTER) { >> + PMD_DRV_LOG(ERR, "Xsc pmd do not support vlan filter now!"); >> + rte_errno = EINVAL; >> + goto error; >> + } >> + >> + if (rxmode->offloads & RTE_ETH_RX_OFFLOAD_VLAN_STRIP) { >> + PMD_DRV_LOG(ERR, "Xsc pmd do not support vlan strip now!"); >> + rte_errno = EINVAL; >> + goto error; >> + } > These offload flags are already validated against rx_offload_capa by rte_eth_dev_configure(). will remove these offload flags validation in the next version. > > -- Thanks, WanRenyong