From patchwork Fri Dec 8 05:31:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Srujana Challa X-Patchwork-Id: 134946 X-Patchwork-Delegate: maxime.coquelin@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EB3B0436A4; Fri, 8 Dec 2023 06:31:38 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5B3B442FB5; Fri, 8 Dec 2023 06:31:31 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by mails.dpdk.org (Postfix) with ESMTP id 374C4402CD for ; Fri, 8 Dec 2023 06:31:29 +0100 (CET) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3B81KRxA028755; Thu, 7 Dec 2023 21:31:28 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=XGyQmN9EcrlBOYbbLvQgDT9C/IpN1LcedUguX1WbcyM=; b=LgPmlTDFMsGf1rVsEH0wWRj1AUdsxEeIqPjGJiHQJIShIsbP11o2zzlatv34FDOwsr0b cqxqAaSWrwBDVksKmDRjz+iq7Mi2V41RWGs/hJu5UBVjD4aNzKcGe0l0rtpGNBBByIol VKsjoVT0vvK78IkN8WXpBOv3a9EUEDhocuh8gF/X07POW6UG2R2Vt9/I1OumGmjdSMUs kLhrFfaY/hCcej+nTStLBKd8pHyWrn0M2HsKLfBLCKDr74OllFki9DSFIVbfhRkH6QwH YD35pWtqoxhsX0t8TP7fUHROce/A3QrChUVClDDP/dSWErAenr9r1AokMV5h9CVanLbG sQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3uubddbsd2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Thu, 07 Dec 2023 21:31:28 -0800 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Thu, 7 Dec 2023 21:31:26 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Thu, 7 Dec 2023 21:31:26 -0800 Received: from localhost.localdomain (unknown [10.28.36.175]) by maili.marvell.com (Postfix) with ESMTP id BF8453F7055; Thu, 7 Dec 2023 21:31:24 -0800 (PST) From: Srujana Challa To: , , CC: , Subject: [PATCH 2/2] net/virtio-user: add VIRTIO_NET_F_RSS to supported features Date: Fri, 8 Dec 2023 11:01:21 +0530 Message-ID: <20231208053121.152929-2-schalla@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20231208053121.152929-1-schalla@marvell.com> References: <20231208053121.152929-1-schalla@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: AldmreTcxaZbq2Y6rnf_lxb199-NTPWX X-Proofpoint-GUID: AldmreTcxaZbq2Y6rnf_lxb199-NTPWX X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-08_02,2023-12-07_01,2023-05-22_02 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 This patch introduces new function to get rss device config and adds code to forward the RSS control command to backend through hw control queue if RSS feature is negotiated. This patch will help to negotiate VIRTIO_NET_F_RSS feature if vhost-vdpa backend supports RSS in HW. Signed-off-by: Srujana Challa Reviewed-by: Maxime Coquelin --- .../net/virtio/virtio_user/virtio_user_dev.c | 31 ++++++++++++++++++- .../net/virtio/virtio_user/virtio_user_dev.h | 2 ++ drivers/net/virtio/virtio_user_ethdev.c | 3 ++ 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.c b/drivers/net/virtio/virtio_user/virtio_user_dev.c index 578877d089..b0937c9df9 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.c +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.c @@ -304,6 +304,24 @@ virtio_user_dev_init_max_queue_pairs(struct virtio_user_dev *dev, uint32_t user_ return 0; } +int +virtio_user_dev_get_rss_config(struct virtio_user_dev *dev, void *dst, size_t offset, int length) +{ + int ret = 0; + + if (!(dev->device_features & (1ULL << VIRTIO_NET_F_RSS))) + return -ENOTSUP; + + if (!dev->ops->get_config) + return -ENOTSUP; + + ret = dev->ops->get_config(dev, dst, offset, length); + if (ret) + PMD_DRV_LOG(ERR, "(%s) Failed to get rss config in device", dev->path); + + return ret; +} + int virtio_user_dev_set_mac(struct virtio_user_dev *dev) { @@ -687,7 +705,8 @@ virtio_user_free_vrings(struct virtio_user_dev *dev) 1ULL << VIRTIO_F_IN_ORDER | \ 1ULL << VIRTIO_F_VERSION_1 | \ 1ULL << VIRTIO_F_RING_PACKED | \ - 1ULL << VIRTIO_F_NOTIFICATION_DATA) + 1ULL << VIRTIO_F_NOTIFICATION_DATA | \ + 1ULL << VIRTIO_NET_F_RSS) int virtio_user_dev_init(struct virtio_user_dev *dev, char *path, uint16_t queues, @@ -903,6 +922,11 @@ virtio_user_handle_ctrl_msg_split(struct virtio_user_dev *dev, struct vring *vri queues = *(uint16_t *)(uintptr_t)vring->desc[idx_data].addr; status = virtio_user_handle_mq(dev, queues); + } else if (hdr->class == VIRTIO_NET_CTRL_MQ && hdr->cmd == VIRTIO_NET_CTRL_MQ_RSS_CONFIG) { + struct virtio_net_ctrl_rss *rss; + + rss = (struct virtio_net_ctrl_rss *)(uintptr_t)vring->desc[idx_data].addr; + status = virtio_user_handle_mq(dev, rss->max_tx_vq); } else if (hdr->class == VIRTIO_NET_CTRL_RX || hdr->class == VIRTIO_NET_CTRL_MAC || hdr->class == VIRTIO_NET_CTRL_VLAN) { @@ -964,6 +988,11 @@ virtio_user_handle_ctrl_msg_packed(struct virtio_user_dev *dev, queues = *(uint16_t *)(uintptr_t) vring->desc[idx_data].addr; status = virtio_user_handle_mq(dev, queues); + } else if (hdr->class == VIRTIO_NET_CTRL_MQ && hdr->cmd == VIRTIO_NET_CTRL_MQ_RSS_CONFIG) { + struct virtio_net_ctrl_rss *rss; + + rss = (struct virtio_net_ctrl_rss *)(uintptr_t)vring->desc[idx_data].addr; + status = virtio_user_handle_mq(dev, rss->max_tx_vq); } else if (hdr->class == VIRTIO_NET_CTRL_RX || hdr->class == VIRTIO_NET_CTRL_MAC || hdr->class == VIRTIO_NET_CTRL_VLAN) { diff --git a/drivers/net/virtio/virtio_user/virtio_user_dev.h b/drivers/net/virtio/virtio_user/virtio_user_dev.h index 29ec386da5..39b3eec0f2 100644 --- a/drivers/net/virtio/virtio_user/virtio_user_dev.h +++ b/drivers/net/virtio/virtio_user/virtio_user_dev.h @@ -86,6 +86,8 @@ int virtio_user_dev_update_status(struct virtio_user_dev *dev); int virtio_user_dev_update_link_state(struct virtio_user_dev *dev); int virtio_user_dev_set_mac(struct virtio_user_dev *dev); int virtio_user_dev_get_mac(struct virtio_user_dev *dev); +int virtio_user_dev_get_rss_config(struct virtio_user_dev *dev, void *dst, size_t offset, + int length); void virtio_user_dev_delayed_disconnect_handler(void *param); int virtio_user_dev_server_reconnect(struct virtio_user_dev *dev); extern const char * const virtio_user_backend_strings[]; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 241465ecdd..6c10e8f6c0 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -52,6 +52,9 @@ virtio_user_read_dev_config(struct virtio_hw *hw, size_t offset, if (offset == offsetof(struct virtio_net_config, max_virtqueue_pairs)) *(uint16_t *)dst = dev->max_queue_pairs; + + if (offset >= offsetof(struct virtio_net_config, rss_max_key_size)) + virtio_user_dev_get_rss_config(dev, dst, offset, length); } static void