---
name: "iflibtxrx"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/iflibtxrx"
---

# iflibtxrx(9)

Device Dependent Transmit and Receive Functions

## NAME

**iflibtxrx** – Device Dependent Transmit and Receive Functions

## SYNOPSIS

**#include \<ifdi\_if.h\>**

### Interface Manipulation Functions

*int*\

**isc\_txd\_encap**(*void \*sc*, *if\_pkt\_info\_t pi*);

*void*\

**isc\_txd\_flush**(*void \*sc*, *uint16\_t qid*, *uint32\_t \_pidx\_or\_credits\_*);

*int*\

**isc\_txd\_credits\_update**(*void \*sc*, *uint16\_t qid*, *bool clear*);

*int*\

**isc\_rxd\_available**(*void \*sc*, *uint16\_t qsid*, *uint32\_t cidx*);

*void*\

**isc\_rxd\_refill**(*void \*sc*, *uint16\_t qsid*, *uint8\_t flid*, *uint32\_t pidx*, *uint64\_t \*paddrs*, *caddr\_t \*vaddrs*, *uint16\_t count*);

*void*\

**isc\_rxd\_flush**(*void \*sc*, *uint16\_t qsid*, *uint8\_t flid*, *uint32\_t pidx*);

*int*\

**isc\_rxd\_pkt\_get**(*void \*sc*, *if\_rxd\_info\_t ri*);

### Global Variables

*extern* *struct* *if\_txrx*

## DATA STRUCTURES

The device dependent mechanisms for handling packet transmit and receive are primarily defined by the functions named above. The if\_pkt\_info data structure contains statistics and identifying info necessary for packet transmission. While the data structure for packet receipt is the if\_rxd\_info structure.

### The if\_pkt\_info Structure

The fields of *struct if\_pkt\_info* are as follows:

- *ipi\_len*

  (*uint32\_t*) Denotes the size of packet to be sent on the transmit queue.

- *ipi\_segs*

  (*bus\_dma\_segment\_t \**) A pointer to the bus\_dma\_segment of the device independent transfer queue defined in iflib.

- *ipi\_qsidx*

  Unique index value assigned sequentially to each transmit queue. Used to reference the currently transmitting queue.

- *ipi\_nsegs*

  (*uint16\_t*) Number of descriptors to be read into the device dependent transfer descriptors.

- *ipi\_ndescs*

  (*uint16\_t*) Number of descriptors in use. Calculated by subtracting the old pidx value from the new pidx value.

- *ipi\_flags*

  (*uint16\_t*) Flags defined on a per packet basis.

- *ipi\_pidx*

  (*uint32\_t*) Value of first pidx sent to the isc\_encap function for encapsulation and subsequent transmission.

- *ipi\_new\_pidx*

  (*uint32\_t*) Value set after the termination of the isc\_encap function. This value will become the first pidx sent to the isc-encap the next time that the function is called.

- ***The*** *Following* *Fields* *Are* *Used* *For* *Offload* *Handling*

  - *ipi\_csum\_flags*

  (*uint64\_t*) Flags describing the checksum values, used on a per packet basis.

- *ipi\_tso\_segsz*

  (*uint16\_t*) Size of the TSO Segment Size.

- *ipi\_mflags*

  (*uint16\_t*) Flags describing the operational parameters of the mbuf.

- *ipi\_vtag*

  (*uint16\_t*) Contains the VLAN information in the Ethernet Frame.

- *ipi\_etype*

  (*uint16\_t*) Type of ethernet header protocol as contained by the struct ether\_vlan\_header.

- *ipi\_ehrdlen*

  (*uint8\_t*) Length of the Ethernet Header.

- *ipi\_ip\_hlen*

  (*uint8\_t*) Length of the TCP Header

- *ipi\_tcp\_hlen*

  (*uint8\_t*) Length of the TCP Header.

- *ipi\_tcp\_hflags*

  (*uint8\_t*) Flags describing the operational parameters of the TCP Header.

- *ipi\_ipproto*

  (*uint8\_t*) Specifies the type of IP Protocol in use. Example TCP, UDP, or SCTP.

### The if\_rxd\_info Structure

The fields of *struct if\_rxd\_info* are as follows:

- *iri\_qsidx*

  (*uint16\_t*) Unique index value assigned sequentially to each receive queue. Used to reference the currently receiving queue.

- *iri\_vtag*

  (*uint16\_t*) Contains the VLAN information in the Ethernet Frame.

- *iri\_len*

  (*uint16\_t*) Denotes the size of a received packet.

- *iri\_next\_offset*

  (*uint16\_t*) Denotes the offset value for the next packet to be receive. A Null value signifies the end of packet.

- *iri\_cidx*

  (*uint32\_t*) Denotes the index value of the packet currently being processed in the consumer queue.

- *iri\_flowid*

  (*uint32\_t*) Value of the RSS hash for the packet.

- *iri\_rcv\_tstmp*

  (*uint64\_t*) Receive timestamp in nanoseconds since boot. The driver must set M\_TSTMP in *iri\_flags* when the timestamp is valid, and may additionally set M\_TSTMP\_HPREC when the timestamp was taken by hardware at the port.

- *iri\_flags*

  (*uint32\_t*) Flags to copy to the received mbuf. Drivers may set only M\_VLANTAG, M\_TSTMP, and M\_TSTMP\_HPREC.

- *iri\_csum\_flags*

  (*uint32\_t*) Flags describing the checksum value contained in the receive packet.

- *iri\_csum\_data*

  (*uint32\_t*) Checksum data contained in the [mbuf(9)](/mbuf/9.md) packet header.

- *iri\_m*

  (*struct mbuf \**) A mbuf for drivers that manage their own receive queues.

- *iri\_ifp*

  (*struct ifnet \**) A link back to the interface structure. Utilized by drivers that have multiple interface per softc.

- *iri\_rsstype*

  (*uint8\_t*) The value of the RSS hash type.

- *iri\_pad*

  (*uint8\_t*) The length of any padding contained by the received data.

- *iri\_qidx*

  (*uint8\_t*) Represents the type of queue event. If value \>= 0 then it is the freelist id otherwise it is a completion queue event.

## FUNCTIONS

All function calls are associated exclusively with either packet transmission or receipt. The void \*sc passed as the first argument to all of the following functions represents the driver's softc.

### Transmit Packet Functions

- **isc\_txd\_encap**()

  Transmit function that sends a packet on an interface. The if\_pkt\_info data structure contains data information fields describing the packet. This function returns 0 if successful, otherwise an error value is returned.

- **isc\_txd\_flush**()

  Flush function is called immediately after the isc\_txd\_encap function transmits a packet. It updates the hardware producer index or increments the descriptors used to pidx\_or\_credits in the queue designated by the qid number. This is often referred to as poking the doorbell register.

- **isc\_txd\_credits\_update**()

  Credit function advances the buffer ring and calculates the credits (descriptors) processed. Until the I/O is complete it cleans the range in case of multisegments and updates the count of processed packets. The function returns the number of processed credits.

### Receive Packet Functions

- **isc\_rxd\_available**()

  Function calculates the remaining number of descriptors from a position given by idx. The function returns this value.

- **isc\_rxd\_refill**()

  Starting with the physical address paddrs, the function reads a packet into the rx\_ring until a value designated by count is reached. vaddrs is typically not needed and is provided for devices that place their own metadata in the packet header.

- **isc\_rxd\_flush**()

  Flush function updates the producer pointer on the free list flid in queue set number qid to pidx to reflect the presence of new buffers.

- **isc\_rxd\_pkt\_get**()

  Process a single software descriptor. rxr-\>rx\_base\[i\] contains a descriptor that describes a received packet. Hardware specific information about the buffer referred to by ri is returned in the data structure if\_rxd\_info

## SEE ALSO

[iflibdd(9)](/iflibdd/9.md), [iflibdi(9)](/iflibdi/9.md), [mbuf(9)](/mbuf/9.md)

## AUTHORS

This manual page was written by Nicole Graziano
