mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Oleksij Rempel <o.rempel@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Subject: [PATCH v4 2/8] net: usb: asix: add promisc mode support
Date: Tue,  8 Nov 2022 07:10:03 +0100	[thread overview]
Message-ID: <20221108061009.4168735-2-o.rempel@pengutronix.de> (raw)
In-Reply-To: <20221108061009.4168735-1-o.rempel@pengutronix.de>

Add promisc mode configuration support

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 drivers/net/usb/asix.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/usb/asix.c b/drivers/net/usb/asix.c
index 28a3534bcf..2d7114e5b1 100644
--- a/drivers/net/usb/asix.c
+++ b/drivers/net/usb/asix.c
@@ -427,6 +427,25 @@ static int asix_set_ethaddr(struct eth_device *edev, const unsigned char *adr)
 	return 0;
 }
 
+static int asix_set_promisc(struct eth_device *edev, bool enable)
+{
+	struct usbnet *dev = container_of(edev, struct usbnet, edev);
+	u16 rx_ctl;
+	int ret;
+
+	rx_ctl = asix_read_rx_ctl(dev);
+
+	if (enable)
+		rx_ctl |= AX_RX_CTL_PRO;
+	else
+		rx_ctl &= ~AX_RX_CTL_PRO;
+
+	if ((ret = asix_write_rx_ctl(dev, rx_ctl)) < 0)
+		return ret;
+
+	return 0;
+}
+
 static int ax88172_get_ethaddr(struct eth_device *edev, unsigned char *adr)
 {
 	struct usbnet *udev = container_of(edev, struct usbnet, edev);
@@ -664,6 +683,7 @@ static int ax88772_bind(struct usbnet *dev)
 
 	dev->edev.get_ethaddr = asix_get_ethaddr;
 	dev->edev.set_ethaddr = asix_set_ethaddr;
+	dev->edev.set_promisc = asix_set_promisc;
 	asix_init_mii(dev);
 
 	if ((ret = asix_sw_reset(dev, AX_SWRESET_PRL)) < 0)
-- 
2.30.2




  reply	other threads:[~2022-11-08  6:12 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08  6:10 [PATCH v4 1/8] net: add promiscuous mode configuration support Oleksij Rempel
2022-11-08  6:10 ` Oleksij Rempel [this message]
2022-11-08  6:10 ` [PATCH v4 3/8] ethlog: option to enable/disable promisc mode Oleksij Rempel
2022-11-08  6:57   ` Johannes Zink
2022-11-08  6:10 ` [PATCH v4 4/8] net: dsa: enable promiscuous mode for switch master edev Oleksij Rempel
2022-11-08  6:10 ` [PATCH v4 5/8] drivers: net: fec_imx: add promiscuous mode configuration support Oleksij Rempel
2022-11-08  6:10 ` [PATCH v4 6/8] net: dsa: fix of_device_ensure_probed*() for switch ports Oleksij Rempel
2022-11-08  6:10 ` [PATCH v4 7/8] ARM: boards: skov-imx6: convert all pr_ to dev_ prints Oleksij Rempel
2022-11-08  6:10 ` [PATCH v4 8/8] ARM: boards: skov-imx6: assigned separate MAC address to LAN2 Oleksij Rempel
2022-11-08 10:13 ` [PATCH v4 1/8] net: add promiscuous mode configuration support Sascha Hauer

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=20221108061009.4168735-2-o.rempel@pengutronix.de \
    --to=o.rempel@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /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