mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Kochetkov <al.kochet@gmail.com>
To: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	davem@davemloft.net, tremyfr@gmail.com, peter.chen@nxp.com,
	wxt@rock-chips.com, weiyj.lk@gmail.com
Cc: Alexander Kochetkov <al.kochet@gmail.com>
Subject: [PATCH 2/2] net: arc_emac: don't pass multicast packets to kernel in non-multicast mode
Date: Mon, 14 Nov 2016 16:20:27 +0300	[thread overview]
Message-ID: <1479129627-27524-2-git-send-email-al.kochet@gmail.com> (raw)
In-Reply-To: <1479129627-27524-1-git-send-email-al.kochet@gmail.com>

The patch disable capturing multicast packets when multicast mode
disabled for ethernet ('ifconfig eth0 -multicast'). In that case
no multicast packet will be passed to kernel.
---
 drivers/net/ethernet/arc/emac_main.c |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index 2e4ee86..30ad833 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -460,7 +460,7 @@ static void arc_emac_set_rx_mode(struct net_device *ndev)
 		if (ndev->flags & IFF_ALLMULTI) {
 			arc_reg_set(priv, R_LAFL, ~0);
 			arc_reg_set(priv, R_LAFH, ~0);
-		} else {
+		} else if (ndev->flags & IFF_MULTICAST) {
 			struct netdev_hw_addr *ha;
 			unsigned int filter[2] = { 0, 0 };
 			int bit;
@@ -469,9 +469,11 @@ static void arc_emac_set_rx_mode(struct net_device *ndev)
 				bit = ether_crc_le(ETH_ALEN, ha->addr) >> 26;
 				filter[bit >> 5] |= 1 << (bit & 31);
 			}
-
 			arc_reg_set(priv, R_LAFL, filter[0]);
 			arc_reg_set(priv, R_LAFH, filter[1]);
+		} else {
+			arc_reg_set(priv, R_LAFL, 0);
+			arc_reg_set(priv, R_LAFH, 0);
 		}
 	}
 }
-- 
1.7.9.5

  reply	other threads:[~2016-11-14 13:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 13:20 [PATCH 1/2] net: arc_emac: annonce IFF_MULTICAST support Alexander Kochetkov
2016-11-14 13:20 ` Alexander Kochetkov [this message]
2016-11-14 13:32   ` [PATCHv2 " Alexander Kochetkov
2016-11-14 13:32     ` [PATCHv2 2/2] net: arc_emac: don't pass multicast packets to kernel in non-multicast mode Alexander Kochetkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1479129627-27524-2-git-send-email-al.kochet@gmail.com \
    --to=al.kochet@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=peter.chen@nxp.com \
    --cc=tremyfr@gmail.com \
    --cc=weiyj.lk@gmail.com \
    --cc=wxt@rock-chips.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®