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 730C045FD9; Fri, 3 Jan 2025 20:14:35 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0C722402DC; Fri, 3 Jan 2025 20:14:35 +0100 (CET) Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by mails.dpdk.org (Postfix) with ESMTP id 7DB15402B1 for ; Fri, 3 Jan 2025 20:14:33 +0100 (CET) Received: by mail-qk1-f173.google.com with SMTP id af79cd13be357-7b7041273ddso896212985a.3 for ; Fri, 03 Jan 2025 11:14:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1735931673; x=1736536473; 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=zxwA2YMhpcqk3gtVEcGa9B6MDPX66aFAik46bpOoqiQ=; b=1gd496S9uLHkhQyEM3gj9Yo3TDhmCsQvDUE0hHpZ4mdYconlyBprD/nnIoUt8bmOPb 2Sb9Em6HBAC6arXBTMzuk3csFMo34SAO1w68AmVQnWwQQQDYVcPTsB/A8ePNUOfi24oq gycyKxOUJJic9B9yvxVDD+OlvoL2McSdp0mMDEDgR/rt+Q+PtOayoK98ZyyYlkFtd8J3 ndk3XYtwWQbY3d5V7chO9ZGb9TORxjGyKUJLgt+ePkjvxAxEx10AHBi7oKkoOtd8eYcM WemK1URrTMmjiNtP0QlyZCdimH2zsF7D0ZOLi3OQBuXMUkpv2El2N+MN9wNbS7x7OsIR YHDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735931673; x=1736536473; 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=zxwA2YMhpcqk3gtVEcGa9B6MDPX66aFAik46bpOoqiQ=; b=OgI6vcBDOVEO15XspkCZnfNkyY9CwdtruaPkx46SNqhYSuwhTXhqA4QPiwmvD4gOqj v8RGCYhyy4jkri8+zvOgewpYRz/IM3Rv44cb/UDakvAHxEoyeGdBsIN1PDzh81af94q1 Nw+TbXXhSMQO9V0+TFtQXxa691Ys4F9CIYdFfPdl/qTH1895JEVGadaTF9OUaV9HbQ0t rr3QeQESBGoEvGqXgeu2cfBWzw1g4Vjta0BlkrnBYpuTvXHzEnJnYtcFWTo30X5/9GL+ zDHE4tchIStU8QJOMJmt7bBwn6mrEggLTFDo4Z8C+o0XS2SQ4FW0Ve6fY29xWMv6E2uN T76Q== X-Gm-Message-State: AOJu0YyIebO4IFVDwGEa8d6A2+hKTTW5JSInYsvcDl8YcbOC61FMAu66 s/KuABsQFHmDumZAMEnuTUkILlj/+u7dTQkg03vuvdn0qT2WLetUupw03VzrXl4= X-Gm-Gg: ASbGncsrvdk4L/BO1s/BuRJkjDyErJQK2LsWOPO9a4opV7GSZc3/qiABOJPTMfsXgoQ 5IAnuz6IEvR4uiQiVBeJgDpwAl5Y7SdMsc2a8+DBi1FtrlCgkeqa44FB0OxXpIW/Goz5zDKBH6J IqL2EhjxRq7Qtf8ocr1YW9ZZZA56Tq2HbCO2AntI+FomY5OZFk2sWNA1s+MSa0zoyjXvd0lJbDI 084D1FWK2QfL3w4rtu2C2c1O4EzrDLnSorxetV33xxqP0+m6FsT+VTFPt6OgRQLpFCtpLf6XFYU R0cPJuIH X-Google-Smtp-Source: AGHT+IE3vmQ8kwLCUYw5v1tSKDWYV3fmp4GUJgdBsPYp0TiiRjsfN5+JWvao1lf9JnzvkzFoo7sLRA== X-Received: by 2002:a05:6214:260b:b0:6dc:d101:2baf with SMTP id 6a1803df08f44-6dd2332d04emr849618436d6.17.1735931672812; Fri, 03 Jan 2025 11:14:32 -0800 (PST) Received: from pi5 (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6dd18134babsm142166936d6.53.2025.01.03.11.14.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jan 2025 11:14:32 -0800 (PST) Date: Fri, 3 Jan 2025 11:14:28 -0800 From: Stephen Hemminger To: "WanRenyong" Cc: , , , , , , , , , Subject: Re: [PATCH v4 07/15] net/xsc: add ethdev configure and RSS ops Message-ID: <20250103111428.36035eaa@pi5> In-Reply-To: <20250103150418.1529663-8-wanry@yunsilicon.com> References: <20250103150404.1529663-1-wanry@yunsilicon.com> <20250103150418.1529663-8-wanry@yunsilicon.com> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; aarch64-unknown-linux-gnu) 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 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(). > +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(). > +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().