Received: by 2002:a05:7412:b130:b0:e2:908c:2ebd with SMTP id az48csp2132508rdb; Mon, 20 Nov 2023 03:02:26 -0800 (PST) X-Google-Smtp-Source: AGHT+IHZ7zCNt96DC1WPC/KDk0ftQcBPzuZzy0eOvs9oHXwu6PiC6x04b9DlS+/o5NGyxjTdwfPq X-Received: by 2002:a9d:4f0c:0:b0:6c6:4e73:f83d with SMTP id d12-20020a9d4f0c000000b006c64e73f83dmr7928512otl.32.1700478146481; Mon, 20 Nov 2023 03:02:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700478146; cv=none; d=google.com; s=arc-20160816; b=TwmFkGYagkGCmVFbDjKLO6omivO6YSt0WN5heBZYWvqGNCmLo1azgvA5Hhmx60dfrb unkfJvQjgSr6C60s0Rh1dRUm4EsH/dIj9eSPZ4LL7IoXaa8UHXEBzsC6pM1kCKsJaNYi HW6Zgnkm4Gyfv3wbzrqO4o7o8LWs+HXMfONUnHUfHZj97+mGS9CI/qiJBhpX7Gz6Z1Cm paFrjhxupePh3Oay4tq9meJ+GyWqcNTxwDkH0VMp5AM9HISHSeGUFPx44ZjMP57NlSae yUqUINlKu2jA6nfi2+WSX5JRTLqmI1iHAr6fHF+1l0yUMU/ySXiLbKMbeqV8r1pG04xA Efmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=dK5EtPWsONa0/kGuX8aw4ZjhPdWzygkQ+zFeP8bQ8UU=; fh=+cIZj3e+UkwCGKaaGc2855QRwZkI11VC/L6hg0k8y0I=; b=XgLJnu/LLWHZI4EpQvpJy+BNwI9r9u1JLR/Us55VMuc9gAr+XZqoa/FhwdXCJ5dFWW LhP2+N4FZux9BSluCgew8jBqAOgHNzCEJkfuG1BjFHKdWMIqoxdTd7Sp4P13IEiUTJU6 CAKgxC/NDC8f3nrQ5YSRTPB/vTdGXwZ++R4OLH2ipsziYzv+9r8ia6MV38qMNgtPGQAc 1J6Q4x/SOPtVozW+oC2eMo0rpesqHz+zfEgr8EuEoF9EPo5rj8EMOyn0nnSFZOHNBVkC OghAhB85JQGbpIrIN7jmJWgFWqtk4OTPdO8QG4RIJ6RTZww/ax61htdZkmbss42oIXgb +ALA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=UV5IqoaN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id e10-20020a056830200a00b006c630edba46si2653876otp.291.2023.11.20.03.02.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Nov 2023 03:02:26 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com header.s=ti-com-17Q1 header.b=UV5IqoaN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=ti.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id D44E2806C451; Mon, 20 Nov 2023 03:01:50 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232778AbjKTLBm (ORCPT + 99 others); Mon, 20 Nov 2023 06:01:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232741AbjKTLBk (ORCPT ); Mon, 20 Nov 2023 06:01:40 -0500 Received: from lelv0142.ext.ti.com (lelv0142.ext.ti.com [198.47.23.249]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B83BFD2; Mon, 20 Nov 2023 03:01:35 -0800 (PST) Received: from lelv0266.itg.ti.com ([10.180.67.225]) by lelv0142.ext.ti.com (8.15.2/8.15.2) with ESMTP id 3AKB19M4016016; Mon, 20 Nov 2023 05:01:09 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ti.com; s=ti-com-17Q1; t=1700478069; bh=dK5EtPWsONa0/kGuX8aw4ZjhPdWzygkQ+zFeP8bQ8UU=; h=From:To:CC:Subject:Date; b=UV5IqoaNEqJ8El5bzL0UqZaX5wFwKZDODTTaTHAaZx4swD5vcMA++ksvqw4Ebh6sy pfsnbqe99hrXhtGuyXlOYM6RxHuJ6/noRv6gZaCFmEajJbWVlIft6A4iDv+Ru+SXCL g/2cGp2Wlz6EkiFGpIJI1UtnZzq9PPVQcbzNQOR4= Received: from DFLE100.ent.ti.com (dfle100.ent.ti.com [10.64.6.21]) by lelv0266.itg.ti.com (8.15.2/8.15.2) with ESMTPS id 3AKB19OV098656 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 20 Nov 2023 05:01:09 -0600 Received: from DFLE114.ent.ti.com (10.64.6.35) by DFLE100.ent.ti.com (10.64.6.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23; Mon, 20 Nov 2023 05:01:09 -0600 Received: from lelv0326.itg.ti.com (10.180.67.84) by DFLE114.ent.ti.com (10.64.6.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2507.23 via Frontend Transport; Mon, 20 Nov 2023 05:01:09 -0600 Received: from uda0500640.dal.design.ti.com (ileaxei01-snat.itg.ti.com [10.180.69.5]) by lelv0326.itg.ti.com (8.15.2/8.15.2) with ESMTP id 3AKB1654029628; Mon, 20 Nov 2023 05:01:07 -0600 From: Ravi Gunasekaran To: , , , CC: , , , , Subject: [PATCH net-next] net: hsr: Add support for MC filtering at the slave device Date: Mon, 20 Nov 2023 16:31:05 +0530 Message-ID: <20231120110105.18416-1-r-gunasekaran@ti.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-EXCLAIMER-MD-CONFIG: e1e8a2fd-e40a-4ac6-ac9b-f7e9cc9ee180 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Mon, 20 Nov 2023 03:01:51 -0800 (PST) From: Murali Karicheri When MC (multicast) list is updated by the networking layer due to a user command and as well as when allmulti flag is set, it needs to be passed to the enslaved Ethernet devices. This patch allows this to happen by implementing ndo_change_rx_flags() and ndo_set_rx_mode() API calls that in turns pass it to the slave devices using existing API calls. Signed-off-by: Murali Karicheri Signed-off-by: Ravi Gunasekaran --- net/hsr/hsr_device.c | 67 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/net/hsr/hsr_device.c b/net/hsr/hsr_device.c index 306f942c3b28..4e8f4a3cefbf 100644 --- a/net/hsr/hsr_device.c +++ b/net/hsr/hsr_device.c @@ -173,7 +173,24 @@ static int hsr_dev_open(struct net_device *dev) static int hsr_dev_close(struct net_device *dev) { - /* Nothing to do here. */ + struct hsr_port *port; + struct hsr_priv *hsr; + + hsr = netdev_priv(dev); + hsr_for_each_port(hsr, port) { + if (port->type == HSR_PT_MASTER) + continue; + switch (port->type) { + case HSR_PT_SLAVE_A: + case HSR_PT_SLAVE_B: + dev_uc_unsync(port->dev, dev); + dev_mc_unsync(port->dev, dev); + break; + default: + break; + } + } + return 0; } @@ -404,12 +421,60 @@ void hsr_del_ports(struct hsr_priv *hsr) hsr_del_port(port); } +static void hsr_ndo_set_rx_mode(struct net_device *dev) +{ + struct hsr_port *port; + struct hsr_priv *hsr; + + hsr = netdev_priv(dev); + + hsr_for_each_port(hsr, port) { + if (port->type == HSR_PT_MASTER) + continue; + switch (port->type) { + case HSR_PT_SLAVE_A: + case HSR_PT_SLAVE_B: + dev_mc_sync_multiple(port->dev, dev); + dev_uc_sync_multiple(port->dev, dev); + break; + default: + break; + } + } +} + +static void hsr_change_rx_flags(struct net_device *dev, int change) +{ + struct hsr_port *port; + struct hsr_priv *hsr; + + hsr = netdev_priv(dev); + + hsr_for_each_port(hsr, port) { + if (port->type == HSR_PT_MASTER) + continue; + switch (port->type) { + case HSR_PT_SLAVE_A: + case HSR_PT_SLAVE_B: + if (change & IFF_ALLMULTI) + dev_set_allmulti(port->dev, + dev->flags & + IFF_ALLMULTI ? 1 : -1); + break; + default: + break; + } + } +} + static const struct net_device_ops hsr_device_ops = { .ndo_change_mtu = hsr_dev_change_mtu, .ndo_open = hsr_dev_open, .ndo_stop = hsr_dev_close, .ndo_start_xmit = hsr_dev_xmit, + .ndo_change_rx_flags = hsr_change_rx_flags, .ndo_fix_features = hsr_fix_features, + .ndo_set_rx_mode = hsr_ndo_set_rx_mode, }; static struct device_type hsr_type = { base-commit: 5a82d69d48c82e89aef44483d2a129f869f3506a -- 2.17.1