Received: by 2002:a05:6500:1b45:b0:1f5:f2ab:c469 with SMTP id cz5csp178291lqb; Tue, 16 Apr 2024 12:10:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWW+daKVq7HgFcvWuV1EnzznyTH47FcMST2dmXI8hWd1Ayp9t/2ncGlyi2IAF0ppDzCvnLTpi36UiodYuSiDdXae3trwcnzPGDANLwfpQ== X-Google-Smtp-Source: AGHT+IFiKFyPtSuPo7sP2LpESwrtORdMFkzaUu9ybcbSWNrjLj0HrYvcP2s+Y7m1W1np0lvCPCyg X-Received: by 2002:a05:6a20:d49b:b0:1a9:c6fd:d2b9 with SMTP id im27-20020a056a20d49b00b001a9c6fdd2b9mr10175133pzb.8.1713294653306; Tue, 16 Apr 2024 12:10:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713294653; cv=pass; d=google.com; s=arc-20160816; b=Ys5aP9n4qlTakmGrqycszVBiFMxtb16A+86TjXOQtKyHQGbv0gnNTqh5cAKfavdFyc DlrP7Cwk7/OyDuvS+ZaMNRfQXbiIa7IJMqvHUsJlx+mRVrY9gFOU8AXXsLZqDVaU/RFm vMWTjQX7saQUzoQLXhmLKwiPMBTXR8QWGVphMlmBqll6XHclzCy+LTc1lB1YBSgqIxtf Uy+JUFGOresgXDnk4MbGFnxLlr59Kthb/RnwdL81dW/8nXuVQQXB2cwYmwisJa4IHJj/ RLip8+3SYukGTexOHTl5gkHHtlDcOXKcWqxWUX1bgAZY2g6By8nVsn1fTeMyNCAvb/Ft px6g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=SUzg9stfaBGBJD0DXmvP+Xu180vDdPP5gPXWEt3B/dA=; fh=nHurA+N1fvu6FAOKvhwVX7I4azvPVd7/r2ZnEI0Pibs=; b=sQtXbkf9SjAZuq7JWYM6dROKso+Q31l3fXyKjM8nLKJYpKYgrzJhdV3d9lfvfN9UTa Yopu18sjAV/p2ZOP9eUAvJmVu4O8ElhOw5lkj8hQ/BifmFqnLskFJJVL1COsDWxYbInN U2fdixIoj3whDy4QQ6CzqpYEFnutb1WfA5+0M2xGHLDFflB7elBZWaNL9Uo85i4x7PU8 o/b53Kb7xjl287Qv4vqh1ZuhBNe3kN0cGWX7K2GEmDVpLYFtr0JllSXz644V6va8nek0 BycRZskzWV1yHbr5nv3VKHb51A6Vh4m4BYmfJiau9qnUkyz/1w8jUFFzUgNjd/JXRY+j sQRQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="Lf1sV/s6"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-147440-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147440-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id k19-20020a635613000000b005dc8f60cdf9si10405911pgb.302.2024.04.16.12.10.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 12:10:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-147440-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b="Lf1sV/s6"; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-147440-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-147440-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id ED7C7B23807 for ; Tue, 16 Apr 2024 19:03:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A2B7B139D11; Tue, 16 Apr 2024 19:01:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Lf1sV/s6" Received: from mail-ed1-f47.google.com (mail-ed1-f47.google.com [209.85.208.47]) (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 D85221386D0; Tue, 16 Apr 2024 19:01:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713294116; cv=none; b=AqkXV2xbwF6joVwHX0dhsJmygQxw5z37pOxiIbtjQQdAf2qI3uTQz3PrtToAJAgpZ2lYQXz9is//2EI2aqOKvO+eWnySncRBJ8R5xp2QtAlaVXVX6lQH4/pnQECdbewNKiubKPpYiwqkrfDq5MwCBCUSOj4ePaEKb1d+lQh8FHY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713294116; c=relaxed/simple; bh=7L1j0x6OhKtrQNLFBM1nnXbMMwq5wuw0psNfkPFdO4w=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=TKemdiSCN8TNBjDjfjTTLR1yOSLbJLOwE5xVEAbieHbXoH3BbyBL9iYNwnqrqufoxTKVk4k7WVb9flqA8LnyOMtdHDgjbdD9dtBP+Hq28YTHL6LdBHyULUd+2WVg6ABihSWDcvsmQ4d+86iiMVou3/sX3MwALP2wScZRcUYFTGI= 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=Lf1sV/s6; arc=none smtp.client-ip=209.85.208.47 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 Received: by mail-ed1-f47.google.com with SMTP id 4fb4d7f45d1cf-56fd7df9ea9so5610804a12.0; Tue, 16 Apr 2024 12:01:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713294113; x=1713898913; 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=SUzg9stfaBGBJD0DXmvP+Xu180vDdPP5gPXWEt3B/dA=; b=Lf1sV/s6zKfWtlSzl+7WV615qOt1FGmZSs2/tkPC0qtseIHEHnwYwVadeBNP6zI4zh xINI0rvft9YRc97JkWqXU+J2frbR7vLVC/+VU2seglWv1wlCAiWhjnkH1gEUCAho2rAz HFfwkGfhMp2WOODFezLGS1fnKp4uU6Vj9290xo5fv+ddveFnmBDjrHXU0S41qUqFgtz8 Og7JtVs5j5bvULJWJiTaZEAJwk+Wua0nAShHPc9lNBVnB1v0d2hgqfslvWNnfxe/Yp2s +Jsm25Z6FDs7HqoB+SzSRQbyyftGtorl6mX0kKFC7u5h/o5E+bACLp/v0Xa6a/L0fpA3 65ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713294113; x=1713898913; h=content-transfer-encoding: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=SUzg9stfaBGBJD0DXmvP+Xu180vDdPP5gPXWEt3B/dA=; b=Vf58iM7IpZIztmXWqW4vZV0Sf++kzTeedNBpLzwIP+xhQEvej4ShOhJ8DpPStfXnY0 H4BYsCok0xjHoL91/Bi2AgxRi0bOZjIi6b8Y5oPZKCRNN7g7TAH3myZnWeu/gcT6M1cs +/THL17wIfRdAfwStBfsI7jrv2gTwi0XiXzy0l3UCFsfPR+tUlk4KCav4F4EGINCBZU9 Gpdl0NiZkBvYYe5aTK8UZJagWEK8+PltF+Z+UWxq5cNR6+0TygcIGvRznwOC0RlrqouJ Qi9oy6GFSGgtI8oXk5II+gOCJmwFT6jMQNWbb7nmS4ZYhjR4rnPnBid6khTBA3+Bwjbw o4uA== X-Forwarded-Encrypted: i=1; AJvYcCUVWwCSUEL8amfwEnokImov9OQnTrhM9uJlAXUXF/p6i0HwjimTiNGK7ypqH901i4p1JAnZ2r+UoWXfy7RHi9QTLtzscSaxW/Kv2K11 X-Gm-Message-State: AOJu0YzUJ0uBfTUnmNa/yKuK7NtUx+2+a/hRthLju1ETj9+v/Bsl6vn+ E7lTf0naDv4BjxoJ8DKUMBZmE+rBWo+zcnuvX1E7ev6wLTWW7qfMmrdfGElA X-Received: by 2002:a17:906:3c4d:b0:a52:28ba:2ce0 with SMTP id i13-20020a1709063c4d00b00a5228ba2ce0mr8156527ejg.29.1713294112720; Tue, 16 Apr 2024 12:01:52 -0700 (PDT) Received: from WBEC325.dom.lan ([185.188.71.122]) by smtp.gmail.com with ESMTPSA id mm10-20020a170906cc4a00b00a524531a580sm5247981ejb.152.2024.04.16.12.01.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Apr 2024 12:01:52 -0700 (PDT) From: Pawel Dembicki To: netdev@vger.kernel.org Cc: Pawel Dembicki , Vladimir Oltean , Linus Walleij , Florian Fainelli , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Russell King , linux-kernel@vger.kernel.org Subject: [PATCH net-next 4/5] net: dsa: vsc73xx: Add define for max num of ports Date: Tue, 16 Apr 2024 21:00:54 +0200 Message-Id: <20240416190055.3277007-5-paweldembicki@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240416190055.3277007-1-paweldembicki@gmail.com> References: <20240416190055.3277007-1-paweldembicki@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: 8bit This patch introduces a new define: VSC73XX_MAX_NUM_PORTS, which can be used in the future instead of a hardcoded value. Currently, the only hardcoded value is vsc->ds->num_ports. It is being replaced with the new define. Suggested-by: Vladimir Oltean Reviewed-by: Vladimir Oltean Reviewed-by: Linus Walleij Reviewed-by: Florian Fainelli Signed-off-by: Pawel Dembicki --- drivers/net/dsa/vitesse-vsc73xx-core.c | 13 +------------ drivers/net/dsa/vitesse-vsc73xx.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/net/dsa/vitesse-vsc73xx-core.c b/drivers/net/dsa/vitesse-vsc73xx-core.c index 8ed8fc997d6d..425999d7bf41 100644 --- a/drivers/net/dsa/vitesse-vsc73xx-core.c +++ b/drivers/net/dsa/vitesse-vsc73xx-core.c @@ -1180,23 +1180,12 @@ int vsc73xx_probe(struct vsc73xx *vsc) vsc->addr[0], vsc->addr[1], vsc->addr[2], vsc->addr[3], vsc->addr[4], vsc->addr[5]); - /* The VSC7395 switch chips have 5+1 ports which means 5 - * ordinary ports and a sixth CPU port facing the processor - * with an RGMII interface. These ports are numbered 0..4 - * and 6, so they leave a "hole" in the port map for port 5, - * which is invalid. - * - * The VSC7398 has 8 ports, port 7 is again the CPU port. - * - * We allocate 8 ports and avoid access to the nonexistant - * ports. - */ vsc->ds = devm_kzalloc(dev, sizeof(*vsc->ds), GFP_KERNEL); if (!vsc->ds) return -ENOMEM; vsc->ds->dev = dev; - vsc->ds->num_ports = 8; + vsc->ds->num_ports = VSC73XX_MAX_NUM_PORTS; vsc->ds->priv = vsc; vsc->ds->ops = &vsc73xx_ds_ops; diff --git a/drivers/net/dsa/vitesse-vsc73xx.h b/drivers/net/dsa/vitesse-vsc73xx.h index 30b1f0a36566..fee1378508b5 100644 --- a/drivers/net/dsa/vitesse-vsc73xx.h +++ b/drivers/net/dsa/vitesse-vsc73xx.h @@ -3,6 +3,17 @@ #include #include +/* The VSC7395 switch chips have 5+1 ports which means 5 ordinary ports and + * a sixth CPU port facing the processor with an RGMII interface. These ports + * are numbered 0..4 and 6, so they leave a "hole" in the port map for port 5, + * which is invalid. + * + * The VSC7398 has 8 ports, port 7 is again the CPU port. + * + * We allocate 8 ports and avoid access to the nonexistent ports. + */ +#define VSC73XX_MAX_NUM_PORTS 8 + /** * struct vsc73xx - VSC73xx state container */ -- 2.34.1