From: "Bjørn Mork" <bjorn@mork.no>
To: Oliver Neukum <oneukum@suse.com>
Cc: andrew@lunn.ch, netdev@vger.kernel.org
Subject: Re: [RFCv5 05/13] net: usb: use accessor helper for usbnet private data
Date: Mon, 09 Mar 2026 18:46:39 +0100 [thread overview]
Message-ID: <87y0k0q4jk.fsf@miraculix.mork.no> (raw)
In-Reply-To: <20260309165614.861929-5-oneukum@suse.com> (Oliver Neukum's message of "Mon, 9 Mar 2026 17:53:28 +0100")
Oliver Neukum <oneukum@suse.com> writes:
> diff --git a/drivers/net/usb/cdc_mbim.c b/drivers/net/usb/cdc_mbim.c
> index dbf01210b0e7..5522dc137d45 100644
> --- a/drivers/net/usb/cdc_mbim.c
> +++ b/drivers/net/usb/cdc_mbim.c
> @@ -43,7 +43,7 @@ enum cdc_mbim_flags {
> /* using a counter to merge subdriver requests with our own into a combined state */
> static int cdc_mbim_manage_power(struct usbnet *dev, int on)
> {
> - struct cdc_mbim_state *info = (void *)&dev->data;
> + struct cdc_mbim_state *info = usbnet_priv(dev);
> int rv = 0;
>
> dev_dbg(&dev->intf->dev, "%s() pmcount=%d, on=%d\n", __func__, atomic_read(&info->pmcount), on);
I'm not sure I'm following all the conversions, but you are aware that
cdc_mbim and cdc_ncm share a few functions struct cdc_ncm_ctx state, the
and therefore have to cooperate wrt the private data layout?
The 'struct cdc_mbim_state' has a ctx field which is supposed to be
managed by the cdc_ncm part of the driver:
struct cdc_mbim_state {
struct cdc_ncm_ctx *ctx;
atomic_t pmcount;
struct usb_driver *subdriver;
unsigned long _unused;
unsigned long flags;
};
The cdc_mbim driver currently depends on cdc_ncm_bind_common(), which is
called from cdc_mbim_bind(), to allocate the 'struct cdc_ncm_ctx' data.
It will later call other functions, like cdc_ncm_fill_tx_frame(), which
depend on that 'struct cdc_ncm_ctx *ctx' field.
I don't understand how you make the patch above work in cooperation with
this:
@@ -1203,7 +1187,7 @@ static struct usb_cdc_ncm_ndp32 *cdc_ncm_ndp32(struct cdc_ncm_ctx *ctx, struct s
struct sk_buff *
cdc_ncm_fill_tx_frame(struct usbnet *dev, struct sk_buff *skb, __le32 sign)
{
- struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0];
+ struct cdc_ncm_ctx *ctx = usbnet_priv(dev);
union {
struct usb_cdc_ncm_nth16 *nth16;
struct usb_cdc_ncm_nth32 *nth32;
Looks like the cdc_mbim driver will use the same usbnet_priv(dev) as
both 'struct cdc_ncm_ctx' and 'struct cdc_mbim_state'.
Yes, I know this too magic, and should be rewritten on so many levels.
But it is what it is.
Bjørn
next prev parent reply other threads:[~2026-03-09 18:00 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 16:53 [RFCv3 01/13] net: usb: usbnet: use proper ep number macros Oliver Neukum
2026-03-09 16:53 ` [RFCv3 02/13] net: usb: move updating filter and status from cdc to usbnet Oliver Neukum
2026-03-09 16:53 ` [RFCv3 03/13] net: usb: centralize usbnet_cdc_zte_rx_fixup in usbnet Oliver Neukum
2026-03-09 16:53 ` [RFCv4 04/13] net: usb: usbnet: add access helper for private data Oliver Neukum
2026-03-09 16:53 ` [RFCv5 05/13] net: usb: use accessor helper for usbnet " Oliver Neukum
2026-03-09 17:46 ` Bjørn Mork [this message]
2026-03-10 13:00 ` Oliver Neukum
2026-03-10 13:23 ` Bjørn Mork
2026-03-09 16:53 ` [RFCv3 06/13] net: usb: usbnet: add cdc_state to struct usbnet Oliver Neukum
2026-03-09 16:53 ` [RFCv3 07/13] net: usb: use cdc_state in " Oliver Neukum
2026-03-09 16:53 ` [RFCv3 08/13] net: usb: usbnet: allow drivers to specify private space needed Oliver Neukum
2026-03-09 16:53 ` [RFCv3 09/13] net: usb: use allocation on demand for usbnet Oliver Neukum
2026-03-09 16:53 ` [RFCv3 10/13] net: usb: sierra_net: use dynamic private allocation Oliver Neukum
2026-03-09 16:53 ` [RFCv3 11/13] net: usb: cdc_ncm: " Oliver Neukum
2026-03-09 16:53 ` [RFCv3 12/13] net: usb: smsc95xx: " Oliver Neukum
2026-03-09 16:53 ` [RFCv3 13/13] net: usb: lg-vl600: " Oliver Neukum
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=87y0k0q4jk.fsf@miraculix.mork.no \
--to=bjorn@mork.no \
--cc=andrew@lunn.ch \
--cc=netdev@vger.kernel.org \
--cc=oneukum@suse.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