* several packets in a single buffer in Rx @ 2011-05-16 9:41 Emmanuel Grumbach [not found] ` <BANLkTimkgtQL1A2A3iAP-UYK2KdDvPmY3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Emmanuel Grumbach @ 2011-05-16 9:41 UTC (permalink / raw) To: netdev-u79uwXL29TY76Z2rM5mHXA, linux-wireless-u79uwXL29TY76Z2rM5mHXA Cc: Johannes Berg, Guy, Wey-Yi, guy.cohen-ral2JQCrhuEAvxtiuMwx3w Hi, I am trying to enable a HW feature on a wireless NIC that allows the HW to put several packets in the same Rx buffer coming from the NIC. This can save interrupts and traffic on the bus. Today, the driver allocates pages in which the PCI-e device puts its data. Then we create an skb and add a fragment that points to the beginning of the page. The offset of the fragment is set to the offset of the first byte of the mac header within the buffer. There is only one packet per page / buffer. I would like to be able to deliver the same page several times to the stack without having the stack consume it before the last time I deliver it. Of course I would like to avoid cloning it. I tried to look at shinfo->nr_frags but this looks more like a sgl related variable GRO doesn't seem to be related either since as far as I understood, it is relevant for packets after 802.11 to 802.3 translation. FWIW: I am talking about Intel's wireless device although I don't think this fact matters Thanks Emmanuel Grumbach egrumbach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <BANLkTimkgtQL1A2A3iAP-UYK2KdDvPmY3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: several packets in a single buffer in Rx [not found] ` <BANLkTimkgtQL1A2A3iAP-UYK2KdDvPmY3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2011-05-16 11:06 ` Michał Mirosław 2011-05-16 12:59 ` Emmanuel Grumbach 0 siblings, 1 reply; 7+ messages in thread From: Michał Mirosław @ 2011-05-16 11:06 UTC (permalink / raw) To: Emmanuel Grumbach Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-wireless-u79uwXL29TY76Z2rM5mHXA, Johannes Berg, Guy, Wey-Yi, guy.cohen-ral2JQCrhuEAvxtiuMwx3w 2011/5/16 Emmanuel Grumbach <egrumbach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > I would like to be able to deliver the same page several times to the > stack without having the stack consume it before the last time I > deliver it. > Of course I would like to avoid cloning it. Just do get_page() on the page having another packet in it before passing skb up. Best Regards, Michał Mirosław -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: several packets in a single buffer in Rx 2011-05-16 11:06 ` Michał Mirosław @ 2011-05-16 12:59 ` Emmanuel Grumbach 2011-05-16 13:13 ` Michał Mirosław 0 siblings, 1 reply; 7+ messages in thread From: Emmanuel Grumbach @ 2011-05-16 12:59 UTC (permalink / raw) To: Michał Mirosław Cc: netdev, linux-wireless, Johannes Berg, Guy, Wey-Yi, guy.cohen 2011/5/16 Michał Mirosław <mirqus@gmail.com>: > 2011/5/16 Emmanuel Grumbach <egrumbach@gmail.com>: >> I would like to be able to deliver the same page several times to the >> stack without having the stack consume it before the last time I >> deliver it. >> Of course I would like to avoid cloning it. > > Just do get_page() on the page having another packet in it before > passing skb up. > I can see the path: __kfree_skb -> skb_release_all -> skb_release_data -> put_page put_page will free the page iff the _count variable reaches 0. Of course, _count is incremented by get_page. I will give it try. I understand that this will work regardless the order given to alloc_pages right ? Thanks ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: several packets in a single buffer in Rx 2011-05-16 12:59 ` Emmanuel Grumbach @ 2011-05-16 13:13 ` Michał Mirosław [not found] ` <BANLkTi=xJbL-26Hzg0Pp5zKPUi35bV6VmA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Michał Mirosław @ 2011-05-16 13:13 UTC (permalink / raw) To: Emmanuel Grumbach Cc: netdev, linux-wireless, Johannes Berg, Guy, Wey-Yi, guy.cohen W dniu 16 maja 2011 14:59 użytkownik Emmanuel Grumbach <egrumbach@gmail.com> napisał: > 2011/5/16 Michał Mirosław <mirqus@gmail.com>: >> 2011/5/16 Emmanuel Grumbach <egrumbach@gmail.com>: >>> I would like to be able to deliver the same page several times to the >>> stack without having the stack consume it before the last time I >>> deliver it. >>> Of course I would like to avoid cloning it. >> >> Just do get_page() on the page having another packet in it before >> passing skb up. >> > > I can see the path: > __kfree_skb -> skb_release_all -> skb_release_data -> put_page > put_page will free the page iff the _count variable reaches 0. Of course, > _count is incremented by get_page. > > I will give it try. > > I understand that this will work regardless the order given to > alloc_pages right ? Yes. Remember that if you put a lot of packets in a big-order page then the memory will be freed only after all packets are freed. Best Regards, Michał Mirosław ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <BANLkTi=xJbL-26Hzg0Pp5zKPUi35bV6VmA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: several packets in a single buffer in Rx [not found] ` <BANLkTi=xJbL-26Hzg0Pp5zKPUi35bV6VmA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2011-05-16 13:36 ` Emmanuel Grumbach 2011-05-16 20:04 ` Tomas Winkler 0 siblings, 1 reply; 7+ messages in thread From: Emmanuel Grumbach @ 2011-05-16 13:36 UTC (permalink / raw) To: Michał Mirosław Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-wireless-u79uwXL29TY76Z2rM5mHXA, Johannes Berg, Guy, Wey-Yi, guy.cohen-ral2JQCrhuEAvxtiuMwx3w 2011/5/16 Michał Mirosław <mirqus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > W dniu 16 maja 2011 14:59 użytkownik Emmanuel Grumbach > <egrumbach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> napisał: >> 2011/5/16 Michał Mirosław <mirqus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: >>> 2011/5/16 Emmanuel Grumbach <egrumbach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: >>>> I would like to be able to deliver the same page several times to the >>>> stack without having the stack consume it before the last time I >>>> deliver it. >>>> Of course I would like to avoid cloning it. >>> >>> Just do get_page() on the page having another packet in it before >>> passing skb up. >>> >> >> I can see the path: >> __kfree_skb -> skb_release_all -> skb_release_data -> put_page >> put_page will free the page iff the _count variable reaches 0. Of course, >> _count is incremented by get_page. >> >> I will give it try. >> >> I understand that this will work regardless the order given to >> alloc_pages right ? > > Yes. Remember that if you put a lot of packets in a big-order page > then the memory will be freed only after all packets are freed. Sure. Thanks for the help. > > Best Regards, > Michał Mirosław > -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: several packets in a single buffer in Rx 2011-05-16 13:36 ` Emmanuel Grumbach @ 2011-05-16 20:04 ` Tomas Winkler [not found] ` <BANLkTimvCVcQX-7teQgG7EQV9eeLgG3JnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 0 siblings, 1 reply; 7+ messages in thread From: Tomas Winkler @ 2011-05-16 20:04 UTC (permalink / raw) To: Emmanuel Grumbach Cc: Michał Mirosław, netdev, linux-wireless, Johannes Berg, Guy, Wey-Yi, guy.cohen 2011/5/16 Emmanuel Grumbach <egrumbach@gmail.com>: > 2011/5/16 Michał Mirosław <mirqus@gmail.com>: >> W dniu 16 maja 2011 14:59 użytkownik Emmanuel Grumbach >> <egrumbach@gmail.com> napisał: >>> 2011/5/16 Michał Mirosław <mirqus@gmail.com>: >>>> 2011/5/16 Emmanuel Grumbach <egrumbach@gmail.com>: >>>>> I would like to be able to deliver the same page several times to the >>>>> stack without having the stack consume it before the last time I >>>>> deliver it. >>>>> Of course I would like to avoid cloning it. >>>> >>>> Just do get_page() on the page having another packet in it before >>>> passing skb up. >>>> >>> >>> I can see the path: >>> __kfree_skb -> skb_release_all -> skb_release_data -> put_page >>> put_page will free the page iff the _count variable reaches 0. Of course, >>> _count is incremented by get_page. >>> >>> I will give it try. >>> >>> I understand that this will work regardless the order given to >>> alloc_pages right ? >> >> Yes. Remember that if you put a lot of packets in a big-order page >> then the memory will be freed only after all packets are freed. > > Sure. Thanks for the help. How it is ensured that skb manipulation won't corrupt another packet on the same page? Thanks Tomas ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <BANLkTimvCVcQX-7teQgG7EQV9eeLgG3JnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>]
* Re: several packets in a single buffer in Rx [not found] ` <BANLkTimvCVcQX-7teQgG7EQV9eeLgG3JnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> @ 2011-05-16 20:15 ` Ben Hutchings 0 siblings, 0 replies; 7+ messages in thread From: Ben Hutchings @ 2011-05-16 20:15 UTC (permalink / raw) To: Tomas Winkler Cc: Emmanuel Grumbach, Michał Mirosław, netdev-u79uwXL29TY76Z2rM5mHXA, linux-wireless-u79uwXL29TY76Z2rM5mHXA, Johannes Berg, Guy, Wey-Yi, guy.cohen-ral2JQCrhuEAvxtiuMwx3w On Mon, 2011-05-16 at 23:04 +0300, Tomas Winkler wrote: > 2011/5/16 Emmanuel Grumbach <egrumbach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > 2011/5/16 Michał Mirosław <mirqus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > >> W dniu 16 maja 2011 14:59 użytkownik Emmanuel Grumbach > >> <egrumbach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> napisał: > >>> 2011/5/16 Michał Mirosław <mirqus-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > >>>> 2011/5/16 Emmanuel Grumbach <egrumbach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > >>>>> I would like to be able to deliver the same page several times to the > >>>>> stack without having the stack consume it before the last time I > >>>>> deliver it. > >>>>> Of course I would like to avoid cloning it. > >>>> > >>>> Just do get_page() on the page having another packet in it before > >>>> passing skb up. > >>>> > >>> > >>> I can see the path: > >>> __kfree_skb -> skb_release_all -> skb_release_data -> put_page > >>> put_page will free the page iff the _count variable reaches 0. Of course, > >>> _count is incremented by get_page. > >>> > >>> I will give it try. > >>> > >>> I understand that this will work regardless the order given to > >>> alloc_pages right ? > >> > >> Yes. Remember that if you put a lot of packets in a big-order page > >> then the memory will be freed only after all packets are freed. > > > > Sure. Thanks for the help. > > How it is ensured that skb manipulation won't corrupt another packet > on the same page? Fragments attached to an skb are always treated as read-only. The headers will be copied into the skb's header buffer and may be modified there. Ben. -- Ben Hutchings, Senior Software Engineer, Solarflare Not speaking for my employer; that's the marketing department's job. They asked us to note that Solarflare product names are trademarked. -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org More majordomo info at http://vger.kernel.org/majordomo-info.html ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2011-05-16 20:15 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-05-16 9:41 several packets in a single buffer in Rx Emmanuel Grumbach [not found] ` <BANLkTimkgtQL1A2A3iAP-UYK2KdDvPmY3Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2011-05-16 11:06 ` Michał Mirosław 2011-05-16 12:59 ` Emmanuel Grumbach 2011-05-16 13:13 ` Michał Mirosław [not found] ` <BANLkTi=xJbL-26Hzg0Pp5zKPUi35bV6VmA-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2011-05-16 13:36 ` Emmanuel Grumbach 2011-05-16 20:04 ` Tomas Winkler [not found] ` <BANLkTimvCVcQX-7teQgG7EQV9eeLgG3JnQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org> 2011-05-16 20:15 ` Ben Hutchings
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).