From patchwork Thu Feb 2 12:59:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 51907 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp220937wrn; Thu, 2 Feb 2023 04:59:44 -0800 (PST) X-Google-Smtp-Source: AK7set81/uv2VdlB4VMnJ/3wXilb1OND87tcbIOh4ZI27k1/60FkgTsHQhhYBwx8V8XZwabJPR4p X-Received: by 2002:a17:907:3e82:b0:878:6755:9089 with SMTP id hs2-20020a1709073e8200b0087867559089mr8586399ejc.39.1675342784461; Thu, 02 Feb 2023 04:59:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675342784; cv=none; d=google.com; s=arc-20160816; b=a4xNfKfR2PTtJXko+FYHuQM6fFzmv7EpR5nBWegpOWYrLBYL6mmCG1llGo4VoyTO9G E2rzKgrSExLCedJYg5fRWp7rtm/n0bir0YG7gTDFQ35tyu1Kay/ydKALkzfSnZfTip1M x2O6aePiiF3y7KY2OOFo2IbN19b8oFwaBPgaZU6g8DpDZU99/WuJQu2ZaQJ9rwslxnOy fbIDBfrCx9OCEy7yBsyBOnp0ZpvZFcsoL1zCcjUtIyoTHSpG1/gETaX0mYpqj0KRsL1M VUjLIhjwh3qpurqJkQuWoURTkGtmR1KCVbISlG6Qq8JmYbxbRCbIad8xaSHKJNhwLxsM ZJ1g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=eZAjX2GLMU9Py7fa+DasfJlWLO1dBMNQSGj/qcLruak=; b=bL4SR8iWXtjDbN0TLDdc0ot+9bWJnsC0L9Nyj/txjM8xsc7To5Q0w1Og6grlm59GTU w/JguDf/JMnq+uQcKYFJ/XTVDI4wwTs8yCIAwrf46ocie0KaSdsOBlndSCPJxcB0yIGx OF638yn93LVqSCZh9SNLUD7qLzzGDRIxYvxkpc0nY+YG2oO1Yk15ogyhBT/UKKbO8SJV yjV6M+2WRJX8FDEyQqLcQWCwFesJ9OlI3d8IdQ3iMt0qwUxW/ofqa66C0cYGCBNXbOW6 9Qq6BpJ7Oe1zh4vUrKWVIvodTCPib4JZuTSM9AtC/e2PlmT8yHigSHrBiZjB859ksbFL 8xQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="b7sk/bTF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id d22-20020a17090692d600b0088a7cf55d35si10675367ejx.437.2023.02.02.04.59.20; Thu, 02 Feb 2023 04:59:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="b7sk/bTF"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232005AbjBBM6s (ORCPT + 99 others); Thu, 2 Feb 2023 07:58:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230375AbjBBM6q (ORCPT ); Thu, 2 Feb 2023 07:58:46 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 391E9193; Thu, 2 Feb 2023 04:58:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675342725; x=1706878725; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ogFJQVXNUNjBJFqygmk4PZfTb+58Qo0jzOmynUcXT5E=; b=b7sk/bTFs4uWkfgljUvjTTDCvgkijFrsOuWdvDuQc4vlLozMiq0sIqC4 5lODoQ9YD3JYaV2a4SdangD706lTYBID1m4fOP1dliB1e30UEgGDUrG8j jUiy4m/pfIdpl+lgRYTCInY3oHrs4vLcAO2a3KoKanO2ouQ6qE2NcVc2l nmCCDCwRutYQyTMj/XnQF0fd61PpiBwkCuTYT1n96Hmvr29lifz0bj0PU V/8krhKX8nMRNN2uoiiTWzlq8l919S3rdLds8DNgTA2WCZ8LMbNF2mybL gbF/yN2r0c6DlpDqMu6+ESK5RXlgBZ6zQfVcRnCheZTARQWtBkweIl6hN g==; X-IronPort-AV: E=Sophos;i="5.97,267,1669100400"; d="scan'208";a="198620504" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Feb 2023 05:58:44 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Feb 2023 05:58:32 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Feb 2023 05:58:28 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [RFC PATCH net-next 01/11] net: dsa: microchip: lan937x: add cascade tailtag Date: Thu, 2 Feb 2023 18:29:20 +0530 Message-ID: <20230202125930.271740-2-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> References: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756724235325206934?= X-GMAIL-MSGID: =?utf-8?q?1756724235325206934?= cascade tailtag contains 3 bytes of information, it includes additional bytes for accomodating port number in second switch. Destination port bitmap on first switch is at bit position 7:0 and of second switch is at bit position 15:8, add new tailtag xmit and rcv functions for cascade with proper formatting. Add new tag protocol for cascading and link with new xmit and rcv functions. Signed-off-by: Rakesh Sankaranarayanan --- include/net/dsa.h | 2 ++ net/dsa/tag_ksz.c | 80 ++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 77 insertions(+), 5 deletions(-) diff --git a/include/net/dsa.h b/include/net/dsa.h index a15f17a38eca..55651ad29193 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -56,6 +56,7 @@ struct phylink_link_state; #define DSA_TAG_PROTO_RTL8_4T_VALUE 25 #define DSA_TAG_PROTO_RZN1_A5PSW_VALUE 26 #define DSA_TAG_PROTO_LAN937X_VALUE 27 +#define DSA_TAG_PROTO_LAN937X_CASCADE_VALUE 28 enum dsa_tag_protocol { DSA_TAG_PROTO_NONE = DSA_TAG_PROTO_NONE_VALUE, @@ -86,6 +87,7 @@ enum dsa_tag_protocol { DSA_TAG_PROTO_RTL8_4T = DSA_TAG_PROTO_RTL8_4T_VALUE, DSA_TAG_PROTO_RZN1_A5PSW = DSA_TAG_PROTO_RZN1_A5PSW_VALUE, DSA_TAG_PROTO_LAN937X = DSA_TAG_PROTO_LAN937X_VALUE, + DSA_TAG_PROTO_LAN937X_CASCADE = DSA_TAG_PROTO_LAN937X_CASCADE_VALUE, }; struct dsa_switch; diff --git a/net/dsa/tag_ksz.c b/net/dsa/tag_ksz.c index 0eb1c7784c3d..7ab2c7eaa4ca 100644 --- a/net/dsa/tag_ksz.c +++ b/net/dsa/tag_ksz.c @@ -16,6 +16,7 @@ #define KSZ9477_NAME "ksz9477" #define KSZ9893_NAME "ksz9893" #define LAN937X_NAME "lan937x" +#define LAN937X_CASCADE_NAME "lan937x_cascade" /* Typically only one byte is used for tail tag. */ #define KSZ_PTP_TAG_LEN 4 @@ -24,6 +25,9 @@ #define KSZ_HWTS_EN 0 +#define SWITCH_0 0 +#define SWITCH_1 1 + struct ksz_tagger_private { struct ksz_tagger_data data; /* Must be first */ unsigned long state; @@ -84,10 +88,10 @@ static int ksz_connect(struct dsa_switch *ds) } static struct sk_buff *ksz_common_rcv(struct sk_buff *skb, - struct net_device *dev, - unsigned int port, unsigned int len) + struct net_device *dev, unsigned int port, + unsigned int len, u8 device) { - skb->dev = dsa_master_find_slave(dev, 0, port); + skb->dev = dsa_master_find_slave(dev, device, port); if (!skb->dev) return NULL; @@ -141,7 +145,7 @@ static struct sk_buff *ksz8795_rcv(struct sk_buff *skb, struct net_device *dev) { u8 *tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN; - return ksz_common_rcv(skb, dev, tag[0] & 7, KSZ_EGRESS_TAG_LEN); + return ksz_common_rcv(skb, dev, tag[0] & 7, KSZ_EGRESS_TAG_LEN, SWITCH_0); } static const struct dsa_device_ops ksz8795_netdev_ops = { @@ -177,6 +181,7 @@ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ8795, KSZ8795_NAME); #define KSZ9477_INGRESS_TAG_LEN 2 #define KSZ9477_PTP_TAG_LEN 4 #define KSZ9477_PTP_TAG_INDICATION 0x80 +#define LAN937X_CASCADE_CHIP 0x40 #define KSZ9477_TAIL_TAG_PRIO GENMASK(8, 7) #define KSZ9477_TAIL_TAG_OVERRIDE BIT(9) @@ -304,6 +309,7 @@ static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev) u8 *tag = skb_tail_pointer(skb) - KSZ_EGRESS_TAG_LEN; unsigned int port = tag[0] & 7; unsigned int len = KSZ_EGRESS_TAG_LEN; + u8 device = SWITCH_0; /* Extra 4-bytes PTP timestamp */ if (tag[0] & KSZ9477_PTP_TAG_INDICATION) { @@ -311,7 +317,10 @@ static struct sk_buff *ksz9477_rcv(struct sk_buff *skb, struct net_device *dev) len += KSZ_PTP_TAG_LEN; } - return ksz_common_rcv(skb, dev, port, len); + if (tag[0] & LAN937X_CASCADE_CHIP) + device = SWITCH_1; + + return ksz_common_rcv(skb, dev, port, len, device); } static const struct dsa_device_ops ksz9477_netdev_ops = { @@ -390,6 +399,7 @@ MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_KSZ9893, KSZ9893_NAME); * (eg, 0x00=port1, 0x02=port3, 0x07=port8) */ #define LAN937X_EGRESS_TAG_LEN 2 +#define LAN937X_CASCADE_TAG_LEN 3 #define LAN937X_TAIL_TAG_BLOCKING_OVERRIDE BIT(11) #define LAN937X_TAIL_TAG_LOOKUP BIT(12) @@ -442,11 +452,71 @@ static const struct dsa_device_ops lan937x_netdev_ops = { DSA_TAG_DRIVER(lan937x_netdev_ops); MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_LAN937X, LAN937X_NAME); +/* For xmit, 3/7 bytes are added before FCS. + * --------------------------------------------------------------------------- + * DA(6bytes)|SA(6bytes)|....|Data(nbytes)|ts(4bytes)|tag0(1byte)|tag1(1byte)| + * tag2(1byte)|FCS(4bytes) + * --------------------------------------------------------------------------- + * ts : time stamp (Present only if PTP is enabled in the Hardware) + * tag0 : represents tag override, lookup and valid + * tag1 : each bit represents destination port map through switch 2 + * (eg, 0x01=port1, 0x02=port2, 0x80=port8) + * tag2 : each bit represents destination port map through switch 1 + * (eg, 0x01=port1, 0x02=port2, 0x80=port8) + * + * For rcv, 1/5 bytes is added before FCS. + * --------------------------------------------------------------------------- + * DA(6bytes)|SA(6bytes)|....|Data(nbytes)|ts(4bytes)|tag0(1byte)|FCS(4bytes) + * --------------------------------------------------------------------------- + * ts : time stamp (Present only if bit 7 of tag0 is set) + * tag0 : zero-based value represents port + * (eg, 0x00=port1, 0x02=port3, 0x07=port8) + */ +static struct sk_buff *lan937x_cascade_xmit(struct sk_buff *skb, + struct net_device *dev) +{ + struct dsa_port *dp = dsa_slave_to_port(dev); + const struct ethhdr *hdr = eth_hdr(skb); + __be32 *tag; + u32 val; + + if (skb->ip_summed == CHECKSUM_PARTIAL && skb_checksum_help(skb)) + return NULL; + + tag = skb_put(skb, LAN937X_CASCADE_TAG_LEN); + + val |= BIT((dp->index + (8 * dp->ds->index))); + + if (is_link_local_ether_addr(hdr->h_dest)) + val |= (LAN937X_TAIL_TAG_BLOCKING_OVERRIDE << 8); + + val |= (LAN937X_TAIL_TAG_VALID << 8); + + put_unaligned_be24(val, tag); + + return skb; +} + +static const struct dsa_device_ops lan937x_cascade_netdev_ops = { + .name = LAN937X_CASCADE_NAME, + .proto = DSA_TAG_PROTO_LAN937X_CASCADE, + .xmit = lan937x_cascade_xmit, + .rcv = ksz9477_rcv, + .connect = ksz_connect, + .disconnect = ksz_disconnect, + .needed_tailroom = LAN937X_CASCADE_TAG_LEN, +}; + +DSA_TAG_DRIVER(lan937x_cascade_netdev_ops); +MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_LAN937x_CASCADE, + LAN937X_CASCADE_NAME); + static struct dsa_tag_driver *dsa_tag_driver_array[] = { &DSA_TAG_DRIVER_NAME(ksz8795_netdev_ops), &DSA_TAG_DRIVER_NAME(ksz9477_netdev_ops), &DSA_TAG_DRIVER_NAME(ksz9893_netdev_ops), &DSA_TAG_DRIVER_NAME(lan937x_netdev_ops), + &DSA_TAG_DRIVER_NAME(lan937x_cascade_netdev_ops), }; module_dsa_tag_drivers(dsa_tag_driver_array); From patchwork Thu Feb 2 12:59:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 51909 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp221291wrn; Thu, 2 Feb 2023 05:00:19 -0800 (PST) X-Google-Smtp-Source: AK7set/7ZfBgDxkuI9Seciy2mZCFwpH3fGCPr7UjChOwgOvoUo79+PclWDt2GCoTWT9WXR7236Ns X-Received: by 2002:a05:6402:448a:b0:4a3:43c1:842d with SMTP id er10-20020a056402448a00b004a343c1842dmr2000319edb.1.1675342818929; Thu, 02 Feb 2023 05:00:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675342818; cv=none; d=google.com; s=arc-20160816; b=vrcKwrRi8chq5TCdQtnf56P/XuP55hMegEqK021RU5cTChG06HUqE1ZNk9XcBjbvDN AiZsuriSwo9aKEOBnHvhrQjVBPWcMCOKZEcOJSEfbEbt4uuxNqADjHJtAfqAywzCv7JW z2lHTNvfy0UQMROZ/fTWLTTLbcgwcyeQlBe9tVkgxxJ1W2gK39J9YkjtVv2ypT4iGaPp g/q6hJyrzaaiBL9+XrCz1ZKogR5t59FMKDZOqoPkBPDyRwGt04E53wa9xcfPzp8fq9Lp PJI/jVt1uwdGAmhttcX5d1Pz+y7t+OjjdZr6s6387v/pbvTRfk7s9Rbdr5Zxc7ReA24m mMHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ergFYhyDZsmOLmhwGhLPeeYeIWzbxxJPakb/SUrMRqA=; b=MfOuqqc2TKAv45fkWX+JzaHTXlyB20ZAo28kmu8/SbAlG+u5rKhlBSyjf4hn9tq7k3 1F5JqJLQyZ3MXY6OKYGQLIgUee4m9rJsWB/qYPzhvBbA0xlI+x6hhhcsujL5LLISpp3C aQhksaGiw7KAXNYFbDKwkBs9JbHwK2oMMK0U+zI/O/pssFwQasfJ41KSIi8H4S2Kp/jq Xioc/QFjP2tRYSmVyhL5mAVaCfJLP5QIdMwS8al4NqC8IlfWkJ9wqOG78OJVYaEsnJl7 J32sBSK6SrRQjtGTTXi1fq4/h+e1RIyXlNx2dF+YzXN9OpezCnYkXMsdwcR6TMkmiPcE IFsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=pJbzyPe0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id co26-20020a0564020c1a00b004a24b8e7bfesi10724055edb.341.2023.02.02.04.59.54; Thu, 02 Feb 2023 05:00:18 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=pJbzyPe0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232345AbjBBM65 (ORCPT + 99 others); Thu, 2 Feb 2023 07:58:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59316 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232119AbjBBM6u (ORCPT ); Thu, 2 Feb 2023 07:58:50 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FD8F59249; Thu, 2 Feb 2023 04:58:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675342729; x=1706878729; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=1djmTQ6/cbT1raftQ9vms3W0+SE59JVgpFBKfe2ifxw=; b=pJbzyPe0Ya98QA+mWbkyrswAoFl2lWZIABcC44XkfYVzEh0Hyd/edAka MAGkBh37c2Naw7VLaPpxrvpWvde1PTndjSgWCuISH29LltqSKlo3KIbBx HgYiXnXxJkT1nzETBA9QoQHVMvnz/nNLnG+zsKGvGN9nSrEJJT/U22SBe LEYda//vmFBU1mTm4i8hUa9/56A4MXyM5nDAeTxUJctod0Rb5Sw/tQOBa laP1GKEAePY1cl9xr8C+dBT/RvClNoa4NO7eEWe0HH4mHJ7iTVUs8e38f EeYoP22tEMWcx9ceOMQn23RMZOCOwPoGZHN/nmqprrvR0hHvgdn4PX2cg w==; X-IronPort-AV: E=Sophos;i="5.97,267,1669100400"; d="scan'208";a="135251584" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Feb 2023 05:58:39 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Feb 2023 05:58:38 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Feb 2023 05:58:34 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [RFC PATCH net-next 02/11] net: dsa: microchip: lan937x: update SMI index Date: Thu, 2 Feb 2023 18:29:21 +0530 Message-ID: <20230202125930.271740-3-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> References: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756724271930745376?= X-GMAIL-MSGID: =?utf-8?q?1756724271930745376?= Current DSA driver register mdio interface for a port in the format of SMI-switch_index:port_number, switch_index is derived using variable ds->index. For a single switch ds->index will be always zero, and for cascaded switch, ds->index should be one. But it is found that ds->index is getting updated only after mdio_register stage. Update mdio_register to use variable directly from device tree using "dsa,member" identifier. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz_common.c | 6 +++++- drivers/net/dsa/microchip/ksz_common.h | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 46becc0382d6..d2ec5acd7b17 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -1882,7 +1882,7 @@ static int ksz_mdio_register(struct ksz_device *dev) bus->read = ksz_sw_mdio_read; bus->write = ksz_sw_mdio_write; bus->name = "ksz slave smi"; - snprintf(bus->id, MII_BUS_ID_SIZE, "SMI-%d", ds->index); + snprintf(bus->id, MII_BUS_ID_SIZE, "SMI-%d", dev->smi_index); bus->parent = ds->dev; bus->phy_mask = ~ds->phys_mii_mask; @@ -3136,6 +3136,7 @@ struct ksz_device *ksz_switch_alloc(struct device *base, void *priv) { struct dsa_switch *ds; struct ksz_device *swdev; + u32 sw_idx[2]; ds = devm_kzalloc(base, sizeof(*ds), GFP_KERNEL); if (!ds) @@ -3155,6 +3156,9 @@ struct ksz_device *ksz_switch_alloc(struct device *base, void *priv) swdev->ds = ds; swdev->priv = priv; + of_property_read_variable_u32_array(base->of_node, "dsa,member", sw_idx, 2, 2); + swdev->smi_index = sw_idx[1]; + return swdev; } EXPORT_SYMBOL(ksz_switch_alloc); diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index d2d5761d58e9..aab60f2587bf 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -147,6 +147,7 @@ struct ksz_device { u32 chip_id; u8 chip_rev; int cpu_port; /* port connected to CPU */ + u32 smi_index; int phy_port_cnt; phy_interface_t compat_interface; bool synclko_125; From patchwork Thu Feb 2 12:59:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 51908 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp221068wrn; Thu, 2 Feb 2023 04:59:57 -0800 (PST) X-Google-Smtp-Source: AK7set8oDl0OTa/a3vIeJdqg5DvIvhivollD+oEk4AXlrI+qExIyd6QoJtk5pxOoO2+0FC5pxTVV X-Received: by 2002:a17:907:9917:b0:88d:6de1:96bf with SMTP id ka23-20020a170907991700b0088d6de196bfmr6779905ejc.12.1675342797750; Thu, 02 Feb 2023 04:59:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675342797; cv=none; d=google.com; s=arc-20160816; b=x3Vs2UC+FY37DIurC8Ed+Jaa12IoD0BT5trNnsDnv7plqqw3W6dbAQhZTweftVBLfa VwjKviS1ZytmZmUDRwxexMiusGTeEmpcecULnVxAFFMNnKNG/D2cvp4zHVkatHUo/yDX 5yEZ/EOIgkYZkMQq2n1bhw2w2BJ0ju1TrYh+WNMz0alFwVDo0RmckJe/O7VfMnru/3PV 4njehy+coGSt+a/e+MBOGHgNjIc55j9nzsICijI2eV+Rz9lqMSAXm++6DMIEpKF8bGcH kbY29yF1HsSeJNi6bc48hUuF007Ha5kLQ3LdVSdJ6nsiZLTIDPFwl1X//krZ0N581ftv DqBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=i6sBze9Q/F5bBQLRVveMBui/iR7yOUmv+Yg7bs2H96E=; b=cAhQQBzeiGhf3w1whPHtp+gvoZJeMhUG3dA3uhYFA+HRPnSxuIZPLg8qzzcAsXPgLC ID2UWXewF0aUCwWGcUvewPJItMqrNvVATYWVs+G0SOjCaD2rx7zRcnXts+ttbIfxdC44 dCLf4t6pMp/qkfxc0evSrEz+B5Yojnihf6Qs0VFzN1m9Rj6KsatyaivT8GfYZdcV5X4e jjogG6VwzNq4f0/zi+NwuXksdJAmAvR6yPRf0svh656LMBNWV4Xfu5ImI7wXe+Uz7uoG 6BYiOhxxDwf8DpDi4EF1E5V9YO3Rxu9z/xwk7tX7q2ojtrMBIUnOWZ4cs3DW2cycSJT5 9Q0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=EiVff7Qf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v26-20020a17090610da00b008787c8674b1si7067794ejv.751.2023.02.02.04.59.34; Thu, 02 Feb 2023 04:59:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=EiVff7Qf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232138AbjBBM6v (ORCPT + 99 others); Thu, 2 Feb 2023 07:58:51 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59254 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229666AbjBBM6s (ORCPT ); Thu, 2 Feb 2023 07:58:48 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB254EF82; Thu, 2 Feb 2023 04:58:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675342726; x=1706878726; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=bxVhL1m9KqOfZ9Y/N1jqZpYPk1To2xrlI3Xdh5PfAks=; b=EiVff7QfUvQrneIJCVgjDlXUuhtQ4/cOcZXp9T5WL/QQIJuTZKWTfG5g MroN2ACLf9AAfo/nN/u7nNDNhaY25W2pZ8gn9Ofnm5j0oJLkTkpWfAzUl ApsH+60Qu0ulWZTBeZcpb6QE9kFlGuIZgXmF0FYg7h4Ey5PtWZ+aVfpqz jak+nhkj8MVKmSVKk+YE4Vvh9pn5//OHXmfpsAkP0zeI8zvPDCrYl4CLY faR+UH3CTpExA5IChn0Wrjn6e/XKHgw5XbA2bo/D89nPGwJ6SAvJFnbIE 7DwjxKlPge88oSpUU2mqWFaWi2lrBdqQiBRBsKDO2rVGJhvj58WuyeVNh Q==; X-IronPort-AV: E=Sophos;i="5.97,267,1669100400"; d="scan'208";a="198620506" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Feb 2023 05:58:44 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Feb 2023 05:58:44 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Feb 2023 05:58:39 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [RFC PATCH net-next 03/11] net: dsa: microchip: lan937x: enable cascade port Date: Thu, 2 Feb 2023 18:29:22 +0530 Message-ID: <20230202125930.271740-4-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> References: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756724249358301531?= X-GMAIL-MSGID: =?utf-8?q?1756724249358301531?= Get index of cascaded port (if any) from device tree and enable the feature. These ports referenced as dev->dsa_port and will be used for processing further based on cascaded connection. For the second switch in cascaded connection, no dev->cpu_port will be assigned, and same happens for dev->dsa_port variable for switches without cascading. For the single switch design, there is no way dev->cpu_port will be unassigned. But coming to cascaded connection, it can be unassigned, and they will be having value zero. Keeping the initial value as zero will create error in other features like port forwarding since DSA will misunderstood these as port index zero. So keep the default values as 0xFF which is of invalid value so that if nothing assigned, taking bitmap of the cpu_port or dsa_port will not cause any harm. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz_common.c | 4 +++ drivers/net/dsa/microchip/ksz_common.h | 2 ++ drivers/net/dsa/microchip/lan937x.h | 1 + drivers/net/dsa/microchip/lan937x_main.c | 31 ++++++++++++++++++++++++ drivers/net/dsa/microchip/lan937x_reg.h | 3 +++ 5 files changed, 41 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index d2ec5acd7b17..ada673b6efc6 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -292,6 +292,7 @@ static const struct ksz_dev_ops lan937x_dev_ops = { .change_mtu = lan937x_change_mtu, .phylink_mac_link_up = ksz9477_phylink_mac_link_up, .config_cpu_port = lan937x_config_cpu_port, + .config_dsa_port = lan937x_config_dsa_port, .tc_cbs_set_cinc = lan937x_tc_cbs_set_cinc, .enable_stp_addr = ksz9477_enable_stp_addr, .reset = lan937x_reset_switch, @@ -2095,6 +2096,9 @@ static int ksz_setup(struct dsa_switch *ds) dev->dev_ops->config_cpu_port(ds); + if (dev->dev_ops->config_dsa_port) + dev->dev_ops->config_dsa_port(ds); + dev->dev_ops->enable_stp_addr(dev); ds->num_tx_queues = dev->info->num_tx_queues; diff --git a/drivers/net/dsa/microchip/ksz_common.h b/drivers/net/dsa/microchip/ksz_common.h index aab60f2587bf..c3c3eee178f4 100644 --- a/drivers/net/dsa/microchip/ksz_common.h +++ b/drivers/net/dsa/microchip/ksz_common.h @@ -147,6 +147,7 @@ struct ksz_device { u32 chip_id; u8 chip_rev; int cpu_port; /* port connected to CPU */ + int dsa_port; /* Port used as cascaded port */ u32 smi_index; int phy_port_cnt; phy_interface_t compat_interface; @@ -358,6 +359,7 @@ struct ksz_dev_ops { void (*setup_rgmii_delay)(struct ksz_device *dev, int port); int (*tc_cbs_set_cinc)(struct ksz_device *dev, int port, u32 val); void (*config_cpu_port)(struct dsa_switch *ds); + void (*config_dsa_port)(struct dsa_switch *ds); int (*enable_stp_addr)(struct ksz_device *dev); int (*reset)(struct ksz_device *dev); int (*init)(struct ksz_device *dev); diff --git a/drivers/net/dsa/microchip/lan937x.h b/drivers/net/dsa/microchip/lan937x.h index 3388d91dbc44..ef84abc31556 100644 --- a/drivers/net/dsa/microchip/lan937x.h +++ b/drivers/net/dsa/microchip/lan937x.h @@ -11,6 +11,7 @@ int lan937x_setup(struct dsa_switch *ds); void lan937x_teardown(struct dsa_switch *ds); void lan937x_port_setup(struct ksz_device *dev, int port, bool cpu_port); void lan937x_config_cpu_port(struct dsa_switch *ds); +void lan937x_config_dsa_port(struct dsa_switch *ds); int lan937x_switch_init(struct ksz_device *dev); void lan937x_switch_exit(struct ksz_device *dev); int lan937x_r_phy(struct ksz_device *dev, u16 addr, u16 reg, u16 *data); diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c index 399a3905e6ca..5108a3f4bf76 100644 --- a/drivers/net/dsa/microchip/lan937x_main.c +++ b/drivers/net/dsa/microchip/lan937x_main.c @@ -205,11 +205,42 @@ void lan937x_port_setup(struct ksz_device *dev, int port, bool cpu_port) dev->dev_ops->cfg_port_member(dev, port, member); } +void lan937x_config_dsa_port(struct dsa_switch *ds) +{ + struct ksz_device *dev = ds->priv; + struct dsa_port *dp; + + dev->dsa_port = 0xFF; + + dsa_switch_for_each_port(dp, ds) { + if (dsa_is_dsa_port(ds, dp->index)) { + ksz_rmw32(dev, REG_SW_CASCADE_MODE_CTL, + CASCADE_PORT_SEL, dp->index); + dev->dsa_port = dp->index; + + /* Tail tag should be enabled for switch 0 + * in cascaded connection. + */ + if (dev->smi_index == 0) { + lan937x_port_cfg(dev, dp->index, REG_PORT_CTRL_0, + PORT_TAIL_TAG_ENABLE, true); + } + + /* Frame check length should be disabled for cascaded ports */ + lan937x_port_cfg(dev, dp->index, REG_PORT_MAC_CTRL_0, + PORT_CHECK_LENGTH, false); + } + } +} + void lan937x_config_cpu_port(struct dsa_switch *ds) { struct ksz_device *dev = ds->priv; struct dsa_port *dp; + /* Initializing cpu_port parameter into invalid value */ + dev->cpu_port = 0xFF; + dsa_switch_for_each_cpu_port(dp, ds) { if (dev->info->cpu_ports & (1 << dp->index)) { dev->cpu_port = dp->index; diff --git a/drivers/net/dsa/microchip/lan937x_reg.h b/drivers/net/dsa/microchip/lan937x_reg.h index 45b606b6429f..4f30bc12f7a9 100644 --- a/drivers/net/dsa/microchip/lan937x_reg.h +++ b/drivers/net/dsa/microchip/lan937x_reg.h @@ -32,6 +32,9 @@ #define REG_SW_PORT_INT_STATUS__4 0x0018 #define REG_SW_PORT_INT_MASK__4 0x001C +#define REG_SW_CASCADE_MODE_CTL 0x0030 +#define CASCADE_PORT_SEL 7 + /* 1 - Global */ #define REG_SW_GLOBAL_OUTPUT_CTRL__1 0x0103 #define SW_CLK125_ENB BIT(1) From patchwork Thu Feb 2 12:59:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 51910 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp221301wrn; Thu, 2 Feb 2023 05:00:20 -0800 (PST) X-Google-Smtp-Source: AK7set+/CdjmCTnIKTJeuUIPXgFi5gejKsLWdDUNujklX1jxWz+O7olRNWVyluA6b1OAjcoQANnA X-Received: by 2002:a17:906:48ce:b0:887:4da4:d332 with SMTP id d14-20020a17090648ce00b008874da4d332mr6403262ejt.38.1675342819870; Thu, 02 Feb 2023 05:00:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675342819; cv=none; d=google.com; s=arc-20160816; b=L3O9s6QYeS7Io9PyD2S5dNzjegyn/7rnt7ToLoKaBKrGuwD1ds1hio/3R+XpxlXyze 9viiT9I/tzBR7zqnV929fn8AMtKf9Fsw4zeIhQfA/872ZZJvOxHrV4g1a6fn1EjRL4nF CWxFTf2xrH9Q1cy4Rp5ENATYaV7Iq1yaueRVbK2/MmgK2zB1HE79UdTIeU5N3HGOax0J qMU0YsSZD7U8TvcK45PL4KQqxcWAK/J+ypJvB6sFDGgxw96u2DBpAiXAFpRbO0566RsA vVNZUj0KFqnOzaW2pqCz1gP3PJBs3i73Wgm7UiqoTDM42C+vBbR/kECtgpY5V4qzhuOH TkOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+7xBwrMw6xIeFWq8mT+QRiHdDQgWXo+qnWRS6dw+w64=; b=u7UPDm3lhvbLvwogN3tTB8Mla2oLBggBJUZC4FUa+HdCkOtJwXZXJ1OSpe3ns0m9Nx o734UgaQjKodas6ENomOnN/KZpiZAMkcZadvDFuyIPRlxVvLRoVQWvyWeOSaEfiqZ90f /nN6tSRZ+Mda2dTEo0ynYuvMreJ9s+7KADequFEl9VeJR8bhvQICBOlqNGGy5iYlcFSw Fe8KF6JYb4jBUDsNh9H1t5z4qQ9VMyAOaRH33TiP1zoL21ZobqljabTNu6dvAd0IHT0H Yjfjh30zfJusgCbDaEYAx5QvD4GVS7+ydM5IObYgIcT5iiK6SNHKCDMJvYgWSiyv2kDs t2jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=NbX8cCPd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020a170906738500b008621404f1d6si26768822ejl.892.2023.02.02.04.59.56; Thu, 02 Feb 2023 05:00:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=NbX8cCPd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232354AbjBBM7A (ORCPT + 99 others); Thu, 2 Feb 2023 07:59:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59324 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232145AbjBBM6v (ORCPT ); Thu, 2 Feb 2023 07:58:51 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.153.233]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C55C6EAFB; Thu, 2 Feb 2023 04:58:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675342730; x=1706878730; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=a227EjQrvydGYIKcbwgGhKJ7ZtgW5ewg9wl5/GCvx7U=; b=NbX8cCPd1fLE7N2TwNJ5L7aHc3Cl1NxvtJI2JcyIhH3iItretLIpfvFe 1qYqTbFf+JvhcLNWX1lBexVnD+xK2aRK9q5IqdOkOC+EKj57kY9qY29DK vjQke1fK+ndYIF9/6qK1cr3h7sLNvohaC+hfJf7cf5Yoxh/gbj+aV8sIf JZffQhuX6lUkMtr1VsgYkaP7r2iGmURS4vRZ/yfFNWkV9vUfSBIoePkPG 9xbTymhzik/txlnPW5oUroCYNxDGmoP/FTkAr2xHUPiFIph5zJRH+BJlP a5eoTMpyhSnLTnNABcH3xYL07JuIwV3xEqWAqxSqg/tj7wM18mua2TlOV Q==; X-IronPort-AV: E=Sophos;i="5.97,267,1669100400"; d="scan'208";a="210318418" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa1.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Feb 2023 05:58:49 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex04.mchp-main.com (10.10.85.152) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Feb 2023 05:58:49 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Feb 2023 05:58:45 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [RFC PATCH net-next 04/11] net: dsa: microchip: lan937x: update port number for LAN9373 Date: Thu, 2 Feb 2023 18:29:23 +0530 Message-ID: <20230202125930.271740-5-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> References: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756724273166587085?= X-GMAIL-MSGID: =?utf-8?q?1756724273166587085?= LAN9373 have total 8 physical ports. Update port_cnt member in ksz_chip_data structure. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index ada673b6efc6..7062ce1749fb 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -1490,7 +1490,7 @@ const struct ksz_chip_data ksz_switch_chips[] = { .num_alus = 1024, .num_statics = 256, .cpu_ports = 0x38, /* can be configured as cpu port */ - .port_cnt = 5, /* total physical port count */ + .port_cnt = 8, /* total physical port count */ .port_nirqs = 6, .num_tx_queues = 8, .tc_cbs_supported = true, From patchwork Thu Feb 2 12:59:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 51911 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp221604wrn; Thu, 2 Feb 2023 05:00:50 -0800 (PST) X-Google-Smtp-Source: AK7set/avnQIe6BDmRdm4zIurh+ukDO/Xx70v/uefqikUMiovBGna3qPLZLyq81r7ppu6pb1bE0X X-Received: by 2002:a05:6402:1146:b0:492:609a:f148 with SMTP id g6-20020a056402114600b00492609af148mr6240913edw.3.1675342850097; Thu, 02 Feb 2023 05:00:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675342850; cv=none; d=google.com; s=arc-20160816; b=j9O8s8aZqPwBojJWn0Kvhc29RA77Orx4LVxQKfJolRnv0cXM+Gu5k1EubxnZfUwgVg uC+ri7tLU0SzzoUxtq1BC5EEe9e98RJe7Y9icNYc4DFGIIxIaaMzHVhBj7kl40x9PJYV aeXi0nUMhIxHdUSoE14AP7pkMMy30WUDoVKs3mf3t6lDDc+zv+yfeDcoEjQYBauppKrQ OQuorcbPGAyvDUcw6UxY8fknguTcLOKv9rq8AXvzaLqZRALWMrxihTUHimVv8sLCDTdl TU3s6bS/gWVaTzxAlqArp0swRg5G3uO+Cn6+893TqV6MZopzCco7b2Dw9WoSqw4i77Zj IMUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Disen6rdiT2ayQgp0btUaKgSVAw7VLKB6y0LGZQ3THE=; b=tK9dcHqo+ZznaVJ3bJs4wYOXdK/1CVr/MkGB+CH8AHGVNysL9Gbo+yWqPkAijETmOw o0tZESx5Qjibi4rhb4JflkxVXKP06dAzGbgkylQeaJgDSY+65XJAQvl4xNCD2Twid2yV FYn7iE+RKXNcoBey0UErhAcA6O+ooLzUmqUXZ2kaJMG2lvvy+nEVWxUbuYpYQnDF5SXK v40dQuntwxHoreM+iNqw9P5cGQHO1lDl2P96/Q+Ic+gERhYhme4i6yVYHTMJ/DXOKv5d 7hdK2LgkbrnN6vlPv5dXZlZfS3lAkADhIVZLVtGxfhpK1fp5C647W3t4RALmGttCzrBp oRpg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="xh/ILQrO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q12-20020a056402032c00b004a245704d9esi12940785edw.303.2023.02.02.05.00.21; Thu, 02 Feb 2023 05:00:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="xh/ILQrO"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232396AbjBBM7S (ORCPT + 99 others); Thu, 2 Feb 2023 07:59:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59650 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232371AbjBBM7D (ORCPT ); Thu, 2 Feb 2023 07:59:03 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F67B8E484; Thu, 2 Feb 2023 04:59:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675342740; x=1706878740; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=09IBqS4LmrOKoAcjHwQjILLjOKkVRx2085Me/Fn628s=; b=xh/ILQrOOKZfZ737sSsXrL3SRW5et8xnY4qKGt1D3mVWqBeId3Hj8o2J RuukaqzZZWW9Nm3izAuI4DpUtgmfQdkmKEpKk0QWgZNBln1z5mMEfvFlh kvg5/x8j/djBZs1H0QrkWZeUnLUDXHvScHAY81Y4a35uv+90PFCsKN3pZ vJr/3bl6zsKdH4QdFD54GsVBesoK8lbtA0B3KTJsuC2FFMkvP7WgwKquB RRi5zLGyP2wpNGgrOe/DFWj6tanIB2gcmVJsbhUAeONpZW0eq7TmvfGEM tH6GIv1hU0yvn1+qcjtIG/KZNGnzONNUhvWGD7uRzaAFAX9y5mhqjloV7 Q==; X-IronPort-AV: E=Sophos;i="5.97,267,1669100400"; d="scan'208";a="198620642" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa2.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Feb 2023 05:58:59 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Feb 2023 05:58:54 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Feb 2023 05:58:50 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [RFC PATCH net-next 05/11] net: dsa: microchip: lan937x: add shared global interrupt Date: Thu, 2 Feb 2023 18:29:24 +0530 Message-ID: <20230202125930.271740-6-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> References: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756724304765054958?= X-GMAIL-MSGID: =?utf-8?q?1756724304765054958?= In cascade mode interrupt line is shared among both switches. Update global interrupt flag for shared interrupt, otherwise second switch probe will fail with busy status. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz_common.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 7062ce1749fb..adf8391dd29f 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -2009,7 +2009,8 @@ static irqreturn_t ksz_irq_thread_fn(int irq, void *dev_id) return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE); } -static int ksz_irq_common_setup(struct ksz_device *dev, struct ksz_irq *kirq) +static int ksz_irq_common_setup(struct ksz_device *dev, struct ksz_irq *kirq, + unsigned long flag) { int ret, n; @@ -2025,7 +2026,7 @@ static int ksz_irq_common_setup(struct ksz_device *dev, struct ksz_irq *kirq) irq_create_mapping(kirq->domain, n); ret = request_threaded_irq(kirq->irq_num, NULL, ksz_irq_thread_fn, - IRQF_ONESHOT, kirq->name, kirq); + flag, kirq->name, kirq); if (ret) goto out; @@ -2048,7 +2049,7 @@ static int ksz_girq_setup(struct ksz_device *dev) girq->irq_num = dev->irq; - return ksz_irq_common_setup(dev, girq); + return ksz_irq_common_setup(dev, girq, (IRQF_ONESHOT | IRQF_SHARED)); } static int ksz_pirq_setup(struct ksz_device *dev, u8 p) @@ -2064,7 +2065,7 @@ static int ksz_pirq_setup(struct ksz_device *dev, u8 p) if (pirq->irq_num < 0) return pirq->irq_num; - return ksz_irq_common_setup(dev, pirq); + return ksz_irq_common_setup(dev, pirq, IRQF_ONESHOT); } static int ksz_setup(struct dsa_switch *ds) From patchwork Thu Feb 2 12:59:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 51912 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp221735wrn; Thu, 2 Feb 2023 05:01:00 -0800 (PST) X-Google-Smtp-Source: AK7set+RpcRP7uskWMsi9PBhV05I5WvvF4rzf4Bkh9ycOE5DmPYGQi8Czckf7VxN1FQAZx7PSXee X-Received: by 2002:a17:906:407:b0:887:3c7e:5df with SMTP id d7-20020a170906040700b008873c7e05dfmr6418164eja.73.1675342860138; Thu, 02 Feb 2023 05:01:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675342860; cv=none; d=google.com; s=arc-20160816; b=egurEW9M6ihFAZKegq4llhIKIe6VkFWUXEk7fs99FywHwblmYJrRzTRhAay7G+es+n j1ng4iy9kqxBNyonRivp5qWag8japBcMavxsjs5gpW2xvCAH63zqE/R5R86yPkVvQpGo awMG0CZhpijffHBWBJQiuUBtdFoPOvdSqiWyJvFoxnd0153DwAC75lI1TUXKNsMvfWUF X8+iNJSxUT2hf2Z1Y3+L+EbWMgWexPYFORAr7HHqBuBXMsTbvHl0kXwYKYBtPXwIWcsz WBGU/qI3f88OvTqRvvzWwK/tK13UxjGhuPssC/tDlm6XN2d97HRCBxfAXaAK+p9t3pN2 wb8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=lVBdfDYx63XdgSjjLPZsLSN0Wdd0qjfOcuPnlz6uuKA=; b=Jv379ajQmDJL8ZBUXypRQxE9MMF7BAZQwaDiAVn/z+sGrwStAQbiO3wG0BEEdIOtxx LLwgkAc6NmaKtjD7c0VJFpb3QdJVAwFsl44tLSuSlkaqArX/fDqSAVroTIjYO4YjEVPL FEsI0uxHniAtpDhiJYDFwI5k67WISkgmsiLFi2BzyyV1pS10eEJRICflNYo5Qof9DZS2 QdfxdJ1fYQyZ0kMLGUx3Z7bixv+DrTY2dezhI0qYhbTkjVQsFBwa0andfcfIMd28JK1D GDdJLpCsDH9o7ow7rtSfRPGDn+5pxL0xk6t2NouOPoduz2vW55/vuJrhyvn0W9ehG4kx 2Fig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=St3z3Em+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 12-20020a170906000c00b0087766403eccsi28382389eja.819.2023.02.02.05.00.34; Thu, 02 Feb 2023 05:01:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=St3z3Em+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232506AbjBBM7U (ORCPT + 99 others); Thu, 2 Feb 2023 07:59:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232372AbjBBM7D (ORCPT ); Thu, 2 Feb 2023 07:59:03 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5FCD689FAC; Thu, 2 Feb 2023 04:59:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675342741; x=1706878741; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=32H2oJWTk/bY+4r4IuXy3k5EXeQhNmioppl2l7N7A2E=; b=St3z3Em+sFB1Naes9cIk9mdM0mhZF1hfBRVP3q/xy+VbJ+VddBeYDacW PQibYf/GYKF2iAeXDuPaFac3Vs495+kyLmh2wy3U+wX4yxoqxHd6bDkU1 ujWQuIMZoGoMStOiNhAlllhz/IcQbRd5KzHCK39TR7z0Z7W9tu9X4MG2L mBlVN51k5TfT/ctOGKCv4V8rjUdI4Cq7IWFkbWhh1myzMN6OH6+qgnUts a4fXeJXdOeIRWNKH2V2ptQokPEfhcDoh6XZgM5opXGFU3zZOPhw086a3n sA5QO8aO0hGmOwIVbTQEvZcUbJx5Pm0qMmp1x++/Y7UCJWcfoJd3FpVIO g==; X-IronPort-AV: E=Sophos;i="5.97,267,1669100400"; d="scan'208";a="135251838" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Feb 2023 05:59:00 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex01.mchp-main.com (10.10.85.143) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Feb 2023 05:59:00 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Feb 2023 05:58:55 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [RFC PATCH net-next 06/11] net: dsa: microchip: lan937x: get cascade tag protocol Date: Thu, 2 Feb 2023 18:29:25 +0530 Message-ID: <20230202125930.271740-7-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> References: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756724314711836926?= X-GMAIL-MSGID: =?utf-8?q?1756724314711836926?= Update ksz_get_tag_protocol to return separate tag protocol if switch is connected in cascade mode. Variable ds->dst->last_switch will contain total number of switches registered. For cascaded connection alone, this will be more than zero. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz_common.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index adf8391dd29f..2160a3e61a5a 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -2567,9 +2567,13 @@ static enum dsa_tag_protocol ksz_get_tag_protocol(struct dsa_switch *ds, dev->chip_id == KSZ9567_CHIP_ID) proto = DSA_TAG_PROTO_KSZ9477; - if (is_lan937x(dev)) + if (is_lan937x(dev)) { proto = DSA_TAG_PROTO_LAN937X_VALUE; + if (ds->dst->last_switch) + proto = DSA_TAG_PROTO_LAN937X_CASCADE_VALUE; + } + return proto; } From patchwork Thu Feb 2 12:59:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 51916 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp232558wrn; Thu, 2 Feb 2023 05:19:57 -0800 (PST) X-Google-Smtp-Source: AK7set9qEbhlDFlWewEgDEj5oS8OwirVvL0KlIjEGITkHvLSL8pimSQ3NVl4+zju0os/3tGrzG+t X-Received: by 2002:a05:6a20:1615:b0:bc:4d0c:ce45 with SMTP id l21-20020a056a20161500b000bc4d0cce45mr8012684pzj.53.1675343997614; Thu, 02 Feb 2023 05:19:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675343997; cv=none; d=google.com; s=arc-20160816; b=1JFe7KmyUEAIdV2unHGXLApTy415fU1Tme7ORsiHAjJra1CAMPnPd7+4qAHeLVJT7y 99vVLFdW39HycNsPXP0D/1vqBVWu0dGp8GHyxlyV0v/8AU5uV52zlkEkQLAImO4bo6ij NVq+wE9zLnotfcTOjCbj7YmqkAQIS62VESbsc2HoinWyU+pOCfKvY9dL1iadjkV7CBHM 3smeCmZc2Rcjc61mCoa/IkQTiO47U/Cp+RnlMUF5TA/E5iTHfbi+IJm5yNF4DfR3DbRb gtXQ1ryDv02aSR1UWIn/4sQwozlZPn+Dk7DOn+fMk1KBsHKB0GTmNL2mTOVq10rOa6/F RkJQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8vaB2nzg1NiGUwy3efKPMjZ6Dtjev1+EL0Clby/39LI=; b=lDLLhnAYZdEy+VAPbcIQf+3kCNfG0kFzhLYbxVJ+C3N176n2BBmwLPLDoZ2cXwhzFz GfmYKHeoNjSK0zWqyp/rxBJwlz4+vEFZR/Rov1N4GXSMunk9L/nktXb8xPci3pkzkT3L 0OdUTcv1ysVm4Y1C0izBBRX7dL2GIvTpZTGiPqH9WfWdfGF/UFIz4LE8o5ce6nNEdlwd YvDflXmg01kGmjXuzrHs4j8QlPRofM7T/OEfb1UfFHN8rzit/NJ28lWSQK7aty2AFqDu exe4bJBKkViHgMivja13caOkgLBK4l4HElNXGMNPozamHqVIWoxGv+YoRE84GJnacr1Z 9NEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="wN/tie7P"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m4-20020a656a04000000b004cc3c59b5f0si26814956pgu.329.2023.02.02.05.19.44; Thu, 02 Feb 2023 05:19:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b="wN/tie7P"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232478AbjBBM7j (ORCPT + 99 others); Thu, 2 Feb 2023 07:59:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59720 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232375AbjBBM7R (ORCPT ); Thu, 2 Feb 2023 07:59:17 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 477418F241; Thu, 2 Feb 2023 04:59:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675342749; x=1706878749; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=gOPgGw0RohtMRFMCFrPybEvNkhUd8DRkAKdQTixdWLk=; b=wN/tie7PXKsvgyYPNfmOkfUVkYMGFhEVyLZK00FvOasaK7psHFcP1jOG 54bL5xl+kyEU/2UXRqycUh9pn00FcsjuzZ+aq07tzXPLBp1BxS1p/Y+J0 3UY5zfA0gERa6Iz005fxWOIGgb03JHt5EP2tPVFh6e/nGUCLUBxH3SKyU 9OECkTzbXzLpsB1BFr0ToLg981AJGmxlEA0l6NVQ1zrv7Xsoh2Y8rFXFm bBlp+ugzlhI8kRv1lvJ711piq+7XdOXOOA0GJsYD0whSWK8gecg+B8EPi f+02oK+rD3Ek7vot+EfFeWmGQSY+B9wMJn94Wd6FvnEbaLIOUBhx9GYV9 g==; X-IronPort-AV: E=Sophos;i="5.97,267,1669100400"; d="scan'208";a="135251855" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Feb 2023 05:59:08 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Feb 2023 05:59:05 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Feb 2023 05:59:01 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [RFC PATCH net-next 07/11] net: dsa: microchip: lan937x: update switch register Date: Thu, 2 Feb 2023 18:29:26 +0530 Message-ID: <20230202125930.271740-8-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> References: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756725507609476640?= X-GMAIL-MSGID: =?utf-8?q?1756725507609476640?= Second switch in cascaded connection doesn't have port with macb interface. dsa_switch_register returns error if macb interface is not up. Due to this reason, second switch in cascaded connection will not report error during dsa_switch_register and mib thread work will be invoked even if actual switch register is not done. This will lead to kernel warning and it can be avoided by checking device tree setup status. This will return true only after actual switch register is done. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz_common.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 2160a3e61a5a..0df71156a540 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -3213,6 +3213,7 @@ int ksz_switch_register(struct ksz_device *dev) { const struct ksz_chip_data *info; struct device_node *port, *ports; + struct dsa_switch_tree *dst; phy_interface_t interface; unsigned int port_num; int ret; @@ -3330,6 +3331,15 @@ int ksz_switch_register(struct ksz_device *dev) return ret; } + /* Do not proceed further if device tree setup is not done. + * dsa_register_switch() will not report error in case of + * cascaded switch. This will lead to scheduling mib read + * work and kernel warning. + */ + dst = dev->ds->dst; + if (!dst->setup) + return 0; + /* Read MIB counters every 30 seconds to avoid overflow. */ dev->mib_read_interval = msecs_to_jiffies(5000); From patchwork Thu Feb 2 12:59:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 51913 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp223091wrn; Thu, 2 Feb 2023 05:03:02 -0800 (PST) X-Google-Smtp-Source: AK7set82NilbpQjr82Da7EoOTVceX+tFa4XUpp06bCKTzl/uN5OhqpMQ4yYTAQ2ANMZbty3fwrkn X-Received: by 2002:a17:90b:3a90:b0:22c:19e4:a66f with SMTP id om16-20020a17090b3a9000b0022c19e4a66fmr6606066pjb.12.1675342982049; Thu, 02 Feb 2023 05:03:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675342982; cv=none; d=google.com; s=arc-20160816; b=XPMUElPtKZ452B/nPcWoJGiyX12e5N2VA/AHYGVFxz+vRGGRqvkZvHUhM/ZSjYxzEc vg5WX+tDQNvOgL99oy8fXaRHL/jGN1+sOrw8nG4D+eVhHs0SQveEjAfZV+qQtaDhjSgw nPGdgAWeEHBPCQM5ZLwG6rEfARGRsTl/ki16o7cb+DoLr+4LvsE8E7h9nwlTEvU9gj2y 0AHH1HGQM7n1z3F3WYl2D0IGnRqcjdiMAH+xlPRc3FzJ8qZL4pQnfffiA6Gxo0sDhTyC j+CEsUY0bAz+nckHlcDGGx+xKkmdUcy+r2qsQJi5wgMNlm7hE0kCwcLaSyixXVWzcsTe nO0A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=vDkeb5Hl/EOH7ChHpsMWYS4xDofL1ajPIuXZQqNG/9c=; b=vYINrnL7vuWq8mPQAGp66FRY7HV9u54rvPXHG+VBTrhSU6f0ZvjsM+aYgnPOS0onah SsNS68s7BB3jnZIM1ThSbm1wypol9XVAhhdo9LGLP4pz1/vaBPlxJxMtCuKqEFtd2kh8 VGJQfj7dyo83b8FpGk9O/WiXUqmlodwGgOAonm/Q+OBFnIhR+DreO9oq6FvmCyuR305M MCNuaQKhl/Mhz/N7417MgaPw7F2Nicqowx9AoJsr5Puv/KVmdXnjCPJzA1YhJYWqMgP4 LUz62/xGpMOzwIB4jtDUR2RhMUdAW9My3pmWYbzhtkEcEd1Lhkt4kCaDISR/DODRHONX OI/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=ruAuCAvm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z11-20020a17090ab10b00b0022e6374dc2asi4681574pjq.12.2023.02.02.05.02.42; Thu, 02 Feb 2023 05:03:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=ruAuCAvm; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232550AbjBBM7p (ORCPT + 99 others); Thu, 2 Feb 2023 07:59:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60604 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232300AbjBBM7U (ORCPT ); Thu, 2 Feb 2023 07:59:20 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72B118F25B; Thu, 2 Feb 2023 04:59:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675342752; x=1706878752; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=IPrDFvqI3OZVkXu9LgANLuFGMbNRDf2adVIuQuhodQ4=; b=ruAuCAvm3vIujiNwqYsYVNOBzTXBCBYVAniNwYzHhie02EPuwuY+0sKX wLMni1nTN8t9u3AoLvlirZM1+v3ETOmr+eXf/qsDZt55MWuWN52TkwCNf BqndCA4Fw+zv1Am5jj29rYxZrdzyUk5w8IRi7gAkHesfSwPHXT3dZ6igG wYeQJOw/KMi+S8uT1jQ9UsMXHvrh8Hq1xsFQK7rzqZIQ2iIyHfAAkUcrg mH6PHPvWiWbg0/Pw5ljy48xA3bZF+W2Ey2+eYCrtZ7OTCmIicKW1uhF6S oBTdJvE6pq7ZV/94SJ+PJrmqoIsX9I3L/YCkPCll52K5RCqHoCHFSRWRX Q==; X-IronPort-AV: E=Sophos;i="5.97,267,1669100400"; d="scan'208";a="135251882" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Feb 2023 05:59:11 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Feb 2023 05:59:10 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Feb 2023 05:59:06 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [RFC PATCH net-next 08/11] net: dsa: microchip: lan937x: avoid mib read for cascaded port Date: Thu, 2 Feb 2023 18:29:27 +0530 Message-ID: <20230202125930.271740-9-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> References: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756724442462316058?= X-GMAIL-MSGID: =?utf-8?q?1756724442462316058?= Cascaded port need not be involved in mib read process. Unlike cpu port, mib read function will be called for all other ports. Add check to skip function if port is of type DSA_PORT_TYPE_DSA. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz_common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 0df71156a540..913296c5dd50 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -2230,7 +2230,8 @@ static void ksz_mib_read_work(struct work_struct *work) int i; for (i = 0; i < dev->info->port_cnt; i++) { - if (dsa_is_unused_port(dev->ds, i)) + if (dsa_is_unused_port(dev->ds, i) || + dsa_is_dsa_port(dev->ds, i)) continue; p = &dev->ports[i]; From patchwork Thu Feb 2 12:59:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 51915 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp229602wrn; Thu, 2 Feb 2023 05:14:20 -0800 (PST) X-Google-Smtp-Source: AK7set8Kca4CL4XfohZcD3ZAZPoWHBGlEs7tV3BIz7EadyzbmywVrYhtbiRCpJWPzw22gECNB9JT X-Received: by 2002:a17:906:c5a:b0:88e:e926:8bb1 with SMTP id t26-20020a1709060c5a00b0088ee9268bb1mr1491377ejf.76.1675343660161; Thu, 02 Feb 2023 05:14:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675343660; cv=none; d=google.com; s=arc-20160816; b=yZ18gK7RtX3j5LzuvMBWTdaJ07A7MZycef222Zzjq3QhHjFDTMMnL3DdOmi3WX+NcN 1X44+p4I39MjbxvLLrIyqid7e4xG/W8FBE9ppuKGHXA/dAqzQM6DfeUyJN40GYkaM4d/ gkLmNPQRLHve4CXxnM815wZxnb43ZRr/EvywlWv704CAN+36sEWWzQ1r2be7w/BBYemL JgL8YpfiEWjz/TrD3ky5z3ENrIOnhrg0iQ3Phv9htK/J3AvPJTQnYH5Qd8eb+lP44NeO rnH44OZ3ScMTwvOtMc9kG650b4GRmC/tvYGTwqsNb1MVAGwMbaWQUHhT+mE/OufGqknx tyxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LUoRRFsSTI14JFzlXbWaondel/hqIYOuvsqJOm1xhPs=; b=nv3zpAA/aCCRMEYfmTOp1Ulh8BqfSeeMseoJawjkXSUFUSlIVwJ83PeMOIjbv8sHLr LejR+uDM6rBteet9UWb/zfaw2eZPLpxtq6xS4i++3GExW+IaGmenXIIBp/osCD7WYcJU rn1tDTOo+qjN6rWYdJ625u+3Md5/qlUuqyZL6rgbEYvrhnn5ou0uJ/w5KwoiT9wLO8DY 6Htg5YsdbJ3eMimT/NJnColcReEEmmswBmbfngnVckpqlzvdTDYjuQin5YT6qdZDSi6E 0z9BwaY+ypHthF/6DrNSp8xlxasPiS9N6VwEw2CZxao/BlxNLqN7v9Utyi0IKi/AGBd8 CZzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=xLZmsHz8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wi23-20020a170906fd5700b0087c18c0db19si16914081ejb.506.2023.02.02.05.13.38; Thu, 02 Feb 2023 05:14:20 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=xLZmsHz8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232387AbjBBNAD (ORCPT + 99 others); Thu, 2 Feb 2023 08:00:03 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232453AbjBBM7h (ORCPT ); Thu, 2 Feb 2023 07:59:37 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37ED68E49E; Thu, 2 Feb 2023 04:59:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675342758; x=1706878758; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OJg0llhgyQd77eI4/rlRjP9TKpD1ddTPYFukai6jCVo=; b=xLZmsHz84cowWyVJQWW4+YybwYQpbdvMkzFa0kw5ALpVBLJ6+I7oDU+p REACz9KM8HrG4ltsJxge3ir95wXiJ67FJhjY9xmf1tqCa5iknmsjeTclq 0bfLiWfxaGGQsQkyeZ5IB6ABFz5Dza9d5bndEJPGIy9zZrBhYEU6D3EQY ChK2WJeLazomN0J2oi0DOEMv2pwFCrd3CBRu0/qDwGwp7iSJDljBcQkwc TzK03W5kYWRcealhC5rc23OA6aa/+705qJfbVG7pFpePcDVpqyvULSGEF sJ09S3fX7jmWqVXqkEJ1knp8Y6p6UmSF4pJqRbHzlFLIjLtjvuoZ16kjN A==; X-IronPort-AV: E=Sophos;i="5.97,267,1669100400"; d="scan'208";a="135252001" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Feb 2023 05:59:17 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Feb 2023 05:59:15 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Feb 2023 05:59:11 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [RFC PATCH net-next 09/11] net: dsa: microchip: lan937x: update port membership with dsa port Date: Thu, 2 Feb 2023 18:29:28 +0530 Message-ID: <20230202125930.271740-10-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> References: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756725154194272410?= X-GMAIL-MSGID: =?utf-8?q?1756725154194272410?= Like cpu port, cascaded port will act as host port in second switch. And all ports from both switches should be able to forward packets to cascaded ports. Add cascaded port (dev->dsa_port) to each port membership. Current design add bit map of user ports as cpu port membership. Include cascaded port index as well to this group. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz_common.c | 7 ++++--- drivers/net/dsa/microchip/lan937x_main.c | 2 +- include/net/dsa.h | 15 +++++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c index 913296c5dd50..b8b7b5b7b52d 100644 --- a/drivers/net/dsa/microchip/ksz_common.c +++ b/drivers/net/dsa/microchip/ksz_common.c @@ -1748,9 +1748,9 @@ static void ksz_get_strings(struct dsa_switch *ds, int port, static void ksz_update_port_member(struct ksz_device *dev, int port) { + u8 port_member = 0, cpu_port, dsa_port; struct ksz_port *p = &dev->ports[port]; struct dsa_switch *ds = dev->ds; - u8 port_member = 0, cpu_port; const struct dsa_port *dp; int i, j; @@ -1759,6 +1759,7 @@ static void ksz_update_port_member(struct ksz_device *dev, int port) dp = dsa_to_port(ds, port); cpu_port = BIT(dsa_upstream_port(ds, port)); + dsa_port = BIT(dev->dsa_port); for (i = 0; i < ds->num_ports; i++) { const struct dsa_port *other_dp = dsa_to_port(ds, i); @@ -1798,10 +1799,10 @@ static void ksz_update_port_member(struct ksz_device *dev, int port) val |= BIT(j); } - dev->dev_ops->cfg_port_member(dev, i, val | cpu_port); + dev->dev_ops->cfg_port_member(dev, i, val | cpu_port | dsa_port); } - dev->dev_ops->cfg_port_member(dev, port, port_member | cpu_port); + dev->dev_ops->cfg_port_member(dev, port, port_member | cpu_port | dsa_port); } static int ksz_sw_mdio_read(struct mii_bus *bus, int addr, int regnum) diff --git a/drivers/net/dsa/microchip/lan937x_main.c b/drivers/net/dsa/microchip/lan937x_main.c index 5108a3f4bf76..b17bb1ea2a4a 100644 --- a/drivers/net/dsa/microchip/lan937x_main.c +++ b/drivers/net/dsa/microchip/lan937x_main.c @@ -198,7 +198,7 @@ void lan937x_port_setup(struct ksz_device *dev, int port, bool cpu_port) true); if (cpu_port) - member = dsa_user_ports(ds); + member = dsa_user_ports(ds) | dsa_dsa_ports(ds); else member = BIT(dsa_upstream_port(ds, port)); diff --git a/include/net/dsa.h b/include/net/dsa.h index 55651ad29193..939aa6ff1a38 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -591,6 +591,10 @@ static inline bool dsa_is_user_port(struct dsa_switch *ds, int p) dsa_switch_for_each_port((_dp), (_ds)) \ if (dsa_port_is_cpu((_dp))) +#define dsa_switch_for_each_dsa_port(_dp, _ds) \ + dsa_switch_for_each_port((_dp), (_ds)) \ + if (dsa_port_is_dsa((_dp))) + #define dsa_switch_for_each_cpu_port_continue_reverse(_dp, _ds) \ dsa_switch_for_each_port_continue_reverse((_dp), (_ds)) \ if (dsa_port_is_cpu((_dp))) @@ -617,6 +621,17 @@ static inline u32 dsa_cpu_ports(struct dsa_switch *ds) return mask; } +static inline u32 dsa_dsa_ports(struct dsa_switch *ds) +{ + struct dsa_port *dsa_dp; + u32 mask = 0; + + dsa_switch_for_each_dsa_port(dsa_dp, ds) + mask |= BIT(dsa_dp->index); + + return mask; +} + /* Return the local port used to reach an arbitrary switch device */ static inline unsigned int dsa_routing_port(struct dsa_switch *ds, int device) { From patchwork Thu Feb 2 12:59:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 51914 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp228572wrn; Thu, 2 Feb 2023 05:12:24 -0800 (PST) X-Google-Smtp-Source: AK7set/ekMmcqKkhLeUD9gtNf0NZ9Vp+F7hrCx4M8FKa5C0z34j3OGGISYmhbt4s3+pXJGK7QjQ7 X-Received: by 2002:a17:907:7672:b0:88d:f759:15b0 with SMTP id kk18-20020a170907767200b0088df75915b0mr6150467ejc.45.1675343544564; Thu, 02 Feb 2023 05:12:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675343544; cv=none; d=google.com; s=arc-20160816; b=CsktT+BgiHWIHdnKF3OgMDqv5HRD4nbD0DhDfEGb7Oyl9SJ1iDjjVg3N/5Z4dxMxGD iIKjT5rGILUH/Njinib+qK5FGaCqoIdwWaFBIEA56mAF69AZX1CM08fjbTnSOvSRyriL 8vybewZ+txHOR3v0ef/nFjU3A+Fju0bb/5S5Nc2mNHQAcZ2d9aZiZrq0SGvuWKQURC/P 5F4JyARciW1qiihWajsM5mM1oGTixYRWomTr9/8jCU0CeMlgiCVuEtB/n6kY1u2awcOF VuHPFfLLypBUCOTRhF/KoA+8ruOqpethWf4D6v6PCYIzIR0G7SmioM/SsNbCYngMOPgL UelQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jmWdhuXej2lE82e1UgIiq0OzBac4V5Mi9S4YhCrSSik=; b=zM2bUeQw73X5G1C83QXaJXpYfz6dP0lcPBiDgCXzURhD7gJpW1MxutbiUNkJR4Rzp0 85hUiilPNgyrRfFyA3wFKUJ9QNGdcEBxHc+BV7pFFt9UegjeQYHink3qgaqzRPGWlSti YwVzXk2/qfADZTImmiLN/KEYptq/EmOzDvXqZIXh4yCt8L0dL9BGS4X72SX0kYnFkKjC uw+X4CoxEED10Nilcx3RvuOqtwtYwNDGT6ZPu1MIZZ+koOb5Fz4+1ic8Y8EBHHnbRap6 Op5yttRHq1rnmHermFhya5nF/UPD9HYwU4U/FIuBubanh8vzelbvUhLYriVt/1FbwO1V rrwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=jblrvlrd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 19-20020a170906225300b008786aea6a6dsi28630903ejr.17.2023.02.02.05.11.57; Thu, 02 Feb 2023 05:12:24 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=jblrvlrd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232630AbjBBNAP (ORCPT + 99 others); Thu, 2 Feb 2023 08:00:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59360 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232591AbjBBM7t (ORCPT ); Thu, 2 Feb 2023 07:59:49 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 37BC68C405; Thu, 2 Feb 2023 04:59:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675342762; x=1706878762; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ouumZ6vbUvawBmcL9NxoUu7tYtFUqagkN0ir03uG0JE=; b=jblrvlrd04/sJWl2s+iqEKMS0szsyJcqY2/Jv55Ru1z9VoM/2k7kLdtd ENq7di3NJLKt3AuSZg8QSM2RzgtoMSbNLf5CrDdJIgtCIhxXyLW2ouXAm wEcU3yG1SikMA8MFXa6aT22GVF78fAcNmszb1TliXdRFzQwD/EjcrUUhI UJ+ChakIXLnUz0XIh5Vd925PvXIVAl94CQbKN+zZ6/CItynADBAwdIl0C jpYUD6uZttHPFLtSlK94NSDkNTY0DycABzxK8cSlVJDFjVZ4Lk6H5EusR k+7hruLPc2gpg11IlAQ9lATIh/Ne3SYihktinr9CgPRHjSOBwnm1k9Pif g==; X-IronPort-AV: E=Sophos;i="5.97,267,1669100400"; d="scan'208";a="135252070" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Feb 2023 05:59:21 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Feb 2023 05:59:21 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Feb 2023 05:59:16 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [RFC PATCH net-next 10/11] net: dsa: microchip: lan937x: update vlan untag membership Date: Thu, 2 Feb 2023 18:29:29 +0530 Message-ID: <20230202125930.271740-11-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> References: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756725032827019398?= X-GMAIL-MSGID: =?utf-8?q?1756725032827019398?= Exclude cascaded port from vlan untag membership table since it will be the host port for second switch. Here setting 1 means, port will be capable of receiving tagged frames and 0 means, port can not receive tagged frames. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz9477.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index bf13d47c26cf..4c12131098b1 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -399,7 +399,7 @@ int ksz9477_port_vlan_add(struct ksz_device *dev, int port, vlan_table[1] |= BIT(port); else vlan_table[1] &= ~BIT(port); - vlan_table[1] &= ~(BIT(dev->cpu_port)); + vlan_table[1] &= ~(BIT(dev->cpu_port) | BIT(dev->dsa_port)); vlan_table[2] |= BIT(port) | BIT(dev->cpu_port); From patchwork Thu Feb 2 12:59:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rakesh Sankaranarayanan X-Patchwork-Id: 51917 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp232630wrn; Thu, 2 Feb 2023 05:20:07 -0800 (PST) X-Google-Smtp-Source: AK7set9kNNJAdE2my0Hkm9Z+Cjv6wLWGtvCLPqOuNCl7r01llA/L9RqPTF2oNV6DeWjhQHOK/0g1 X-Received: by 2002:a17:90b:ed2:b0:22c:46e:651c with SMTP id gz18-20020a17090b0ed200b0022c046e651cmr6536592pjb.5.1675344007439; Thu, 02 Feb 2023 05:20:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675344007; cv=none; d=google.com; s=arc-20160816; b=ItAJAH4l4JtsMhlvv9rkiWNbIuY2aXuodvsvRNZtcqMfuMmNNtpiEE3uYVz0RZvv8Y 8IulQxE10cRlDKHO/wFlQ4oiDJP1ZO7iR0NcT18htosD1sanpuJJKOBOQuZrGMQSd8LB EZfB8BI5jjMxxZMfCQa8m4YXodgiaV1vUJLTAqKLqdHfHHiEzgjUpIV9xHmzuR+Hv1Yr KGeWInWX6/KXdL//EjAe/idGOMD10k+MzfTdBHmDGmMJiosyXcyopr76qeNVNU6uNEDF A429yRT2GqryGssc8YmVYAuiNOSm9x1nXpdQbMG8s57VWWAprU68uI+oIT7jW2LlfRTx Gl8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Pb0287Gc3kyqUUzMOoczc/IN9KiRsMk/s7rH07N3WsE=; b=qXwjcQQuKPvVLeBH1p+WMqHi3wgtdEgnm+Iue6ifZJnmWdvvBRyMA0q7qY2AlXNcbE K72O++BZxVvszjixPPP4F+cbz+af+KIDUGwSAR54PV13bxm5YnnkqdpLpWkvfg3Tt1tr qFpkzpPGHdMdzHAyl4AHB+tjIftRXHwUXlxnOVYbz3sLnBHsBMAaNy+mR4ehan9cBjNj uSdqGj2MFrIoiBWeVUcYPc1HCznsHF3J9MJlsvdiiJwHTHNgmVgPvdYEidusKIgkL6F+ T7poLbCbytdz99YB4TnINP9BklTM00B0dMUyYSWSCutNMCOTE51ufVLtJtyoQokfM7Or yLGw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=OxSsIfqy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a17090aad4800b0022bb380256esi4612520pjv.106.2023.02.02.05.19.53; Thu, 02 Feb 2023 05:20:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@microchip.com header.s=mchp header.b=OxSsIfqy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=microchip.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232513AbjBBNAe (ORCPT + 99 others); Thu, 2 Feb 2023 08:00:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232527AbjBBNAK (ORCPT ); Thu, 2 Feb 2023 08:00:10 -0500 Received: from esa.microchip.iphmx.com (esa.microchip.iphmx.com [68.232.154.123]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 656668E4AC; Thu, 2 Feb 2023 04:59:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=microchip.com; i=@microchip.com; q=dns/txt; s=mchp; t=1675342774; x=1706878774; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=l+6j3bIkI3D5xNchH0czU8eucYVEM7sYgP+6GkMs3tk=; b=OxSsIfqyLrh9uu+vES8XplLrbxqwa2M+Acz4JZ4joo9SQrBdzQsQ1D6i 5Gx9IA8kpPmU9sf2KGdvfNBTEwfiZSCSXqCzYv5dQdeiK2io9V3EWh4wB OkOFCLg4B0r7cXVdtkVVlz1qXDxe56Z9CHP5XUUTiREzsGLrUi+Ha0u2h NAXEp5b+YzsnG71yLXBFUDaW6+MJNjNf/FTFTlZ0rVDFEPZY7Tdn0v2jz nwNB/KjivT8Ylftq/W4N5u3ivqZMeYk2Kqkjxw+sX0lPqyL6uR7SOw6V6 DlZiGrXoEqVXB8JnVilHXcjUZFdFgZN5fYMKPu8L3Qu6eeqNtphZuPjN+ Q==; X-IronPort-AV: E=Sophos;i="5.97,267,1669100400"; d="scan'208";a="135252111" Received: from unknown (HELO email.microchip.com) ([170.129.1.10]) by esa6.microchip.iphmx.com with ESMTP/TLS/AES256-SHA256; 02 Feb 2023 05:59:27 -0700 Received: from chn-vm-ex03.mchp-main.com (10.10.85.151) by chn-vm-ex02.mchp-main.com (10.10.85.144) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16; Thu, 2 Feb 2023 05:59:26 -0700 Received: from che-lt-i67786lx.microchip.com (10.10.115.15) by chn-vm-ex03.mchp-main.com (10.10.85.151) with Microsoft SMTP Server id 15.1.2507.16 via Frontend Transport; Thu, 2 Feb 2023 05:59:22 -0700 From: Rakesh Sankaranarayanan To: , CC: , , , , , , , , , Subject: [RFC PATCH net-next 11/11] net: dsa: microchip: lan937x: update multicast table Date: Thu, 2 Feb 2023 18:29:30 +0530 Message-ID: <20230202125930.271740-12-rakesh.sankaranarayanan@microchip.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> References: <20230202125930.271740-1-rakesh.sankaranarayanan@microchip.com> MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756725517973727188?= X-GMAIL-MSGID: =?utf-8?q?1756725517973727188?= Program multicast table for cascaded port in second switch with default port forward value since it is the host port for second switch. Current driver program the same for cpu port in first switch. Signed-off-by: Rakesh Sankaranarayanan --- drivers/net/dsa/microchip/ksz9477.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c index 4c12131098b1..521d8c2e1540 100644 --- a/drivers/net/dsa/microchip/ksz9477.c +++ b/drivers/net/dsa/microchip/ksz9477.c @@ -1116,18 +1116,22 @@ void ksz9477_config_cpu_port(struct dsa_switch *ds) int ksz9477_enable_stp_addr(struct ksz_device *dev) { + u32 fwd_port = BIT(dev->cpu_port); const u32 *masks; u32 data; int ret; masks = dev->info->masks; + if (dev->ds->index == 1) + fwd_port = BIT(dev->dsa_port); + /* Enable Reserved multicast table */ ksz_cfg(dev, REG_SW_LUE_CTRL_0, SW_RESV_MCAST_ENABLE, true); /* Set the Override bit for forwarding BPDU packet to CPU */ ret = ksz_write32(dev, REG_SW_ALU_VAL_B, - ALU_V_OVERRIDE | BIT(dev->cpu_port)); + ALU_V_OVERRIDE | fwd_port); if (ret < 0) return ret;