From patchwork Thu Dec 21 22:02:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13502692 X-Patchwork-Delegate: kuba@kernel.org Received: from mail-qk1-f170.google.com (mail-qk1-f170.google.com [209.85.222.170]) (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 3578B7A205 for ; Thu, 21 Dec 2023 22:03:20 +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="aWiWdbo2" Received: by mail-qk1-f170.google.com with SMTP id af79cd13be357-7810992c613so81472585a.3 for ; Thu, 21 Dec 2023 14:03:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1703196199; x=1703800999; 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=Z5uRC8bnUvDVa0t8rvfSjCphvlOfI1peagxByKvpw9s=; b=aWiWdbo23EH0u5O+Bhx4ROtO0vat0nsJnIC/bHwnU7cZkp2aXiuq5HUlQWyWbykOYL Czv0uzUaTcH9Z5OvnG7q/1ddojdRXTsIbHEkpczcPp5aRV/qsrh6ZfwOw7ef09G+UgYY i+E07bpgatWM+zOhQd9fBVwJI+jBrfz9OPqtk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1703196199; x=1703800999; 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=Z5uRC8bnUvDVa0t8rvfSjCphvlOfI1peagxByKvpw9s=; b=sPcHGpxoB2VJN53srm0Q4r+iGir8BFlFQWblvGL2KLC8JIgxCazy2HGAiAqZWkhuvO 9WnUqOq+3yiO7zwUlpZoiK7z4BPQ9L8PN65P/ir6caXrYgLd0A+5CQBn7Mm26Zp6CE1f QKV1QyjOSVu/KWRHxvZau+0mIQK3UKaWqOyQW8OeO8l/Mi/9TfOSk6d3jBefLSQSOlg/ 8I6OLM+LE9rIqBcVMrEjoPch86DME1v+7M0l0oU2G+RaHP4wbt9UssksH2gNjiBobhf+ C312kZAwKYqlHjSDCW43ZdaHv83YeJmIUsQxPCVlauXPOTCR8JfY+14UyRNLAGyPfrTt vExw== X-Gm-Message-State: AOJu0YxOL9WOh2xk7slDfIy75Mmh2FnDevOxwLPifPZ2IfyNGBDQoDpp IFQ0r/WK3wzw7zJm1AkY78XyCH07qjdK X-Google-Smtp-Source: AGHT+IFZgxLZFkZV15Zbuap8LD5ogenXLhWU3Ek18cjOD56EuGmImVzSMQECo1+m0wRLlPF1hcTNvQ== X-Received: by 2002:a05:6214:769:b0:67f:8ce3:cb2 with SMTP id f9-20020a056214076900b0067f8ce30cb2mr454353qvz.118.1703196198713; Thu, 21 Dec 2023 14:03:18 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id ee14-20020a0562140a4e00b0067f712874fbsm905198qvb.129.2023.12.21.14.03.16 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Dec 2023 14:03:17 -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 13/13] bnxt_en: Add support for ntuple filter deletion by ethtool. Date: Thu, 21 Dec 2023 14:02:18 -0800 Message-Id: <20231221220218.197386-14-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231221220218.197386-1-michael.chan@broadcom.com> References: <20231221220218.197386-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 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;