From: <Charles.Hyde@dellteam.com>
To: <bjorn@mork.no>
Cc: <stern@rowland.harvard.edu>, <oliver@neukum.org>,
<rjw@rjwysocki.net>, <lenb@kernel.org>,
<Mario.Limonciello@dell.com>, <chip.programmer@gmail.com>,
<nic_swsd@realtek.com>, <linux-usb@vger.kernel.org>,
<linux-acpi@vger.kernel.org>
Subject: RE: [PATCH 1/3] net: cdc_ncm: add get/set ethernet address functions
Date: Fri, 6 Sep 2019 21:00:38 +0000 [thread overview]
Message-ID: <83c59bc63a8042d5afa622bda542864f@AUSX13MPS307.AMER.DELL.COM> (raw)
In-Reply-To: <87ftl9qhv4.fsf@miraculix.mork.no>
<snipped>
> static int cdc_ncm_init(struct usbnet *dev) {
> struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
> u8 iface_no = ctx->control->cur_altsetting->desc.bInterfaceNumber;
> int err;
>
> err = usbnet_read_cmd(dev, USB_CDC_GET_NTB_PARAMETERS,
> USB_TYPE_CLASS | USB_DIR_IN
> |USB_RECIP_INTERFACE,
> 0, iface_no, &ctx->ncm_parm,
> sizeof(ctx->ncm_parm));
> ,,
>
> You'll obviously have to replace USB_CDC_GET_NTB_PARAMETERS with
> USB_CDC_GET_NET_ADDRESS, &ctx->ncm_parm with buf, and
> sizeof(ctx->ncm_parm) with ETH_ALEN.
>
>
> Bjørn
Not everything is obvious to those who do not live and breathe USB. This has been an experience.
Is this snippet what you have in mind? Will iface_no be correct? If not, then what do you suggest?
/* Provide method to push MAC address to the USB device's ethernet controller.
* If the device does not support CDC_SET_ADDRESS, there is no harm and we
* proceed as before.
*/
static int cdc_ncm_set_ethernet_address(struct usbnet *dev,
struct sockaddr *addr)
{
int ret;
struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
u8 iface_no = ctx->control->cur_altsetting->desc.bInterfaceNumber;
ret = usbnet_write_cmd(dev, USB_CDC_SET_NET_ADDRESS,
USB_DIR_OUT | USB_TYPE_CLASS
| USB_RECIP_INTERFACE, 0, iface_no,
addr->sa_data, ETH_ALEN);
if (ret == ETH_ALEN)
ret = 0; /* success */
else if (ret < 0)
dev_dbg(&dev->udev->dev, "bad MAC address put, %d\n", ret);
return ret;
}
next prev parent reply other threads:[~2019-09-06 21:00 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-05 21:01 [PATCH 1/3] net: cdc_ncm: add get/set ethernet address functions Charles.Hyde
2019-09-06 9:02 ` Bjørn Mork
2019-09-06 18:00 ` Charles.Hyde
2019-09-06 18:15 ` Alan Stern
2019-09-06 18:19 ` Charles.Hyde
2019-09-06 20:07 ` Bjørn Mork
2019-09-06 20:20 ` Charles.Hyde
2019-09-06 20:39 ` Bjørn Mork
2019-09-06 21:00 ` Charles.Hyde [this message]
-- strict thread matches above, loose matches on Subject: below --
2019-08-30 19:37 Charles.Hyde
2019-09-02 9:43 ` Oliver Neukum
2019-09-03 16:45 ` Charles.Hyde
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=83c59bc63a8042d5afa622bda542864f@AUSX13MPS307.AMER.DELL.COM \
--to=charles.hyde@dellteam.com \
--cc=Mario.Limonciello@dell.com \
--cc=bjorn@mork.no \
--cc=chip.programmer@gmail.com \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=nic_swsd@realtek.com \
--cc=oliver@neukum.org \
--cc=rjw@rjwysocki.net \
--cc=stern@rowland.harvard.edu \
/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).