From: Lech Perczak <lech.perczak@gmail.com>
To: "Bjørn Mork" <bjorn@mork.no>
Cc: netdev@vger.kernel.org, linux-usb@vger.kernel.org,
Kristian Evensen <kristian.evensen@gmail.com>,
Oliver Neukum <oliver@neukum.org>
Subject: Re: [PATCH 2/3] rndis_host: enable the bogus MAC fixup for ZTE devices from cdc_ether
Date: Thu, 7 Apr 2022 22:51:52 +0200 [thread overview]
Message-ID: <c5f5e028-26b1-5c2d-ed7f-e36550ce6ac2@gmail.com> (raw)
In-Reply-To: <87o81d1kay.fsf@miraculix.mork.no>
Hi Bjørn,
Many thanks you for your review! Answers inline.
W dniu 2022-04-07 o 08:25, Bjørn Mork pisze:
> Lech Perczak <lech.perczak@gmail.com> writes:
>
>> +static int zte_rndis_rx_fixup(struct usbnet *dev, struct sk_buff *skb)
>> +{
>> + return rndis_rx_fixup(dev, skb) && usbnet_cdc_zte_rx_fixup(dev, skb);
>> +}
>>
> Does this work as expected? Only the last ethernet packet in the rndis
> frame will end up being handled by usbnet_cdc_zte_rx_fixup(). The
> others are cloned and submitted directly to usbnet_skb_return().
I've got some positive reports from at least two owners of the device -
I don't have one myself. In the meantime asked them to run tests with
high traffic, because this should most probably manifest itself in that
scenario easily - my wild guess is that the modem doesn't use batching,
but you are most certainly right in the general case. And for testing on
older modems, we can probably only count on Kristian.
>
> I don't know how to best solve that, but maybe add another
> RNDIS_DRIVER_DATA_x flag and test that in rndis_rx_fixup? I.e something
> like
>
> bool fixup_dst = dev->driver_info->data & RNDIS_DRIVER_DATA_FIXUP_DST:
> ..
>
> /* try to return all the packets in the batch */
> skb2 = skb_clone(skb, GFP_ATOMIC);
> if (unlikely(!skb2))
> break;
> skb_pull(skb, msg_len - sizeof *hdr);
> skb_trim(skb2, data_len);
> if (fixup_dst)
> usbnet_cdc_zte_rx_fixup(dev, skb2);
> usbnet_skb_return(dev, skb2);
> }
> if (fixup_dst)
> usbnet_cdc_zte_rx_fixup(dev, skb);
>
> /* caller will usbnet_skb_return the remaining packet */
> return 1;
> }
I'll consider that. My concern with that approach is degradation of
performance by testing for that flag, both for ZTE and non-ZTE devices,
for each and every packet. But this might be the only solution, as I
cannot catch the n-1 sk_buffs from the batch mid-flight, only the last
one. The only other way that currently comes to my mind, is to duplicate
rndis_rx_fixup, with added calls to usbnet_cdc_zte_rx_fixup in the right
places. But the amount of duplicated code by doing so would be huge, so
I'd like to avoid that as well.
I will definitely send a V2 after I decide on a solution and do some
testing, including high downlink traffic.
>
>
>
> Bjørn
--
Pozdrawiam/Kind regards,
Lech Perczak
next prev parent reply other threads:[~2022-04-07 20:53 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-04-07 0:19 [PATCH 0/3] rndis_host: handle bogus MAC addresses in ZTE RNDIS devices Lech Perczak
2022-04-07 0:19 ` [PATCH 1/3] cdc_ether: export usbnet_cdc_zte_rx_fixup Lech Perczak
2022-04-07 0:19 ` [PATCH 2/3] rndis_host: enable the bogus MAC fixup for ZTE devices from cdc_ether Lech Perczak
2022-04-07 6:25 ` Bjørn Mork
2022-04-07 20:51 ` Lech Perczak [this message]
2022-04-12 22:32 ` Lech Perczak
2022-04-07 0:19 ` [PATCH 3/3] rndis_host: limit scope of bogus MAC address detection to ZTE devices Lech Perczak
2022-04-07 6:43 ` Bjørn Mork
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=c5f5e028-26b1-5c2d-ed7f-e36550ce6ac2@gmail.com \
--to=lech.perczak@gmail.com \
--cc=bjorn@mork.no \
--cc=kristian.evensen@gmail.com \
--cc=linux-usb@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oliver@neukum.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;
as well as URLs for NNTP newsgroup(s).