-1

In the line 605 to 608 of m_devget, there is a code segment look like this

if (off) {
     cp += off + 2 * sizeof(u_short);
     totlen -= 2 * sizeof(u_short);
 }

What is the 2 * sizeof(u_short) for?

Yu Hao
  • 119,891
  • 44
  • 235
  • 294
王唯哲
  • 21
  • 5

1 Answers1

0

The function in question copies data from device memory into an mbuf structure.

If off (initialised to the off0 parameter) is non-zero, it means that the packet being processed is trailer-encapsulated, so the code has to skip the type and length fields. Each of those fields are 16-bit wide. The code assumes u_short is 16-bit wide, as well.

Michael Foukarakis
  • 39,737
  • 6
  • 87
  • 123