From patchwork Sat Dec 23 04:22:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13503914 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qv1-f41.google.com (mail-qv1-f41.google.com [209.85.219.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5E819BA52 for ; Sat, 23 Dec 2023 04:22:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=broadcom.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="OhO6Sh5i" Received: by mail-qv1-f41.google.com with SMTP id 6a1803df08f44-67f9ace0006so5638336d6.0 for ; Fri, 22 Dec 2023 20:22:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1703305375; x=1703910175; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=LHgxlClLedtf/QNWAeWSiDEJFKKyJcNJjwQNrtyL6uY=; b=OhO6Sh5izuWhasWLXjsZBd4pDWrkU2y/TLU7q9bC3z0r4CKGsogFszl1m9SEons3x1 AlrLGMPTotpYwdz0GS3sN9YQGFCrsHQSQXxzNEvZ7jmC6jHY4OYCfDIxs/WALSdazOfV 1OV4RTIhRlaVNNqfcfM008EGHwJfVf2iwXGDc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703305375; x=1703910175; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=LHgxlClLedtf/QNWAeWSiDEJFKKyJcNJjwQNrtyL6uY=; b=egflOnLCIFvougyKe6HklK6N9oiqIM2FxQDzdTSJ2Nz5J+b3w50D08RG5u/sXz3Gk+ MOgHTTcuYESSUrBm7nzYyQkj5HJDz7xGftdg35QhsCqWYM43tTgZNTVVANJmWaAj6Nzf 1glq5jRQHOdakw3fcUhLO4MkUJGxnO6lbShOzRu5XuTcwFrAStWGGCFA4J3iCe6G4MlZ fvIyqb0DTYZ8X2YY2qph9389iOTDjGTRs17bruWdHIGL9l6V9XoQYlt7WSbjhwDGB/Te qTg4BIsWaEWW+5grYo16QOTlfwLRQtj+RyvaX9iJ3a3mz7ev+xHf1sj8TqEI3X3KWmZC omUg== X-Gm-Message-State: AOJu0YxzuU2SCa5vqgqL3xzKG55APY+MSdvHIa6Fm7S9Dry3RIfkoTSo LrpjwGouFI661ao0PsaIGhnkaH81MgzK X-Google-Smtp-Source: AGHT+IHJpjjSEhIRG6RNJXQuOTeTUEv9iIM++AFU8G+Z+U+J+KZA2H/NDDP27qjasORPieWynClpCw== X-Received: by 2002:a05:6214:14ae:b0:67f:ad87:70b with SMTP id bo14-20020a05621414ae00b0067fad87070bmr615068qvb.95.1703305375162; Fri, 22 Dec 2023 20:22:55 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id ek5-20020ad45985000000b0067f8046a1acsm1299916qvb.144.2023.12.22.20.22.54 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Dec 2023 20:22:54 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, pavan.chebbi@broadcom.com, andrew.gospodarek@broadcom.com Subject: [PATCH net-next v2 13/13] bnxt_en: Add support for ntuple filter deletion by ethtool. Date: Fri, 22 Dec 2023 20:22:10 -0800 Message-Id: <20231223042210.102485-14-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231223042210.102485-1-michael.chan@broadcom.com> References: <20231223042210.102485-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Add logic to delete a user specified ntuple filter from ethtool. Reviewed-by: Vasundhara Volam Reviewed-by: Andy Gospodarek Reviewed-by: Pavan Chebbi Signed-off-by: Michael Chan --- .../net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index c3b9be328b87..5629ba9f4b2e 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -1341,6 +1341,31 @@ static int bnxt_srxclsrlins(struct bnxt *bp, struct ethtool_rxnfc *cmd) return rc; } +static int bnxt_srxclsrldel(struct bnxt *bp, struct ethtool_rxnfc *cmd) +{ + struct ethtool_rx_flow_spec *fs = &cmd->fs; + struct bnxt_filter_base *fltr_base; + + rcu_read_lock(); + fltr_base = bnxt_get_one_fltr_rcu(bp, bp->ntp_fltr_hash_tbl, + BNXT_NTP_FLTR_HASH_SIZE, + fs->location); + if (fltr_base) { + struct bnxt_ntuple_filter *fltr; + + fltr = container_of(fltr_base, struct bnxt_ntuple_filter, base); + rcu_read_unlock(); + if (!(fltr->base.flags & BNXT_ACT_NO_AGING)) + return -EINVAL; + bnxt_hwrm_cfa_ntuple_filter_free(bp, fltr); + bnxt_del_ntp_filter(bp, fltr); + return 0; + } + + rcu_read_unlock(); + return -ENOENT; +} + static u64 get_ethtool_ipv4_rss(struct bnxt *bp) { if (bp->rss_hash_cfg & VNIC_RSS_CFG_REQ_HASH_TYPE_IPV4) @@ -1532,6 +1557,10 @@ static int bnxt_set_rxnfc(struct net_device *dev, struct ethtool_rxnfc *cmd) rc = bnxt_srxclsrlins(bp, cmd); break; + case ETHTOOL_SRXCLSRLDEL: + rc = bnxt_srxclsrldel(bp, cmd); + break; + default: rc = -EOPNOTSUPP; break;