From: Stephen Hemminger <shemminger@vyatta.com>
To: John Linn <john.linn@xilinx.com>
Cc: Michal Simek <michal.simek@petalogix.com>,
netdev@vger.kernel.org, Sadanand M <sadanan@xilinx.com>,
davem@davemloft.net, linuxppc-dev@ozlabs.org, jgarzik@pobox.com,
John Linn <john.linn@xilinx.com>,
John Williams <john.williams@petalogix.com>
Subject: Re: [PATCH] [V3] net: add Xilinx emac lite device driver
Date: Thu, 20 Aug 2009 09:49:14 -0700 [thread overview]
Message-ID: <20090820094914.46f1db9c@nehalam> (raw)
In-Reply-To: <20090820094956.02DFC45004F@mail96-dub.bigfish.com>
On Thu, 20 Aug 2009 03:49:51 -0600
John Linn <john.linn@xilinx.com> wrote:
> +/**
> + * xemaclite_ioctl - Perform IO Control operations on the network device
> + * @dev: Pointer to the network device
> + * @rq: Pointer to the interface request structure
> + * @cmd: IOCTL command
> + *
> + * The only IOCTL operation supported by this function is setting the MAC
> + * address. An error is reported if any other operations are requested.
> + *
> + * Return: 0 to indicate success, or a negative error for failure.
> + */
> +static int xemaclite_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
> +{
> + struct net_local *lp = (struct net_local *) netdev_priv(dev);
> + struct hw_addr_data *hw_addr = (struct hw_addr_data *) &rq->ifr_hwaddr;
> +
> + switch (cmd) {
> + case SIOCETHTOOL:
> + return -EIO;
> +
> + case SIOCSIFHWADDR:
> + dev_err(&lp->ndev->dev, "SIOCSIFHWADDR\n");
> +
> + /* Copy MAC address in from user space */
> + copy_from_user((void __force *) dev->dev_addr,
> + (void __user __force *) hw_addr,
> + IFHWADDRLEN);
> + xemaclite_set_mac_address(lp, dev->dev_addr);
> + break;
> + default:
> + return -EOPNOTSUPP;
> + }
> +
> + return 0;
> +}
Do you really need this? I doubt the SIOCSIFHWADDR even reaches driver!
The normal call path for setting hardware address is:
dev_ifsioc
dev_set_mac_address
ops->ndo_set_mac_address -->
The driver should be:
1. defining new code to do ndo_set_mac_address
2. remove existing xmaclite_ioctl - all ioctl's handled by upper layers
FYI - the only ioctl's that make it to network device ndo_ioctl
are listed in dev_ifsioc
SIOCDEVPRIVATE ... SIOCDEVPRIVATE + 15
SIOCBOND*
SIOCMII*
SIOCBR*
SIOCHWTSTAMP
SIOCWANDEV
WARNING: multiple messages have this Message-ID (diff)
From: Stephen Hemminger <shemminger@vyatta.com>
To: John Linn <john.linn@xilinx.com>
Cc: netdev@vger.kernel.org, linuxppc-dev@ozlabs.org,
davem@davemloft.net, jgarzik@pobox.com,
John Linn <john.linn@xilinx.com>,
Grant Likely <grant.likely@secretlab.ca>,
Josh Boyer <jwboyer@linux.vnet.ibm.com>,
John Williams <john.williams@petalogix.com>,
Michal Simek <michal.simek@petalogix.com>,
Sadanand M <sadanan@xilinx.com>
Subject: Re: [PATCH] [V3] net: add Xilinx emac lite device driver
Date: Thu, 20 Aug 2009 09:49:14 -0700 [thread overview]
Message-ID: <20090820094914.46f1db9c@nehalam> (raw)
In-Reply-To: <20090820094956.02DFC45004F@mail96-dub.bigfish.com>
On Thu, 20 Aug 2009 03:49:51 -0600
John Linn <john.linn@xilinx.com> wrote:
> +/**
> + * xemaclite_ioctl - Perform IO Control operations on the network device
> + * @dev: Pointer to the network device
> + * @rq: Pointer to the interface request structure
> + * @cmd: IOCTL command
> + *
> + * The only IOCTL operation supported by this function is setting the MAC
> + * address. An error is reported if any other operations are requested.
> + *
> + * Return: 0 to indicate success, or a negative error for failure.
> + */
> +static int xemaclite_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
> +{
> + struct net_local *lp = (struct net_local *) netdev_priv(dev);
> + struct hw_addr_data *hw_addr = (struct hw_addr_data *) &rq->ifr_hwaddr;
> +
> + switch (cmd) {
> + case SIOCETHTOOL:
> + return -EIO;
> +
> + case SIOCSIFHWADDR:
> + dev_err(&lp->ndev->dev, "SIOCSIFHWADDR\n");
> +
> + /* Copy MAC address in from user space */
> + copy_from_user((void __force *) dev->dev_addr,
> + (void __user __force *) hw_addr,
> + IFHWADDRLEN);
> + xemaclite_set_mac_address(lp, dev->dev_addr);
> + break;
> + default:
> + return -EOPNOTSUPP;
> + }
> +
> + return 0;
> +}
Do you really need this? I doubt the SIOCSIFHWADDR even reaches driver!
The normal call path for setting hardware address is:
dev_ifsioc
dev_set_mac_address
ops->ndo_set_mac_address -->
The driver should be:
1. defining new code to do ndo_set_mac_address
2. remove existing xmaclite_ioctl - all ioctl's handled by upper layers
FYI - the only ioctl's that make it to network device ndo_ioctl
are listed in dev_ifsioc
SIOCDEVPRIVATE ... SIOCDEVPRIVATE + 15
SIOCBOND*
SIOCMII*
SIOCBR*
SIOCHWTSTAMP
SIOCWANDEV
next prev parent reply other threads:[~2009-08-20 16:49 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-20 9:49 [PATCH] [V3] net: add Xilinx emac lite device driver John Linn
2009-08-20 9:49 ` John Linn
2009-08-20 9:52 ` David Miller
2009-08-20 9:52 ` David Miller
2009-08-31 13:18 ` Michal Simek
2009-08-31 13:18 ` Michal Simek
2009-09-02 0:51 ` David Miller
2009-09-02 0:51 ` David Miller
2009-08-20 16:02 ` Stephen Neuendorffer
2009-08-20 16:02 ` Stephen Neuendorffer
2009-08-20 17:44 ` Grant Likely
2009-08-20 17:44 ` Grant Likely
2009-08-20 17:45 ` Stephen Neuendorffer
2009-08-20 17:45 ` Stephen Neuendorffer
2009-08-20 16:49 ` Stephen Hemminger [this message]
2009-08-20 16:49 ` Stephen Hemminger
2009-09-02 13:33 ` John Linn
2009-09-02 13:33 ` John Linn
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=20090820094914.46f1db9c@nehalam \
--to=shemminger@vyatta.com \
--cc=davem@davemloft.net \
--cc=jgarzik@pobox.com \
--cc=john.linn@xilinx.com \
--cc=john.williams@petalogix.com \
--cc=linuxppc-dev@ozlabs.org \
--cc=michal.simek@petalogix.com \
--cc=netdev@vger.kernel.org \
--cc=sadanan@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.