netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Richard Cochran <richardcochran@gmail.com>
To: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org,
	David Miller <davem@davemloft.net>,
	Michal Simek <michal.simek@xilinx.com>,
	Radhey Shyam Pandey <radhey.shyam.pandey@xilinx.com>
Subject: [PATCH net-next 3/3] net: axienet: Pass ioctls to the phy.
Date: Mon, 16 Dec 2019 10:32:56 -0800	[thread overview]
Message-ID: <361f63095be92df10e8e953af3b981cdac58d98e.1576520432.git.richardcochran@gmail.com> (raw)
In-Reply-To: <cover.1576520432.git.richardcochran@gmail.com>

In order to allow PHY drivers to handle ioctls, the MAC driver must pass
the calls through.  However, the axienet driver does not support ioctls
at all.  This patch fixes the issue by handing off the invocations to the
PHY appropriately.

Signed-off-by: Richard Cochran <richardcochran@gmail.com>
---
 .../net/ethernet/xilinx/xilinx_axienet_main.c  | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 05fa7371c39a..d0b996f220f5 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1067,6 +1067,23 @@ static int axienet_change_mtu(struct net_device *ndev, int new_mtu)
 	return 0;
 }
 
+static int axienet_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+{
+	if (!netif_running(dev))
+		return -EINVAL;
+
+	switch (cmd) {
+	case SIOCGMIIPHY:
+	case SIOCGMIIREG:
+	case SIOCSMIIREG:
+	case SIOCSHWTSTAMP:
+	case SIOCGHWTSTAMP:
+		return phy_mii_ioctl(dev->phydev, rq, cmd);
+	default:
+		return -EOPNOTSUPP;
+	}
+}
+
 #ifdef CONFIG_NET_POLL_CONTROLLER
 /**
  * axienet_poll_controller - Axi Ethernet poll mechanism.
@@ -1095,6 +1112,7 @@ static const struct net_device_ops axienet_netdev_ops = {
 	.ndo_set_mac_address = netdev_set_mac_address,
 	.ndo_validate_addr = eth_validate_addr,
 	.ndo_set_rx_mode = axienet_set_multicast_list,
+	.ndo_do_ioctl = axienet_ioctl,
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	.ndo_poll_controller = axienet_poll_controller,
 #endif
-- 
2.20.1


  parent reply	other threads:[~2019-12-16 18:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-16 18:32 [PATCH net-next 0/3] net: axienet: Fix random driver issues Richard Cochran
2019-12-16 18:32 ` [PATCH net-next 1/3] net: axienet: Propagate registration errors during probe Richard Cochran
2019-12-17  6:19   ` Radhey Shyam Pandey
2019-12-17 15:49     ` Richard Cochran
2019-12-19 18:13       ` Radhey Shyam Pandey
2019-12-20  5:19         ` Richard Cochran
2019-12-20  5:51           ` Radhey Shyam Pandey
2019-12-16 18:32 ` [PATCH net-next 2/3] net: axienet: Support software transmit time stamping Richard Cochran
2019-12-16 18:32 ` Richard Cochran [this message]
2019-12-17  6:43   ` [PATCH net-next 3/3] net: axienet: Pass ioctls to the phy Radhey Shyam Pandey
2019-12-17 10:59   ` Andrew Lunn

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=361f63095be92df10e8e953af3b981cdac58d98e.1576520432.git.richardcochran@gmail.com \
    --to=richardcochran@gmail.com \
    --cc=davem@davemloft.net \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=michal.simek@xilinx.com \
    --cc=netdev@vger.kernel.org \
    --cc=radhey.shyam.pandey@xilinx.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;
as well as URLs for NNTP newsgroup(s).