From nobody Sun Feb 8 04:13:10 2026 Received: from mail-pf1-f195.google.com (mail-pf1-f195.google.com [209.85.210.195]) (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 AA72D274FFD for ; Sat, 31 Jan 2026 04:59:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.195 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769835545; cv=none; b=ESsOoG3M2zbPiLe9RCLMRKNKosl+4t2yVhU/WuQnf/P5N8ydQ0Y99CljIMFObPJRlbJnHaaZIZrsmc5YelFoQlbc0q2IeP2ZN1YAPA+VbzaveNHd/G2hxM/UrZky1Da1ihYh/IW8dfvGx6bDYCkcuzXaGFDwbr8jz8UH1unvFww= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769835545; c=relaxed/simple; bh=2GZLRT9z82eo32ajMYil1XWFWbsHS4zIb7d5VQLWge4=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=iINkMEdCdDoJ6E11/oLTfALHIHdCVeqeOlUDxzaPqodhvrOcwcWL7InH1Vw7eGqsxHuLyp3zs0X1uoSHjTDiMlD97f17bjqmugZ8Hi6+QUQUK63/vDNokQQCJeSpBVI29X+WcC3U0L0ICdM2NACVjZp/qpsq8TwHfaR+HBHQJHA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TXer9pxt; arc=none smtp.client-ip=209.85.210.195 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TXer9pxt" Received: by mail-pf1-f195.google.com with SMTP id d2e1a72fcca58-82307c6902eso1352214b3a.3 for ; Fri, 30 Jan 2026 20:59:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769835544; x=1770440344; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=cMHnkDKTQoGZbLCcgZR0yAaHVlDgJD+BWV/gb/Cwzx0=; b=TXer9pxtlXC+UA2R+yBezGuSr4CuQH+WoVOQDeOrVA2O2Wq/VZBrG5pfF0Ujes7SSj Lbv9FFxUI879KPeEy07MYPI1+rZHZor/aQqq1FC8fXOpj1G6tCjyS52HfAvUoHUW/vrg 4F5b6R1onwYP4Mduyjo7EeJtwu9uwojDEYqLmyt/6kgN9FT7RcG8syjfbYxnBLnE5QBv Ol2RUmrDa9fU0uPahWZnd5WkychphciXUcE1OtWfupht4IXTAj5Kf75540hZ8vZFdaLD 7PE5nmoUV5wyb80ckA2I4Rd8cKv8RDEPX/3n9LIWI8UVTNzDDO1ZSWZXCt7EHLjf81Sz utIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769835544; x=1770440344; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=cMHnkDKTQoGZbLCcgZR0yAaHVlDgJD+BWV/gb/Cwzx0=; b=Y6c7dgoQaTaeXJHHVMQ/rfgCfSaElxGFxkUXqbdss+nJdZ6Y1oKhwxQlgN/9SDnnT1 M4HTtKXFC+ex87DTDTD9qrVYUo8W5iCqlPtqqph4O7hNUIUPqkscfX1MZK/AY5nagfWO Td+HKlmmseABcSMLChn89oUnVZ9UhtDFN74MKcxHaP1KqxmnmtujjxjXAmtC9G9Fq75W 4SSoH9kzGSTvEwCLvBkMQhmbBx7fiecEoC2aQse0pVms+LfTIyOrekBhUTXObFCIP+gs re/3A1ytwYjsSVfvniae407idhU1qhHATqJRCIu9PGQLJoDqPX/nJ9TptzNj50BQhwUW Bs3A== X-Forwarded-Encrypted: i=1; AJvYcCWLbGO3hHl4dEYJ7opz1R1/xmoU6yMf9R+wL7tJ6Ju2ihXR1JBERnSu935T1OeubO1eBThz/AJY11+stYE=@vger.kernel.org X-Gm-Message-State: AOJu0Yyd6ogbxUQpalWZ++fyH7GAd99ANPV/3GJBSq7TUExHFjlMlSBu wE96mMtuCNOVnL8FfAEaWiX4xYDp/JII1BUN/QlmUsbtGHP5IbwAEBdf X-Gm-Gg: AZuq6aJzx+YmnHuYtYG9zNX5WAm1iRuRRrMmq4DPEkwxH4NyydW9C082n+E/JxQxY7p uw/dnx1nyOh3dXm9VVM36noLLX+LbuwCcKM/5/2eEQVlMG4cG+h8KipCop1Y3sO4U3kMXT6jJny eETdUpX6JpWX/XfTAhEnDo3aATeI8mHBqUuJDqPZ4XRYiN8fhx1yOXr7IntyMbcUhnQ2sSCvH/F VGsvABSRc/8IpdukKEQdMxsdRLe+K2Y25qinrDorcKoT+hDsa9vxDRHjbI4NHoTYcNuB+oZBgP4 XJ5rWlZDTFVVcgjfELxwwMpxXh0D3tDkZCPIEBARj+q83hqQ5AI0Bx0xrVno8Z+Wvr6+xfgZFdQ yHfF9aIOeoXtobgJuvqvNNJzDJP0GQGKxck1pVDE8eL8s6VX5KijbYjRcGYq8BxVALXxvEuSvjn dBAlUgT1pwJfbcFxPXWHl5OjqhzmUXMU+UNZQ= X-Received: by 2002:a05:6a00:21ce:b0:81f:4e36:38af with SMTP id d2e1a72fcca58-823ab9853f2mr5741246b3a.60.1769835543956; Fri, 30 Jan 2026 20:59:03 -0800 (PST) Received: from d.home.mmyangfl.tk ([2a09:bac1:7680:d30::4:384]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-82379b57fafsm10305245b3a.26.2026.01.30.20.59.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 30 Jan 2026 20:59:03 -0800 (PST) From: David Yang To: netdev@vger.kernel.org Cc: David Yang , Andrew Lunn , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , linux-kernel@vger.kernel.org Subject: [PATCH net-next v2] net: dsa: sync dsa_mall_policer_tc_entry with FLOW_ACTION_POLICE Date: Sat, 31 Jan 2026 12:58:16 +0800 Message-ID: <20260131045821.3451873-1-mmyangfl@gmail.com> X-Mailer: git-send-email 2.51.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" New options were introduced to FLOW_ACTION_POLICE after struct dsa_mall_policer_tc_entry was added. The following commands will succeed on DSA ports: tc qdisc add dev lan1 handle ffff: ingress tc filter add dev lan1 ingress matchall skip_sw action police \ pkts_rate 80000 pkts_burst 100 mtu 1000 conform-exceed ok resulting 1. burst_pkt, rate_pkt_ps, etc. being ignored; 2. burst and rate_bytes_per_sec set to 0 without any error. Among new options, some may be useful to hardware offloading, such as packet rate mode. Instead of making decisions for drivers, extend struct dsa_mall_policer_tc_entry to all options of FLOW_ACTION_POLICE. Drivers should reject unsupported combinations in their .port_policer_add() implementations. We are also aware that .port_policer_add() have been implemented in some DSA drivers - they have already been affected by the above issue (since we didn't conduct any checks on our side). However, it's up to them to decide if options should be checked (which may cause regressions with previously successful configurations), or they are satisfied with the current behavior - if not, they should submit their own patches to fix it. Signed-off-by: David Yang --- v1: https://lore.kernel.org/r/20260126061340.757543-1-mmyangfl@gmail.com - fix DSA core only include/net/dsa.h | 11 +++++++++++ net/dsa/user.c | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/include/net/dsa.h b/include/net/dsa.h index 6b2b5ed64ea4..4c177b168ec8 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -21,6 +21,7 @@ #include #include #include +#include =20 struct dsa_8021q_context; struct tc_action; @@ -220,6 +221,16 @@ struct dsa_mall_mirror_tc_entry { struct dsa_mall_policer_tc_entry { u32 burst; u64 rate_bytes_per_sec; + u64 peakrate_bytes_ps; + u32 avrate; + u16 overhead; + u64 burst_pkt; + u64 rate_pkt_ps; + u32 mtu; + struct { + enum flow_action_id act_id; + u32 extval; + } exceed, notexceed; }; =20 /* TC matchall entry */ diff --git a/net/dsa/user.c b/net/dsa/user.c index f59d66f0975d..2a209b83c701 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -1497,8 +1497,19 @@ dsa_user_add_cls_matchall_police(struct net_device *= dev, mall_tc_entry->cookie =3D cls->cookie; mall_tc_entry->type =3D DSA_PORT_MALL_POLICER; policer =3D &mall_tc_entry->policer; + /* until they export the type of act->police in flow_offload.h ... */ policer->rate_bytes_per_sec =3D act->police.rate_bytes_ps; policer->burst =3D act->police.burst; + policer->peakrate_bytes_ps =3D act->police.peakrate_bytes_ps; + policer->avrate =3D act->police.avrate; + policer->overhead =3D act->police.overhead; + policer->burst_pkt =3D act->police.burst_pkt; + policer->rate_pkt_ps =3D act->police.rate_pkt_ps; + policer->mtu =3D act->police.mtu; + policer->exceed.act_id =3D act->police.exceed.act_id; + policer->exceed.extval =3D act->police.exceed.extval; + policer->notexceed.act_id =3D act->police.notexceed.act_id; + policer->notexceed.extval =3D act->police.notexceed.extval; =20 err =3D ds->ops->port_policer_add(ds, dp->index, policer); if (err) { --=20 2.51.0