* Can ndo_select_queue save data in skb->cb? @ 2014-11-05 17:57 James Yonan 2014-11-05 18:16 ` Eric Dumazet 0 siblings, 1 reply; 5+ messages in thread From: James Yonan @ 2014-11-05 17:57 UTC (permalink / raw) To: netdev Is it permissible for a net driver's ndo_select_queue method to save data in skb->cb for later use in ndo_start_xmit? Also, is it necessary for users of skb->cb to zero out their private data after use to prevent it from being misinterpreted by other layers? I noticed some commits in the log (such as 462fb2) are zeroing out the skb->cb area for this reason. Thanks, James ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can ndo_select_queue save data in skb->cb? 2014-11-05 17:57 Can ndo_select_queue save data in skb->cb? James Yonan @ 2014-11-05 18:16 ` Eric Dumazet 2014-11-05 18:38 ` Cong Wang 0 siblings, 1 reply; 5+ messages in thread From: Eric Dumazet @ 2014-11-05 18:16 UTC (permalink / raw) To: James Yonan; +Cc: netdev On Wed, 2014-11-05 at 10:57 -0700, James Yonan wrote: > Is it permissible for a net driver's ndo_select_queue method to save > data in skb->cb for later use in ndo_start_xmit? > > Also, is it necessary for users of skb->cb to zero out their private > data after use to prevent it from being misinterpreted by other layers? > I noticed some commits in the log (such as 462fb2) are zeroing out the > skb->cb area for this reason. Its ok to use skb->cb[] from ndo_select_queue() Look at bond_select_queue() for such a case. You do not need to cleanup skb->cb[] to zero before giving skb to the driver. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can ndo_select_queue save data in skb->cb? 2014-11-05 18:16 ` Eric Dumazet @ 2014-11-05 18:38 ` Cong Wang 2014-11-05 18:53 ` Eric Dumazet 0 siblings, 1 reply; 5+ messages in thread From: Cong Wang @ 2014-11-05 18:38 UTC (permalink / raw) To: Eric Dumazet; +Cc: James Yonan, netdev On Wed, Nov 5, 2014 at 10:16 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote: > On Wed, 2014-11-05 at 10:57 -0700, James Yonan wrote: >> Is it permissible for a net driver's ndo_select_queue method to save >> data in skb->cb for later use in ndo_start_xmit? >> >> Also, is it necessary for users of skb->cb to zero out their private >> data after use to prevent it from being misinterpreted by other layers? >> I noticed some commits in the log (such as 462fb2) are zeroing out the >> skb->cb area for this reason. > > Its ok to use skb->cb[] from ndo_select_queue() > > Look at bond_select_queue() for such a case. > > You do not need to cleanup skb->cb[] to zero before giving skb to the > driver. > That is only because qdisc layer saves data for bond, which means if you have more data to save, you have to put more into qdisc CB, it is just ugly. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can ndo_select_queue save data in skb->cb? 2014-11-05 18:38 ` Cong Wang @ 2014-11-05 18:53 ` Eric Dumazet 2014-11-05 19:23 ` John Fastabend 0 siblings, 1 reply; 5+ messages in thread From: Eric Dumazet @ 2014-11-05 18:53 UTC (permalink / raw) To: Cong Wang; +Cc: James Yonan, netdev On Wed, 2014-11-05 at 10:38 -0800, Cong Wang wrote: > That is only because qdisc layer saves data for bond, > which means if you have more data to save, you have to put > more into qdisc CB, it is just ugly. Right, using skb->cb[] is ugly, dangerous, and all this. If you can, avoiding it is safer. Note that I pointed to the bonding case for a legal case, I had no time to do a full explanation, feel free to do so ;) ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Can ndo_select_queue save data in skb->cb? 2014-11-05 18:53 ` Eric Dumazet @ 2014-11-05 19:23 ` John Fastabend 0 siblings, 0 replies; 5+ messages in thread From: John Fastabend @ 2014-11-05 19:23 UTC (permalink / raw) To: Eric Dumazet; +Cc: Cong Wang, James Yonan, netdev On 11/05/2014 10:53 AM, Eric Dumazet wrote: > On Wed, 2014-11-05 at 10:38 -0800, Cong Wang wrote: >> That is only because qdisc layer saves data for bond, >> which means if you have more data to save, you have to put >> more into qdisc CB, it is just ugly. > > Right, using skb->cb[] is ugly, dangerous, and all this. > > If you can, avoiding it is safer. > > Note that I pointed to the bonding case for a legal case, > I had no time to do a full explanation, feel free to do so ;) > I would prefer to get rid of select_queue() versus expand it. It mostly seems to be used for hacks around the stack for FCoE/DCB/whatever. The wireless drivers and bonding/team drivers are two examples where its not clear how to remove it. See xen-netfront.c for an example where I'm not sure why its needed at all. James, why is your driver feeding itself data via cb? Maybe we could solve the problem some other way. Thanks, John > > > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > -- John Fastabend Intel Corporation ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2014-11-05 19:23 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2014-11-05 17:57 Can ndo_select_queue save data in skb->cb? James Yonan 2014-11-05 18:16 ` Eric Dumazet 2014-11-05 18:38 ` Cong Wang 2014-11-05 18:53 ` Eric Dumazet 2014-11-05 19:23 ` John Fastabend
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).