Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp2615331lqz; Wed, 3 Apr 2024 03:39:16 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV7DJNLokcj/CE6CqZ0wSSdoRw00AyWTNrmLR6CnDNgDqdB+TQ8qPQLnKexSFeLJW1S4cIc9sTitOE7fWVY11F0rCZzOCXs6H1RvHFsmg== X-Google-Smtp-Source: AGHT+IFYrJxddw2IGISyHP3BBcaXcloh4x/jpSD/LoE/rvfmbDM/Yb1ZAcJa2ox7dkeLaLCRMAmO X-Received: by 2002:a05:6808:4487:b0:3c3:d56d:a5dd with SMTP id eq7-20020a056808448700b003c3d56da5ddmr21093792oib.18.1712140756647; Wed, 03 Apr 2024 03:39:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712140756; cv=pass; d=google.com; s=arc-20160816; b=VBb5fzTttg0ourLvkMnEb6T6WDG5LEHljA3HcUGpK1Kv6TCttub5/fh1GjRw2pA4Se SW7yMHQ13hhUlHUV/7k4vNQy0WiIj9XSABfLVQ7cqhlB05FEtAbZd3DwXk6hURUrf2ln Jw1qdP92WZgbuRiY9YcHjxKy4LIFOPyWMOkupY6nlOPe6PNjtvXLE3dOLQZ1xKdUmA7l CwTse9goxwiu81UZGdJccrA57cMY/Z84ckGF+rsFGX/GpToSvF1swBtPy4yOpBs/0O7F CH55Eghb0PtRartEqz/egcsWb9ieaKrknCOlHvrAn+GbE6bN71Ruu4ZMfu0FC90NfgLd WG6w== 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=+bxKD9iMqvGSst570xxVI68A/yARVoT0X5vNdiXsHRg=; fh=NCIp94zejEUzAYkkIHX4JN6FazKv0GsrFeiFo7zThes=; b=ha959z8LdLpb2HPwGxi5r3cOuIrejBDiNOD+gZ/R97+cTkseoW2tLAqi5lXV8lZICL jSnbX/poGdKXdwQaHATW9zgYeoUObBnbZr5NZh3ZvSwLMSEXslVCTdqogff6eSk1ZHBD RXyBf1W9hh27F3pb9/DmuqBDngCKxhNPouJi+3o7xZJJ3KVKVNrFlfZ/WkE+zPKrt8kj 64zR1ihHk8R+ZrDmRlmktTbe1DD+v7Cq3dLRyDFMgg9I9Xh/hsB/c/CieTzmg6i1u9ld AUM0R0VKe46+S/MLSYeUP7Y6TIxCP/koXd5iEQt6sWH0VzQwdckAOvon92AC4bQHPzM8 uhsg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BudPPXSE; 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-129573-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129573-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id b19-20020ac87fd3000000b004318498b1d3si519959qtk.424.2024.04.03.03.39.16 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 03:39:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-129573-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=BudPPXSE; 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-129573-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-129573-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 4DFF51C268AE for ; Wed, 3 Apr 2024 10:39:16 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 912F7145FE4; Wed, 3 Apr 2024 10:38:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="BudPPXSE" Received: from mail-ej1-f43.google.com (mail-ej1-f43.google.com [209.85.218.43]) (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 EA75A14389D; Wed, 3 Apr 2024 10:38:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.218.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712140684; cv=none; b=cQm96Dv01tlMpFeWX4ttDMV7VKmSxbrE01n7pccQY2L8Qbz4cz/ZSxOtJnBxrGeZhoUjzmeFZs94SFpQUUvUi2rxPT5+gdsPBD/x5rE8DvkSxSVFKMVDgKlfNMFjXjvrxCsiWnHKizSCdoaii103bWbp7PONDkd99HFC7Ddo72c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712140684; c=relaxed/simple; bh=O0gHDM0xgUueH7DwBUIjDd0mL0nkucXtLHYMM4BNWPE=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=A5uUUa4g7YsjtCO1alduLoI7YPUzGY4cA8BPK7sFAZ07fqDD2oZKYrlk5V0ycJFuasdLnVgc+LFAp7QfdpZTqRf7KGkQlckJrVzCfgXi2+VrjRBIBysQUVpeglgBURxjWYp07eHH/pRj5DaE3VsH7LeqdMVvlb4RRSIkKQWDJ+0= 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=BudPPXSE; arc=none smtp.client-ip=209.85.218.43 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-ej1-f43.google.com with SMTP id a640c23a62f3a-a450bedffdfso712054066b.3; Wed, 03 Apr 2024 03:38:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712140681; x=1712745481; 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=+bxKD9iMqvGSst570xxVI68A/yARVoT0X5vNdiXsHRg=; b=BudPPXSEkIyXjk7YbOcxa5xaLmfbJfvI6BM7SKA8rUSt296nhWwALfw/s7BfpBS8iH SbAtdivYJZg3Jejfag6/SIlRF20nP5tCaGwks+aAkfzLe9trqS0TMBYSOzOO9tG7DQjk oQc5Gth9hsFQTeIcgCZ7K2N8cNyX05NM/7WD6poc5wxY7tDB4gTsRFdCSN0HXR5aatpF iyRdlyZVOdQjhtHT+Q1t5vkWqrOGxXm1WKwgo93D8APrsxBw//RHOKwzNASl5B638Pih 3F/BgBvWn6b9rY1oMfp8KRcka9faBXfELvqGyDn3bDEBMgJ7pFp1EoFq8DdhAZi4+00x bzOQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712140681; x=1712745481; 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=+bxKD9iMqvGSst570xxVI68A/yARVoT0X5vNdiXsHRg=; b=P05ru4CrjeJ+PbW0Ta2sBadIKtlV92bHmQC1VL8IRQmPjHY1Suq5gXmUlVW6N+DH5u 5PwgUjWJ371qCFsn91C/RWqWfcAy29t7E9NbNEwYZGaUPqNtLjLU15ei3+ScmQilqMKZ C9kEB6sor2W43tpFV4nCb7weDaT7Ur5I4kgeZrn33O6wVS2GNdrtnqd8goKA/4OBVot0 uAAe2YUy969kyciHS6mc04QL25nmLR+d+sQ9G+KCX3Mgm94T4b9q1JxFDlUFfd07x0mP p9JxZvTT+ivtK2BCgfprZ5gIMaeNJnmDqOXGhjOQceOnXZBKXNgJF+eJbvL2DPC0lQk3 dhfQ== X-Forwarded-Encrypted: i=1; AJvYcCUe5IIK/rWP4+cbpKVdzr10akjFqFHvod39NDRlyE2kCRyQJzUuardcC30tyQseqMCUfqf6XKwip53May6hwfBNFkT4R7pOwIjmrhva X-Gm-Message-State: AOJu0YzcNWIRciA6pT7gLd7ONnrUPP3bw8LxZjFDElL/x7rOznmDv+Cm zAcM3lWnB6saueltwf0eH9fRzKV/jbpDBYy3AvcyRVA8pOC7bt9uBcZjdadoU/g= X-Received: by 2002:a17:906:7cd:b0:a4e:802c:a7a2 with SMTP id m13-20020a17090607cd00b00a4e802ca7a2mr1635685ejc.38.1712140680710; Wed, 03 Apr 2024 03:38:00 -0700 (PDT) Received: from WBEC325.dom.lan ([185.188.71.122]) by smtp.gmail.com with ESMTPSA id xd2-20020a170907078200b00a4e2e16805bsm6858169ejb.11.2024.04.03.03.37.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 03 Apr 2024 03:38:00 -0700 (PDT) From: Pawel Dembicki To: netdev@vger.kernel.org Cc: Linus Walleij , Simon Horman , Pawel Dembicki , Vladimir Oltean , Florian Fainelli , Andrew Lunn , Florian Fainelli , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Claudiu Manoil , Alexandre Belloni , UNGLinuxDriver@microchip.com, Russell King , linux-kernel@vger.kernel.org Subject: [PATCH net-next v8 04/16] net: dsa: vsc73xx: Add define for max num of ports Date: Wed, 3 Apr 2024 12:37:20 +0200 Message-Id: <20240403103734.3033398-5-paweldembicki@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240403103734.3033398-1-paweldembicki@gmail.com> References: <20240403103734.3033398-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 Signed-off-by: Pawel Dembicki Reviewed-by: Vladimir Oltean Reviewed-by: Linus Walleij Reviewed-by: Florian Fainelli --- v8: - resend only v7: - added 'Reviewed-by' only v6: - resend only v5: - added 'Reviewed-by' only v4: - Resend patch v3: - Introduce patch 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