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 v3 1/8] net: add promiscuous mode configuration support
Date: Mon,  7 Nov 2022 12:16:54 +0100	[thread overview]
Message-ID: <20221107111701.2570303-1-o.rempel@pengutronix.de> (raw)

This configuration is mostly needed for controllers attached to switches
with different MAC address configurations or for debugging networking
issues.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
---
 include/net.h | 3 +++
 net/eth.c     | 8 ++++++++
 2 files changed, 11 insertions(+)

diff --git a/include/net.h b/include/net.h
index 338033d698..f9d1fbfc18 100644
--- a/include/net.h
+++ b/include/net.h
@@ -49,6 +49,8 @@ struct eth_device {
 				 int *length);
 	void (*rx_monitor) (struct eth_device*, void *packet, int length);
 	void (*tx_monitor) (struct eth_device*, void *packet, int length);
+	/* Set promiscuous mode */
+	int  (*set_promisc) (struct eth_device*, bool enable);
 
 	struct eth_device *next;
 	void *priv;
@@ -113,6 +115,7 @@ int eth_send(struct eth_device *edev, void *packet, int length);	   /* Send a pa
 int eth_rx(void);			/* Check for received packets	*/
 void eth_open_all(void);
 struct eth_device *of_find_eth_device_by_node(struct device_node *np);
+int eth_set_promisc(struct eth_device *edev, bool enable);
 
 /* associate a MAC address to a ethernet device. Should be called by
  * board code for boards which store their MAC address at some unusual
diff --git a/net/eth.c b/net/eth.c
index 8f6ff7db3a..19654cdd51 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -31,6 +31,14 @@ struct eth_ethaddr {
 
 static LIST_HEAD(ethaddr_list);
 
+int eth_set_promisc(struct eth_device *edev, bool enable)
+{
+	if (!edev->set_promisc)
+		return -EOPNOTSUPP;
+
+	return edev->set_promisc(edev, enable);
+}
+
 int eth_set_ethaddr(struct eth_device *edev, const char *ethaddr)
 {
 	int ret;
-- 
2.30.2




             reply	other threads:[~2022-11-07 11:18 UTC|newest]

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

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=20221107111701.2570303-1-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