From nobody Sun Feb 8 14:10:53 2026 Received: from mail-pl1-f193.google.com (mail-pl1-f193.google.com [209.85.214.193]) (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 E4826261B9B for ; Mon, 26 Jan 2026 06:15:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.193 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769408119; cv=none; b=eJxw8K9OJIlmIH9cPn8+LsPaHU8ZptRwRUjGuZqn8/XZJTfOwUyOl1Wgt1NAdDYF3ef/bKuT8O7MprVSa296oEBL7i8W1wn0E+opFEEAkVH73RG5hp4/II5ATmndn8rsIrorb5sk6C/d1rMu8lFpf3H/rAkpbXGbdCO8H8QQwoo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1769408119; c=relaxed/simple; bh=eK9IEQxX6bPuQTZmqf3fBzqSi3lRKs7tjHBkjQMOx5I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=b+hXuXZEd4cWXRjdFQgss3mYJMzJUGu4AZS6SIfgHgU4xfcSkguXKDf6shFInwh1QIq+U3iyWiZPC6h3o6O9gToLyIN1fU8rlR0+H0GpW6gLj/q3H68afZeGDA10Rsqv7vSsOqMSjgQgsHza10YsmS2xn6Q3VfM0jwkvfRZOlto= 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=QqZdU/DI; arc=none smtp.client-ip=209.85.214.193 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="QqZdU/DI" Received: by mail-pl1-f193.google.com with SMTP id d9443c01a7336-2a0a95200e8so26624415ad.0 for ; Sun, 25 Jan 2026 22:15:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1769408117; x=1770012917; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=p1BtHozxghZJqgMzo9JEMTRARSx5nNU/9Ls9XrihPew=; b=QqZdU/DIoAP32fY2NRBhsdfz0TayJ1RcDDiy4CmVKklVPK9M78lCRZcp82GNyzym2M 2zwCuwr5PSst3QfKHcjXGNZ+YjGSwnmEww5Ha+snvGV3j4tO0noncCrS1HtrkHh6S/Gu tNwWb5t57VU2O0cEzW8uxUVR8MbbbUbxJBH8IhIGYcu4vWf+VnaOg2H6BaAkxLcDchP+ Puc2KWBZmz1uLU3KC7QQODZ/4CEfnHP0wgiW34bwofI/ktVoqAaVzauLBdlwcD97eNoz UG4hSQoCnFDaMY8cp6CV4MuWMA0oliqOExme/Qv7WUvAawHl6kTlvrLnJqFX2P/mapN8 Cb1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1769408117; x=1770012917; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=p1BtHozxghZJqgMzo9JEMTRARSx5nNU/9Ls9XrihPew=; b=R4p4ZQlXM30Ze2DTdWO+oPo8ui2e6kGJ9t1+TP5JRdz8DyoivaRNjqY3DXSwAIsto3 JztSCHRPV7Ltt0+u4uXpWfnE4FYhX2lKzX4u4ZpfJfs+NPrbsOYsjjXyl+KumY9bCGCm DsY+mmjVQjE20qvFYfwnYwFs1w0yJea1H1QCDAmh1dD8KJQSTjZj/Qilk+VX4tc/Oo2w S+hm4AlbKEpk/4lzctJbwfRgjgH6gFo5KKOWzzZS9xlE/qO9h95qTzXj4VDGrjE6SPEk 8Vbo+h6K6nYIO9PUY8GpufmSsObgyU3d7DITpxc+NxBd+D/xrgsQqW2E98v19L9AiTzc lSOA== X-Forwarded-Encrypted: i=1; AJvYcCVOTRGUwtk5t7Ki0FeFuDs/rhPGwxmKKAihLLX/0NNpE849KZb5tI0sq2RMLDbqwsZ+Ono/07G1ehiRCS8=@vger.kernel.org X-Gm-Message-State: AOJu0YwjC0YQSNqSt6y4/eOkJuZwGq4bQie1ngJmTmA3gWtfimzmb9+G YJC0qupns9VyAJrCz4YUn5UrImjkGbcfzDtkFFPuqfLa0EDOJZSAY5+Y X-Gm-Gg: AZuq6aJGEyCvDE9NTIopk0q4cxbYwBqslvtW98ITl//8sFmv+ygMvEnRueMLDE8R4Yv 5522l9WWDgJM8ihZJ4iQh1N4AEjYug8OlESxe+3X4wqRMcgE+GdFmyAlyL456J7ZjDkIFlSQgCs FXJne73Siesu+co9rfzFqni191+zL4jOxNbf5pk1mpNamAIwo15eS1JpOHggplXMKfPXSXtBUFJ dpYosWXRhyPr4zs/J2dSOzaHekscnZnmAkgjIeGfzlC6q1f89RqMZFp9sYjGuCiJSfr6Ip8tJwB gXSaIjbakslyxAjMv9OTYqwTs2u76R2dIpjn75A+Du2yu1rFi45RndNu64noqnDynkMbitnUY2j sixiIozHCrDyPlPezJQd/kOUNOG7gIlQonrjLPE7cNz54foqSK9n9K+8EcKLTYf33niYI5UTRxl O52i+B00eP61BDD2artTFbSGfRWOus5YUInGMrUKQ0ZHNsNdMvgYyWRgTwWkQRZ/rm X-Received: by 2002:a17:902:d58b:b0:2a1:e19:ff0 with SMTP id d9443c01a7336-2a8452b2031mr32575335ad.39.1769408117209; Sun, 25 Jan 2026 22:15:17 -0800 (PST) Received: from d.home.mmyangfl.tk ([2001:19f0:8001:1644:5400:5ff:fe3e:12b1]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2a802ede745sm79477325ad.44.2026.01.25.22.15.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Jan 2026 22:15:16 -0800 (PST) From: David Yang To: netdev@vger.kernel.org Cc: David Yang , Vladimir Oltean , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Andrew Lunn , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Simon Horman , Russell King , linux-kernel@vger.kernel.org Subject: [PATCH net-next 1/3] net: dsa: sync dsa_mall_policer_tc_entry with FLOW_ACTION_POLICE Date: Mon, 26 Jan 2026 14:13:29 +0800 Message-ID: <20260126061340.757543-2-mmyangfl@gmail.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260126061340.757543-1-mmyangfl@gmail.com> References: <20260126061340.757543-1-mmyangfl@gmail.com> 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. Instead of making decisions for drivers, extend struct dsa_mall_policer_tc_entry to all options for FLOW_ACTION_POLICE in favor of full functionalities, such as packet rate mode. Drivers must reject unsupported combinations. Signed-off-by: David Yang --- include/net/dsa.h | 11 +++++++++++ net/dsa/user.c | 7 +++++-- 2 files changed, 16 insertions(+), 2 deletions(-) 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..4c9cff629d5c 100644 --- a/net/dsa/user.c +++ b/net/dsa/user.c @@ -1497,8 +1497,11 @@ 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; - policer->rate_bytes_per_sec =3D act->police.rate_bytes_ps; - policer->burst =3D act->police.burst; + /* so sad, flow_offload.h did not export the type of act->police, and + * it's a nightmare to copy it field by field + */ + static_assert(sizeof(act->police) =3D=3D sizeof(*policer)); + memcpy(policer, &act->police, sizeof(*policer)); =20 err =3D ds->ops->port_policer_add(ds, dp->index, policer); if (err) { --=20 2.51.0