From nobody Wed Nov 27 04:44:09 2024 Received: from mail-ed1-f45.google.com (mail-ed1-f45.google.com [209.85.208.45]) (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 220F218E20; Sun, 13 Oct 2024 18:51:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728845482; cv=none; b=gbjNsosRJkiNxuKLfk6Fv6nORHi7YEkyAeMDR12/IwYB0gp8zya9Bn16+fRebhYFfj2rHSpVIadzMyBoDOImNbBK3sV8TVhDR2U7pGKDtxpGkXLilUHOSpPkzvzqTr6OOTkXu7CaXNRCWDDwHuV5YlGKfHSVfvEvH1JBKHF+FkI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728845482; c=relaxed/simple; bh=JDL2wuPFcpu6wq2ydWF1mXO6CiWRnypM6m0Bv/9xFUo=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=dhfeXEqlNzMzwT9CZFgr8WQRuFqW4tb8MMWaLktHfPx84E16tSWzf+XOKzxV5L701AghqzreFfFhA0ovULP0CRJm2Tv6At6NJZrVjnr7oFAAOJqAhvoynhEIDizxy79fmbCRUf+AInj6wxGBTYngBEbzpJaKg9rZRK4v2jfKcAs= 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=Q7N8BS7I; arc=none smtp.client-ip=209.85.208.45 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="Q7N8BS7I" Received: by mail-ed1-f45.google.com with SMTP id 4fb4d7f45d1cf-5c96936065dso1266055a12.3; Sun, 13 Oct 2024 11:51:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728845479; x=1729450279; 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=upE0t48bx6bnFX6rRPJniUFr4RqVvS0QgUcy6/B4hDA=; b=Q7N8BS7IKgPeiJgSpCFEz0slI8LIwZMdIXg9+21+WIuJFzhLCZQ5oV4zXYGIOhdCPe W6+/IigCmsbk29dud+zlGCgqpvl3Ud8dBP4QZr5NKxzY/D5qxMbX8pLrp0iz0VzkmkQA 0QMjGMn5hVIkoGhdeiMfqTdnacspftCk8ICuqcGuVuuPmR6I86irVEExfjviWtuiw2F0 K7hBBph+0e4fiRWm/8YepeNvStEsNakavvnCn2apH+BAju6sqv0DoMvk8hhFs1wi8r6i 4DdNYoXwtsU3KASmqOtkqdMQkIMNOVnaH0CNNn79ly8zzIraSrrqwMYNdVHNAiOL8GUY iXHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728845479; x=1729450279; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=upE0t48bx6bnFX6rRPJniUFr4RqVvS0QgUcy6/B4hDA=; b=NYHKrb4/YWQyJsrft03tfL4VlXb0XjKxuDFWyvZRn2+Yp8u4/H+KdzRZZ5Jle0hbqc ed6ZgMraqiLLFLsz1IqSg5NRwWxtdrQxu8u1Q2ZL9qedwTOICa1frrDyU7sSjtHAgDq+ zx+rq4OTAL/cnSW+0yolXj+Ncbw1NSCsm44lgaclpoLnvmQQ+M/Qg40ISbcvHl/GJMKA J0/ZEQNdDZa9jAV6X57Xkada0UFdpXkk4Xe30oHiHx4RB+0uQxn5HY9wQWT1NJjtWtxt XVbhN3Bd9af9t5C9t0W5jAbFc+sdjuf2hCBm3gXseSp2iC+2I9s135wcZ8H3CvMugkwS t80Q== X-Forwarded-Encrypted: i=1; AJvYcCUyOIHvVSqMtTDXPNM4NZcPsdA3xNRRE2YAJZZ6gtRPig28WyX0xp95hqL6F5mPrgoSjVSWaSACXWLkX5w=@vger.kernel.org X-Gm-Message-State: AOJu0YxMBv1BwDruTRQYdMp6Dc2Y8NdogAW8anHsPOlDlgDBg3P/IGcV m5ptnO/Fnqg7BwQovMGkfsp0a/RgMUgCtF9aArzXtgo+s6E9yXko X-Google-Smtp-Source: AGHT+IFisFXHNsMThYF5hflDELoTjfJVgJKtvK5aGnjqGXgf/Lkez2iRLHMqqM2Mpjy0m2JcUM5ZOw== X-Received: by 2002:a05:6402:42c9:b0:5c9:6c03:48ca with SMTP id 4fb4d7f45d1cf-5c96c035050mr2810750a12.31.1728845479275; Sun, 13 Oct 2024 11:51:19 -0700 (PDT) Received: from corebook.localdomain (2001-1c00-020d-1300-1b1c-4449-176a-89ea.cable.dynamic.v6.ziggo.nl. [2001:1c00:20d:1300:1b1c:4449:176a:89ea]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c937156781sm4059656a12.56.2024.10.13.11.51.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 13 Oct 2024 11:51:17 -0700 (PDT) From: Eric Woudstra To: Felix Fietkau , Sean Wang , Mark Lee , Lorenzo Bianconi , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , "Frank Wunderlich" , Daniel Golle , Eric Woudstra Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: [PATCH RFC v1 net-next] net: ethernet: mtk_ppe_offload: Allow QinQ Date: Sun, 13 Oct 2024 20:50:56 +0200 Message-ID: <20241013185056.4077-1-ericwouds@gmail.com> X-Mailer: git-send-email 2.45.2 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" mtk_foe_entry_set_vlan() in mtk_ppe.c already seems to support double vlan tagging, but mtk_flow_offload_replace() in mtk_ppe_offload.c only allows for 1 vlan tag, optionally in combination with pppoe and dsa tags. This patch adds QinQ support to mtk_flow_offload_replace(). Only PPPoE-in-Q (as before) and Q-in-Q are allowed. A combination of PPPoE and Q-in-Q is not allowed. As I do not have any documentation of the ppe hardware, I do not know if there is any other reason to not implement Q-in-Q in mtk_flow_offload_replace(). Tested on the BPI-R3(mini), on non-dsa-ports and dsa-ports. Signed-off-by: Eric Woudstra --- .../net/ethernet/mediatek/mtk_ppe_offload.c | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c b/drivers/net/= ethernet/mediatek/mtk_ppe_offload.c index f20bb390df3a..c19789883a9d 100644 --- a/drivers/net/ethernet/mediatek/mtk_ppe_offload.c +++ b/drivers/net/ethernet/mediatek/mtk_ppe_offload.c @@ -34,8 +34,10 @@ struct mtk_flow_data { u16 vlan_in; =20 struct { - u16 id; - __be16 proto; + struct { + u16 id; + __be16 proto; + } vlans[2]; u8 num; } vlan; struct { @@ -349,18 +351,19 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct = flow_cls_offload *f, case FLOW_ACTION_CSUM: break; case FLOW_ACTION_VLAN_PUSH: - if (data.vlan.num =3D=3D 1 || + if (data.vlan.num + data.pppoe.num =3D=3D 2 || act->vlan.proto !=3D htons(ETH_P_8021Q)) return -EOPNOTSUPP; =20 - data.vlan.id =3D act->vlan.vid; - data.vlan.proto =3D act->vlan.proto; + data.vlan.vlans[data.vlan.num].id =3D act->vlan.vid; + data.vlan.vlans[data.vlan.num].proto =3D act->vlan.proto; data.vlan.num++; break; case FLOW_ACTION_VLAN_POP: break; case FLOW_ACTION_PPPOE_PUSH: - if (data.pppoe.num =3D=3D 1) + if (data.pppoe.num =3D=3D 1 || + data.vlan.num =3D=3D 2) return -EOPNOTSUPP; =20 data.pppoe.sid =3D act->pppoe.sid; @@ -450,11 +453,11 @@ mtk_flow_offload_replace(struct mtk_eth *eth, struct = flow_cls_offload *f, if (offload_type =3D=3D MTK_PPE_PKT_TYPE_BRIDGE) foe.bridge.vlan =3D data.vlan_in; =20 - if (data.vlan.num =3D=3D 1) { - if (data.vlan.proto !=3D htons(ETH_P_8021Q)) + for (i =3D 0; i < data.vlan.num; i++) { + if (data.vlan.vlans[i].proto !=3D htons(ETH_P_8021Q)) return -EOPNOTSUPP; =20 - mtk_foe_entry_set_vlan(eth, &foe, data.vlan.id); + mtk_foe_entry_set_vlan(eth, &foe, data.vlan.vlans[i].id); } if (data.pppoe.num =3D=3D 1) mtk_foe_entry_set_pppoe(eth, &foe, data.pppoe.sid); --=20 2.45.2