From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796127534; b=pweB/6H1MhBdpRIgqxNe+i9/sLoYpsubX3Mh9Nv9XI17WgMXdGDxAPCZc5qrYSJxSD71 B31FDx19zSKs0OsYLojgIABpNJ015WyeUI9iPBKzvOov/eqsncvU4ffkin79Xb/v2AXSh lw9KjjzpgqDKhW2of3vAUtaR8+2YdCip/p5uUGOcR3vfoH0xZu08obwlTiJQzWl0iQAT3 Pp6VcMDIWXtXVPxIJ8GuJV5v8jBhLO8uHLnkTSIJxDPXtKN3YVbcOHqEXMD6kiYZ3HI9U vs0sEwze+a4wlKivG5D7thnu/7rVNxqvlxdmdF+9T506WUWH1N2pONP40Cgc0LNrSnw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796127534; h=DMARC-Filter:DKIM-Signature:Received:X-MC-Unique: X-Mimecast-MFC-AGG-ID:Received:DKIM-Signature:X-Google-DKIM-Signature: X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received: X-Received:Received:Message-ID:Date:MIME-Version:User-Agent:Subject: To:Cc:References:Content-Language:From:In-Reply-To:Content-Type: Content-Transfer-Encoding; bh=kaCWkPSegj+y4F7N9muT5kiKkv5yHGCsnte3MKCiHsQ=; b=v3/a6BtrqGGcTB3ueBmPuFT246GIwJ7Onlgos90n/2IHFrsOOuNj5AfBzN/vEgE+KPy/ 3C1cmYUSz4TUCbiqcfHamBTSi31i9mjHQGwYDD1MtUFtDmHxPfyff4feln+1gxOyTj3QD cixMXxp9knO8Ops6j8QBI8qnsU6kH3BvOLI2Ah/sF6kUkRiez0nFRBv8/yFsHmJ1O2ty2 Bi9vB7Pm2AN5BHRP1pEB0nnRL/OSpYwj5bxvlGEQxEyu2FTeZzcpgGwuccA+TWAH/RR6k P72+aI5QSd91YeyzVUXBeLzYc/t3X7fG7C/EDWzbXHtdBZqS/xmeiOimTM6PA1mWTpA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=K8SBNbLR; dkim=pass header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=T1mwx07a; arc=none smtp.remote-ip=170.10.129.124 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E6463606A31A for ; Tue, 1 Dec 2026 12:18:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org E6463606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=K8SBNbLR; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=google header.b=T1mwx07a DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1796127533; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=kaCWkPSegj+y4F7N9muT5kiKkv5yHGCsnte3MKCiHsQ=; b=K8SBNbLRPaqjDBU1ASystY6TZJZWkWNptUCpt2NRRhKOPpgoZa31LDexsnhkzqYdyUj6cn qGwE1rrz27FHBtgFTdNwF/zDhnTIA9xJgoJDo0OCWnnGj3a5hCLvqXQ2ge5dmU3yUQ5kyg 4JKIfPnBDkZRDZXCUI6Cdfacd9QiKmU= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-621-sFnUepn1Pcqhmq5HT7tDFw-1; Tue, 1 Dec 2026 12:18:51 +0000 X-MC-Unique: sFnUepn1Pcqhmq5HT7tDFw-1 X-Mimecast-MFC-AGG-ID: sFnUepn1Pcqhmq5HT7tDFw_1796127530 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-49953abe51fso84342115e9.1 for ; Tue, 01 Dec 2026 04:18:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1796127530; x=1796732330; darn=vger.kernel.org; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:from:to:cc:subject:date:message-id:reply-to :content-type; bh=kaCWkPSegj+y4F7N9muT5kiKkv5yHGCsnte3MKCiHsQ=; b=T1mwx07aseDl0ZPQzDOu7Gofgqzx4A5bpdth89DXCmSe2SARjMpFbsIA2SPksnq8bH IuVLlQpQ4s8AKbrNnPs9oVTPuBL1oLqezs6lMMHAybePePsfWbPY+87K9VveFz5A7WHb QZwtbn5QlMIcv062SSRzalgfOObAcX5h82w6oXg05owwoXM2PFxlwGZ08b19YVutZCvS dlzdPplYgbF0Tj0T1iLnr6Ocekyd9CMVckjUvfEOyipQZLfqBua298jbxZLCI7hSCkzD UIuqQlRZ/icPBt+w4aniaMXOdMh2S11HC1Hy3Xmf2kN6sbxJZ6MyL3nTW7ihyISPM1cM 890Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796127530; x=1796732330; h=content-transfer-encoding:content-type:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=kaCWkPSegj+y4F7N9muT5kiKkv5yHGCsnte3MKCiHsQ=; b=J3mJw+OmPNHH0IlQnngFv1jMzKowUNFVeTg5N/4NAmP14Cd2KzLK8uVAUnUiOohDiD paqDkZdi5pH5xsAUsYnORxo9PquO6lio/wg7xToORxhqZv6fViF5H3hs6xxnc5VoJDd2 aO6nnYjUay9pus0BHN7J/tQMx9QvTUhQKfu6CqjHXvALwT9xw+K25ozIrOsvDLyyaqgX Pt4UppIfbbJ8w4GZN2d7F2+Z6t2CclJH82LLmLTH6OuA9XyDik8D/vv1AUY60TsvTXbY qTsvxd4EWTqrxQEj0E4WH33YPd5rebAsOrftwty4LMXuMP5lS5Piw35OcWv7KLAD/LAK FTVg== X-Forwarded-Encrypted: i=1; AL+hErGaFDKAfgKjeXV+udekIEfCzyo8u/1L1IkZMovJEsfHCPIYX+zdThljCNdaiF1DeHdVStR4bSA=@vger.kernel.org X-Gm-Message-State: APuU4Z/YseVDp5corJRcOew+o24py5JSLf8FPXcdMw867AMijL0hj22D ntQ62adFHMhn9YutVKBI7kWHMPAumGpXqhOBhxcMjaykE9HWyq8z3MWbPfdHAUB503mstw6i55w wlntY70RcMGRJIsb//EWM9bWotAOQro+9L7rFaP89iW+k4/yKLec3Cn13yA== X-Gm-Gg: AZFdTZfftpH1h15IjyUgzhe4xmR7rtKwus93xoXVGjzC5+UKsVQXGVxrO5azKFdIWU+ PYVrXnGUsic0+ADozAFFdVuz6esFtvuKDlx5L/3nsYEWvaTJiYjCjnJKynjGKSFL2JAvR/nLvIX 9uXfesZZAKQ8qQ7Lu9lTAskMePnUY/8yzSMnx9VdbkCAjT0nKLfhl+n3nEBgaGcMvGJ2Lnvcy+M sGlV39RYBaEzjlPRa3qEAc8IY7VZoHcxipkxCsi67ngEaxfFNB+aUQIfrDTCQcc2T6eTcVKy3n1 WQL+of0MDBXUvMbtSWSzM4KexoitVoXIV4vJF6uKIKTLcwkMkzNtRSLhdQVgyjgIi3c4wCM+ZI5 hxuGrIAyZmpIrji2r4F71LNgbmzcUB7BUPMb+R/jV4gvmi7CRe2G7F97080jLYCzXMYdI2XnpY9 FkfUS86yZ2VQDlNMCDZdfz6k4HxObNprfqf5AMQ5xQfF0= X-Received: by 2002:a05:600c:3b98:b0:4bb:7033:c92f with SMTP id 5b1f17b1804b1-4bb88826810mr730169165e9.11.1796127530074; Tue, 01 Dec 2026 04:18:50 -0800 (PST) X-Received: by 2002:a05:600c:3b98:b0:4bb:7033:c92f with SMTP id 5b1f17b1804b1-4bb88826810mr730168595e9.11.1796127529677; Tue, 01 Dec 2026 04:18:49 -0800 (PST) Received: from [192.168.88.30] (ip231-128-192-82.pool-bba.aruba.it. [82.192.128.231]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bba6a0d65fsm531105825e9.3.2026.12.01.04.18.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 01 Dec 2026 04:18:49 -0800 (PST) Message-ID: Date: Tue, 1 Dec 2026 13:18:48 +0100 X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH net-next v3] net: mlx5: Allow police as the last action of a TC rule To: Mohsin Bashir , netdev@vger.kernel.org Cc: saeedm@nvidia.com, leon@kernel.org, tariqt@nvidia.com, mbloch@nvidia.com, cjubran@nvidia.com, andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org References: <20261124220251.776944-1-mohsin.bashr@gmail.com> Content-Language: en-US From: Paolo Abeni In-Reply-To: <20261124220251.776944-1-mohsin.bashr@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 11/24/26 23:02, Mohsin Bashir wrote: > From: Mohsin Bashir > > In switchdev mode, mlx5 does not offload a rule where police is the last > action, although TC needs no other action for such a rule. The upcoming > selftest series relies on these rules. With nothing after police, the > police result alone decides where the packet goes, so each result must > be offloaded as TC executes it. The driver does not do that today. An ok > result is handled as pipe and runs the actions after police, a pipe > result always returns to the post action table, and a jump is counted > from police while TC counts it from the start of the action list. A rate > police is also rejected by verify_attr_actions(), as its forward to the > post meter table is added only after the check. > > Make the offloaded rule behave as it does in TC. An ok result ends > processing in TC. A pipe result does the same when police is the last > action. Send both to the end of the TC chains as the driver already does > for gact ok. For jump, offload only the simple case where police is the > first action and the skipped actions are all drop or all ok. Reject the > rest. Existing rules where police is followed by other actions also > change. An ok result now accepts the packet instead of running those > actions. Finally set the forward to the post meter table while parsing > police. This is already done for police with mtu and lets a police-only > rule pass verify_attr_actions(). > > Tested on a ConnectX-7 in switchdev mode with the commands below. The > hardware drop counter showed that the rules are offloaded and limit the > traffic to the configured rate, that the second police only sees the > packets conforming to the first, and that the jump lands on its target. > > tc filter add dev eth0 ingress pref 100 protocol ipv6 flower skip_sw \ > ip_proto udp dst_port 5201 \ > action police rate 100mbit burst 1m conform-exceed drop/ok > > tc filter add dev eth0 ingress pref 100 protocol ipv6 flower skip_sw \ > ip_proto udp dst_port 5201 \ > action police rate 200mbit burst 1m conform-exceed drop/pipe \ > action police rate 100mbit burst 1m conform-exceed drop/pipe > > tc filter add dev eth0 ingress pref 100 protocol ipv6 flower skip_sw \ > ip_proto udp dst_port 5201 \ > action police rate 100mbit burst 1m conform-exceed drop / jump 2 \ > action drop action ok > > Cc: Carolina Jubran > Signed-off-by: Mohsin Bashir @nvidia: could you please TAL here? Thanks, Paolo