Received: by 10.223.164.202 with SMTP id h10csp136770wrb; Fri, 10 Nov 2017 03:59:24 -0800 (PST) X-Google-Smtp-Source: AGs4zMaeYbfKjGBBDs3c0mLm9w33ZsU1Pr1z250aHojKTXiH7qY/pXl05nyTTGp4aYPqGEgl0uVs X-Received: by 10.159.242.196 with SMTP id x4mr111102plw.342.1510315164052; Fri, 10 Nov 2017 03:59:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1510315164; cv=none; d=google.com; s=arc-20160816; b=n98Yn4KlUCk/uXZZ2YNEDuK6u4UIorGgTnKwPMfyITcIapBZOqQIGNN0mIKtXJZ+pq UW8UxVwaof09M9IKlZDF2WkNIhNUZdjOR9JUBfl6kB5hHFO7//8zUJv0SmI2r2cGb+cQ Q8s4c2OhEnkh1wi7JK15eaJzGzl0uo5lhwWLJXqeMFD/2dlz6ITgNzZh9Z35OrON25nb umXPRXyBLiuXyTDFitzFwMT955tvy0lkzMl8qbYH/4FQiauHT3LUJAlXI+3McdDF38OS uTuEbG2yXudl/8yG/wb5YqDH+HpcLUKmugUiQxNSB99MtJL2WMZY3codoD2XbiMwhM+S +23g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=gGQi6Upxyorcy+fu38xLvL7RJGQWIlF9Eiq60tNTDgo=; b=QmW4qtLEKyouoq6mFgQWUP20CC1ZeqAkLZ8qzdPD1Jim6lS440gJSsJcuwWxcZglIZ WugfFq/bvMPkxshJM1FiCUGJ3Ur7db5SQlduXWPakyqHWTu/r5tgHeXLK7NeJx4a7+DJ AG9RI8ElxFXIqOmFlMp47jyjKsDJrXPI/c/Lb+cxMF2xFrKnQmoPC61RkttD1wR2927r 8wni1yGA0PbSfvjoKpaLnsAu7Sls90bDfOXZbwxfE3OZfCExYIoEvWuuPHCBhxwY0mcM lB2JvPvnKAUMBCwpTd7d2KwE56vLKnG72Gq8h01tRkm+WjIiqxoZ3I4Ju12/9MiiIE9C hF/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5si8819204plo.19.2017.11.10.03.59.12; Fri, 10 Nov 2017 03:59:24 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753019AbdKJL6D (ORCPT + 82 others); Fri, 10 Nov 2017 06:58:03 -0500 Received: from aibo.runbox.com ([91.220.196.211]:36942 "EHLO aibo.runbox.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751085AbdKJL6B (ORCPT ); Fri, 10 Nov 2017 06:58:01 -0500 Received: from [10.9.9.210] (helo=mailfront10.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1eD7wZ-0003Wz-67; Fri, 10 Nov 2017 12:57:55 +0100 Received: from 93.89.113.32.ip.vitnett.no ([93.89.113.32] helo=localhost.localdomain) by mailfront10.runbox.com with esmtpsa (uid:646232 ) (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) id 1eD7wI-0006Wo-F8; Fri, 10 Nov 2017 12:57:38 +0100 From: Egil Hjelmeland To: andrew@lunn.ch, vivien.didelot@savoirfairelinux.com, f.fainelli@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Egil Hjelmeland Subject: [PATCH net-next 1/2] net: dsa: lan9303: Set up trapping of IGMP to CPU port Date: Fri, 10 Nov 2017 12:54:34 +0100 Message-Id: <20171110115435.4261-2-privat@egil-hjelmeland.no> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171110115435.4261-1-privat@egil-hjelmeland.no> References: <20171110115435.4261-1-privat@egil-hjelmeland.no> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org IGMP packets should be trapped to the CPU port. The SW bridge knows whether to forward to other ports. With "IGMP snooping for local traffic" merged, IGMP trapping is also required for stable IGMPv2 operation. LAN9303 does not trap IGMP packets by default. Enable IGMP trapping in lan9303_setup. Signed-off-by: Egil Hjelmeland --- drivers/net/dsa/lan9303-core.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/net/dsa/lan9303-core.c b/drivers/net/dsa/lan9303-core.c index 320651a57c6f..6d7dee67d822 100644 --- a/drivers/net/dsa/lan9303-core.c +++ b/drivers/net/dsa/lan9303-core.c @@ -153,6 +153,8 @@ # define LAN9303_SWE_VLAN_UNTAG_PORT0 BIT(12) #define LAN9303_SWE_VLAN_CMD_STS 0x1810 #define LAN9303_SWE_GLB_INGRESS_CFG 0x1840 +# define LAN9303_SWE_GLB_INGR_IGMP_TRAP BIT(7) +# define LAN9303_SWE_GLB_INGR_IGMP_PORT(p) BIT(10 + p) #define LAN9303_SWE_PORT_STATE 0x1843 # define LAN9303_SWE_PORT_STATE_FORWARDING_PORT2 (0) # define LAN9303_SWE_PORT_STATE_LEARNING_PORT2 BIT(5) @@ -450,6 +452,21 @@ static int lan9303_read_switch_reg(struct lan9303 *chip, u16 regnum, u32 *val) return ret; } +static int lan9303_write_switch_reg_mask(struct lan9303 *chip, u16 regnum, + u32 val, u32 mask) +{ + int ret; + u32 reg; + + ret = lan9303_read_switch_reg(chip, regnum, ®); + if (ret) + return ret; + + reg = (reg & ~mask) | val; + + return lan9303_write_switch_reg(chip, regnum, reg); +} + static int lan9303_write_switch_port(struct lan9303 *chip, int port, u16 regnum, u32 val) { @@ -905,6 +922,15 @@ static int lan9303_setup(struct dsa_switch *ds) if (ret) dev_err(chip->dev, "failed to re-enable switching %d\n", ret); + /* Trap IGMP to port 0 */ + ret = lan9303_write_switch_reg_mask(chip, LAN9303_SWE_GLB_INGRESS_CFG, + LAN9303_SWE_GLB_INGR_IGMP_TRAP | + LAN9303_SWE_GLB_INGR_IGMP_PORT(0), + LAN9303_SWE_GLB_INGR_IGMP_PORT(1) | + LAN9303_SWE_GLB_INGR_IGMP_PORT(2)); + if (ret) + dev_err(chip->dev, "failed to setup IGMP trap %d\n", ret); + return 0; } -- 2.11.0 From 1583671965695613941@xxx Fri Nov 10 09:47:59 +0000 2017 X-GM-THRID: 1583671965695613941 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread