multiple iov's

Hi,

I’m building intermediate driver which is located below ip.
Until now my driver was required to handle packets with a single buffer with
a single net_iov. (niov=1).
Now I have to handle multiple net_iov’s in single packets.
My understanding of multiple iov’s (in a single net_buf) is that it
represents fragments.

What is the best way to assemble back multiple iov’s?
e.g.: I have a buffer (net_buf_t) with 2 (or more) io_base. how can I get
it back as one chunk of memory?

thanks


Benzy Gabay

Benzy Gabay <bgabay@everbee.com> wrote:
: Hi,

: I’m building intermediate driver which is located below ip.
: Until now my driver was required to handle packets with a single buffer with
: a single net_iov. (niov=1).
: Now I have to handle multiple net_iov’s in single packets.
: My understanding of multiple iov’s (in a single net_buf) is that it
: represents fragments.

Since you’re below ‘ip’ a single npkt is a complete ip packet.
That npkt can be comprised of one or more net_iovs in one or more
net_bufs.

: What is the best way to assemble back multiple iov’s?
: e.g.: I have a buffer (net_buf_t) with 2 (or more) io_base. how can I get
: it back as one chunk of memory?

Not sure what you want here. You can’t force the stack to send down
npkts that only have one net_iov. If you need that for some reason,
you have to allocate a new packet, defrag the original packet to it
(ion->memcpy_from_npkt()), call ion->tx_done() on the original,
ion->reg_tx_done() on the new one and send the new one down. Handling
multiple iov’s will be faster.

-seanb

Use ion->memcpy_from_npkt() to copy to a linear area.

-seanb

Benzy Gabay <bgabay@everbee.com> wrote:
: Sean,

: The whole purpose is actually to read the content of the buffer, not to
: change them.
: I need the complete information that is stored in the buffer.
: e.g.:
: - while I have 1 iov I can actually return on my get_buffer_data
: function the following:
: “return myBuf->net_iov->iov_base;”
: - So the problem now is how to assemble the information on multiply
: net_iov’s and return it.



: –
: ----------------------------------------------
: Benzy Gabay
: “Sean Boudreau” <seanb@qnx.com> wrote in message
: news:9m37h1$le8$1@nntp.qnx.com
:> Benzy Gabay <bgabay@everbee.com> wrote:
:> : Hi,
:>
:> : I’m building intermediate driver which is located below ip.
:> : Until now my driver was required to handle packets with a single buffer
: with
:> : a single net_iov. (niov=1).
:> : Now I have to handle multiple net_iov’s in single packets.
:> : My understanding of multiple iov’s (in a single net_buf) is that it
:> : represents fragments.
:>
:> Since you’re below ‘ip’ a single npkt is a complete ip packet.
:> That npkt can be comprised of one or more net_iovs in one or more
:> net_bufs.
:>
:> : What is the best way to assemble back multiple iov’s?
:> : e.g.: I have a buffer (net_buf_t) with 2 (or more) io_base. how can I
: get
:> : it back as one chunk of memory?
:>
:> Not sure what you want here. You can’t force the stack to send down
:> npkts that only have one net_iov. If you need that for some reason,
:> you have to allocate a new packet, defrag the original packet to it
:> (ion->memcpy_from_npkt()), call ion->tx_done() on the original,
:> ion->reg_tx_done() on the new one and send the new one down. Handling
:> multiple iov’s will be faster.
:>
:> -seanb

Sean,

The whole purpose is actually to read the content of the buffer, not to
change them.
I need the complete information that is stored in the buffer.
e.g.:

  • while I have 1 iov I can actually return on my get_buffer_data
    function the following:
    “return myBuf->net_iov->iov_base;”
  • So the problem now is how to assemble the information on multiply
    net_iov’s and return it.




Benzy Gabay
“Sean Boudreau” <seanb@qnx.com> wrote in message
news:9m37h1$le8$1@nntp.qnx.com

Benzy Gabay <> bgabay@everbee.com> > wrote:
: Hi,

: I’m building intermediate driver which is located below ip.
: Until now my driver was required to handle packets with a single buffer
with
: a single net_iov. (niov=1).
: Now I have to handle multiple net_iov’s in single packets.
: My understanding of multiple iov’s (in a single net_buf) is that it
: represents fragments.

Since you’re below ‘ip’ a single npkt is a complete ip packet.
That npkt can be comprised of one or more net_iovs in one or more
net_bufs.

: What is the best way to assemble back multiple iov’s?
: e.g.: I have a buffer (net_buf_t) with 2 (or more) io_base. how can I
get
: it back as one chunk of memory?

Not sure what you want here. You can’t force the stack to send down
npkts that only have one net_iov. If you need that for some reason,
you have to allocate a new packet, defrag the original packet to it
(ion->memcpy_from_npkt()), call ion->tx_done() on the original,
ion->reg_tx_done() on the new one and send the new one down. Handling
multiple iov’s will be faster.

-seanb

ahhhh, I have a syntax question.

in our case what should be soff ? or better, can you give me an example of
the whole command. I don’t seem to understand what’s going on here.

Thanks a lot.

Benzy Gabay
“Sean Boudreau” <seanb@qnx.com> wrote in message
news:9m38jl$lo5$2@nntp.qnx.com

Use ion->memcpy_from_npkt() to copy to a linear area.

-seanb

Benzy Gabay <> bgabay@everbee.com> > wrote:
: Sean,

: The whole purpose is actually to read the content of the buffer, not to
: change them.
: I need the complete information that is stored in the buffer.
: e.g.:
: - while I have 1 iov I can actually return on my get_buffer_data
: function the following:
: “return myBuf->net_iov->iov_base;”
: - So the problem now is how to assemble the information on
multiply
: net_iov’s and return it.



: –
: ----------------------------------------------
: Benzy Gabay
: “Sean Boudreau” <> seanb@qnx.com> > wrote in message
: news:9m37h1$le8$> 1@nntp.qnx.com> …
:> Benzy Gabay <> bgabay@everbee.com> > wrote:
:> : Hi,
:
:> : I’m building intermediate driver which is located below ip.
:> : Until now my driver was required to handle packets with a single
buffer
: with
:> : a single net_iov. (niov=1).
:> : Now I have to handle multiple net_iov’s in single packets.
:> : My understanding of multiple iov’s (in a single net_buf) is that it
:> : represents fragments.
:
:> Since you’re below ‘ip’ a single npkt is a complete ip packet.
:> That npkt can be comprised of one or more net_iovs in one or more
:> net_bufs.
:
:> : What is the best way to assemble back multiple iov’s?
:> : e.g.: I have a buffer (net_buf_t) with 2 (or more) io_base. how can
I
: get
:> : it back as one chunk of memory?
:
:> Not sure what you want here. You can’t force the stack to send down
:> npkts that only have one net_iov. If you need that for some reason,
:> you have to allocate a new packet, defrag the original packet to it
:> (ion->memcpy_from_npkt()), call ion->tx_done() on the original,
:> ion->reg_tx_done() on the new one and send the new one down. Handling
:> multiple iov’s will be faster.
:
:> -seanb

soff is the offset into the source npkt at which you want to start
copying. In your case it the offset at which the ip packet starts.
If its coming down from the stack, this is 0. If it’s coming
up from a driver, it’s the off argument to your rx_up() function
(14 if from an ethernet driver).

-seanb


Benzy Gabay <bgabay@everbee.com> wrote:
: ahhhh, I have a syntax question.

: in our case what should be soff ? or better, can you give me an example of
: the whole command. I don’t seem to understand what’s going on here.

: Thanks a lot.

: –
: ----------------------------------------------
: Benzy Gabay
: “Sean Boudreau” <seanb@qnx.com> wrote in message
: news:9m38jl$lo5$2@nntp.qnx.com
:>
:> Use ion->memcpy_from_npkt() to copy to a linear area.
:>
:> -seanb
:>
:> Benzy Gabay <bgabay@everbee.com> wrote:
:> : Sean,
:>
:> : The whole purpose is actually to read the content of the buffer, not to
:> : change them.
:> : I need the complete information that is stored in the buffer.
:> : e.g.:
:> : - while I have 1 iov I can actually return on my get_buffer_data
:> : function the following:
:> : “return myBuf->net_iov->iov_base;”
:> : - So the problem now is how to assemble the information on
: multiply
:> : net_iov’s and return it.
:>
:>
:>
:> : –
:> : ----------------------------------------------
:> : Benzy Gabay
:> : “Sean Boudreau” <seanb@qnx.com> wrote in message
:> : news:9m37h1$le8$1@nntp.qnx.com
:> :> Benzy Gabay <bgabay@everbee.com> wrote:
:> :> : Hi,
:> :>
:> :> : I’m building intermediate driver which is located below ip.
:> :> : Until now my driver was required to handle packets with a single
: buffer
:> : with
:> :> : a single net_iov. (niov=1).
:> :> : Now I have to handle multiple net_iov’s in single packets.
:> :> : My understanding of multiple iov’s (in a single net_buf) is that it
:> :> : represents fragments.
:> :>
:> :> Since you’re below ‘ip’ a single npkt is a complete ip packet.
:> :> That npkt can be comprised of one or more net_iovs in one or more
:> :> net_bufs.
:> :>
:> :> : What is the best way to assemble back multiple iov’s?
:> :> : e.g.: I have a buffer (net_buf_t) with 2 (or more) io_base. how can
: I
:> : get
:> :> : it back as one chunk of memory?
:> :>
:> :> Not sure what you want here. You can’t force the stack to send down
:> :> npkts that only have one net_iov. If you need that for some reason,
:> :> you have to allocate a new packet, defrag the original packet to it
:> :> (ion->memcpy_from_npkt()), call ion->tx_done() on the original,
:> :> ion->reg_tx_done() on the new one and send the new one down. Handling
:> :> multiple iov’s will be faster.
:> :>
:> :> -seanb
:>
:>