npkt_t

Hello,

I’m writing the network driver and use as example PCNET source.
But I couldn’t determine from the source what exactly needs to be
transferred to the hardware, i mean when io-net invokes transmit(nic, npkt),
which parts should I transmit of npkt? buffer(s) ? or the npkt as a whole?
To simplify my question let’s assume we have a sender and a receiver sitting
on /dev/serX. What sender needs to transfer to receiver sitting on the other
end in order to receiver to form the npkt and pass it up to the io-net?
And other question would be how the io-net threats the mtu. If i set the mtu
minimum and maximum and preferred to the same value for ex. 4000, will it
ever pass me the other packet size than 4000? and what’s the size of 4000 ?
does it include npkt_t structure members or jus buffer members (assume our
packet is singled).

Thanks in advance.

Arunas

You send the data in the npkt. In your example, something like:

net_buf_t *buf;
net_iov_t *iov;
int fd;

fd = open("/dev/ser1", O_WRONLY);

for (buf = npkt->buffers.tqh_first; buf; buf = buf->ptrs.tqe_next) {
for (i = 0, iov = buf->net_iov; i < buf->niov; i++, iov++) {
write(fd, iov->iov_base, iov->iov_len);
/*

  • If the hardware is busmastering and needs physical addresses,
  • use iov->iov_phys.
    */
    }
    }


    Arunas Bytautas <arubyt@elsis.com> wrote:
    : Hello,

: I’m writing the network driver and use as example PCNET source.
: But I couldn’t determine from the source what exactly needs to be
: transferred to the hardware, i mean when io-net invokes transmit(nic, npkt),
: which parts should I transmit of npkt? buffer(s) ? or the npkt as a whole?
: To simplify my question let’s assume we have a sender and a receiver sitting
: on /dev/serX. What sender needs to transfer to receiver sitting on the other
: end in order to receiver to form the npkt and pass it up to the io-net?
: And other question would be how the io-net threats the mtu. If i set the mtu
: minimum and maximum and preferred to the same value for ex. 4000, will it
: ever pass me the other packet size than 4000? and what’s the size of 4000 ?
: does it include npkt_t structure members or jus buffer members (assume our
: packet is singled).

: Thanks in advance.

: Arunas