From patchwork Tue Jan 30 12:06:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geetha sowjanya X-Patchwork-Id: 194042 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp1171437dyb; Tue, 30 Jan 2024 04:07:43 -0800 (PST) X-Google-Smtp-Source: AGHT+IGSDMoe+/mM5SLk3/IWuQOsU3cT9cNUHSzrSR2NPnyHFTYYcXq3sI2eahO/k2KEPtOaIsmg X-Received: by 2002:a2e:b8cb:0:b0:2cf:34a1:400e with SMTP id s11-20020a2eb8cb000000b002cf34a1400emr6345627ljp.17.1706616463598; Tue, 30 Jan 2024 04:07:43 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706616463; cv=pass; d=google.com; s=arc-20160816; b=JocsoNqBv06a0ZMIxOGd/TY085liwIRhv5q+QnDGYNE+3Ak1tnR7QRDiwx9UefHo4d Z5EDrry4escQBFjI+ZNcFoD6pD7uapAyDwEZlgLAltGDNggGx3UhUwLeZw9hPa9pYrgm Cda5OeEXUDbK2QxpHuuO41L9g6F+uSC1kPp4ZCY2Jf7GfnskwchpJ0Ftvyn81AWGkY5e 0Y8fSmVXtXbV3aTTE65szr2WiiudwG+5zKSB4IE2EKQB0QBkr7aOFg/xYNB1/7eqGzrb QUd2QEZgL0RQ3KsfM9qghWSF/Com7qGSRExr8XZp/IZv9VSIuUii1ggjDO0nkzokl/fd ET0Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :message-id:date:subject:cc:to:from:dkim-signature; bh=62dZ6GBkhNBWzuByxFX6B3fDWKM6s7akNOoK7y5IauE=; fh=YzFMbHUexfL56r49p6Rh5LfBeanY3Y3eAduij19QtL0=; b=VPVLDCl0swlnbrgNWHlXSmB0B0NCzrjD3/wovyoEQQRp/GHBz2grBI/5WEsUPQJ9j0 jrnhHbmoNt2mDyN10A72oFcWJyn1Lej9P2BDfk4oMDg0NWnSk2HuidUjvdeRzHTfOI/T pBM0QCrXqWJA+pwWDbqwEFJ7R+ef40Ta6PqTl2xlWei2oW81ptIeWa0dAeFErf7Abmtq ykBgYtUdvug9IJUdnajKOpP9KXkph2qb5YOj+itksU09J+JahlxAWl2PtI28vTZK+pZj Rylc3kDyemZaDisgRF+1Boh5uzZFzLGLiPjfTJhHf7fLau8xXbhOKzwrDoHYhc0/ONEL BSuA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Rkx4k3O6; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-44576-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44576-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id n22-20020a05640205d600b0055f40305bdesi579877edx.524.2024.01.30.04.07.43 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 04:07:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-44576-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Rkx4k3O6; arc=pass (i=1 spf=pass spfdomain=marvell.com dkim=pass dkdomain=marvell.com dmarc=pass fromdomain=marvell.com); spf=pass (google.com: domain of linux-kernel+bounces-44576-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-44576-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BD1B91F2102E for ; Tue, 30 Jan 2024 12:07:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 295726A010; Tue, 30 Jan 2024 12:06:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b="Rkx4k3O6" Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9CE30679E5; Tue, 30 Jan 2024 12:06:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=67.231.148.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706616416; cv=none; b=fDKyHQ8cZAVNBcNQHK+jZiIaunZJ/p01pVAl4X9odLYHiugRRwfztFTEMyBRDWcTWUequIPIVb+gkWrVb7PHn3uEQtlTB7M0q8a9EzEjIOTOIG0LUzkAjpsjThkB6AqWsQN9AcMkXft2bC9+8s5oZ8wSeY4fZNKyI7OLXWCtuOQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706616416; c=relaxed/simple; bh=adWxji5JCkpeR4Tg54o4IjDz9Q6/P4r5JmGOGBT7y6E=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=CAPHFnqGJdrr0HJQPQyDWKrGIFDJWDHJf5STOY8DYPnRXozuggEJBztsDdzzoA8GRSXKfwaSoh+UApzxJkGnD7Hy9AmK1WH4w9d0MDblKKPiI72mBx7hFA1YlyT5N6bMrXARDoN4vWEvEddD7BmWWim7UFZObL/z2TXraLb1kgs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com; spf=pass smtp.mailfrom=marvell.com; dkim=pass (2048-bit key) header.d=marvell.com header.i=@marvell.com header.b=Rkx4k3O6; arc=none smtp.client-ip=67.231.148.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=marvell.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=marvell.com Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 40UAorfc027107; Tue, 30 Jan 2024 04:06:24 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= from:to:cc:subject:date:message-id:mime-version:content-type; s= pfpt0220; bh=62dZ6GBkhNBWzuByxFX6B3fDWKM6s7akNOoK7y5IauE=; b=Rkx 4k3O66nkmPsiMnpVgijMgB9TTffnq0n875iCkn3usKxsay/j/PjxkibBUYAClpPJ Q98IvxSr5+ghm5Al+M6pFzEDZRSh8yhWfKcZkok9RWEIN9M1znEcT3eoztGjjSyg Jpzjc/Hex5Y2AX3jMgMtCy7ZvmzzUgzlS42CEUK8VOvbUqby97fFDWwxKtpSx9PO w/YX5QItwokG3rZ4jYiMUKpcfkmPhoUboBpHxeX9Z0Qsw9tpBVr9uUFaf1ql7v4F hSkrRuXRMBbTstzCU/Rhowz0HhH27HSIgQXX9cHN62x/q2lUUBD1iBQW7iISGQqw AD4xGS1iIgBYNLO0dfw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3vx4vre4k5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 30 Jan 2024 04:06:23 -0800 (PST) Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 30 Jan 2024 04:06:22 -0800 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 30 Jan 2024 04:06:22 -0800 Received: from hyd1soter3.marvell.com (unknown [10.29.37.12]) by maili.marvell.com (Postfix) with ESMTP id 937CF3F70BD; Tue, 30 Jan 2024 04:06:16 -0800 (PST) From: Geetha sowjanya To: , , CC: , , , , , , , , , , , Subject: [net PATCH] octeontx2-pf: Remove xdp queues on program detach Date: Tue, 30 Jan 2024 17:36:10 +0530 Message-ID: <20240130120610.16673-1-gakula@marvell.com> X-Mailer: git-send-email 2.17.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: VlQYAd3mFYDWfMeXr004MyGsqQWC6c5B X-Proofpoint-GUID: VlQYAd3mFYDWfMeXr004MyGsqQWC6c5B X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-01-30_05,2024-01-30_01,2023-05-22_02 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789517065006122620 X-GMAIL-MSGID: 1789517065006122620 XDP queues are created/destroyed when a XDP program is attached/detached. In current driver xdp_queues are not getting destroyed on program exit due to incorrect xdp_queue and tot_tx_queue count values. This patch fixes the issue by setting tot_tx_queue and xdp_queue count to correct values. It also fixes xdp.data_hard_start address. Fixes: 06059a1a9a4a ("octeontx2-pf: Add XDP support to netdev PF") Signed-off-by: Geetha sowjanya --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 1 - drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 3 +-- drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c | 7 +++---- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c index 2928898c7f8d..7f786de61014 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c @@ -314,7 +314,6 @@ static int otx2_set_channels(struct net_device *dev, pfvf->hw.tx_queues = channel->tx_count; if (pfvf->xdp_prog) pfvf->hw.xdp_queues = channel->rx_count; - pfvf->hw.non_qos_queues = pfvf->hw.tx_queues + pfvf->hw.xdp_queues; if (if_up) err = dev->netdev_ops->ndo_open(dev); diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c index a57455aebff6..e5fe67e73865 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -1744,6 +1744,7 @@ int otx2_open(struct net_device *netdev) /* RQ and SQs are mapped to different CQs, * so find out max CQ IRQs (i.e CINTs) needed. */ + pf->hw.non_qos_queues = pf->hw.tx_queues + pf->hw.xdp_queues; pf->hw.cint_cnt = max3(pf->hw.rx_queues, pf->hw.tx_queues, pf->hw.tc_tx_queues); @@ -2643,8 +2644,6 @@ static int otx2_xdp_setup(struct otx2_nic *pf, struct bpf_prog *prog) xdp_features_clear_redirect_target(dev); } - pf->hw.non_qos_queues += pf->hw.xdp_queues; - if (if_up) otx2_open(pf->netdev); diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c index 4d519ea833b2..f828d32737af 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_txrx.c @@ -1403,7 +1403,7 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf, struct otx2_cq_queue *cq, bool *need_xdp_flush) { - unsigned char *hard_start, *data; + unsigned char *hard_start; int qidx = cq->cq_idx; struct xdp_buff xdp; struct page *page; @@ -1417,9 +1417,8 @@ static bool otx2_xdp_rcv_pkt_handler(struct otx2_nic *pfvf, xdp_init_buff(&xdp, pfvf->rbsize, &cq->xdp_rxq); - data = (unsigned char *)phys_to_virt(pa); - hard_start = page_address(page); - xdp_prepare_buff(&xdp, hard_start, data - hard_start, + hard_start = (unsigned char *)phys_to_virt(pa); + xdp_prepare_buff(&xdp, hard_start, OTX2_HEAD_ROOM, cqe->sg.seg_size, false); act = bpf_prog_run_xdp(prog, &xdp);