1*1842bb7eSAlexander Motin.Dd December 17, 2020 2fa504546SEnji Cooper.Dt IFLIBTXTX 9 334bac11eSSean Bruno.Os 434bac11eSSean Bruno.Sh NAME 534bac11eSSean Bruno.Nm iflibtxrx 634bac11eSSean Bruno.Nd Device Dependent Transmit and Receive Functions 734bac11eSSean Bruno.Sh SYNOPSIS 834bac11eSSean Bruno.In "ifdi_if.h" 934bac11eSSean Bruno.Ss "Interface Manipulation Functions" 1034bac11eSSean Bruno.Ft int 11fa504546SEnji Cooper.Fo isc_txd_encap 12fa504546SEnji Cooper.Fa "void *sc" 13*1842bb7eSAlexander Motin.Fa "if_pkt_info_t pi" 14fa504546SEnji Cooper.Fc 1534bac11eSSean Bruno.Ft void 16fa504546SEnji Cooper.Fo isc_txd_flush 17fa504546SEnji Cooper.Fa "void *sc" 18fa504546SEnji Cooper.Fa "uint16_t qid" 19fa504546SEnji Cooper.Fa "uint32_t _pidx_or_credits_" 20fa504546SEnji Cooper.Fc 214066060cSEd Maste.Ft int 22fa504546SEnji Cooper.Fo isc_txd_credits_update 23fa504546SEnji Cooper.Fa "void *sc" 24fa504546SEnji Cooper.Fa "uint16_t qid" 254066060cSEd Maste.Fa "bool clear" 26fa504546SEnji Cooper.Fc 274066060cSEd Maste.Ft int 28fa504546SEnji Cooper.Fo isc_rxd_available 29fa504546SEnji Cooper.Fa "void *sc" 30fa504546SEnji Cooper.Fa "uint16_t qsid" 31fa504546SEnji Cooper.Fa "uint32_t cidx" 32fa504546SEnji Cooper.Fc 334066060cSEd Maste.Ft void 34fa504546SEnji Cooper.Fo isc_rxd_refill 35fa504546SEnji Cooper.Fa "void *sc" 36fa504546SEnji Cooper.Fa "uint16_t qsid" 37fa504546SEnji Cooper.Fa "uint8_t flid" 38fa504546SEnji Cooper.Fa "uint32_t pidx" 39fa504546SEnji Cooper.Fa "uint64_t *paddrs" 40fa504546SEnji Cooper.Fa "caddr_t *vaddrs" 41fa504546SEnji Cooper.Fa "uint16_t count" 42fa504546SEnji Cooper.Fc 434066060cSEd Maste.Ft void 44fa504546SEnji Cooper.Fo isc_rxd_flush 45fa504546SEnji Cooper.Fa "void *sc" 46fa504546SEnji Cooper.Fa "uint16_t qsid" 47fa504546SEnji Cooper.Fa "uint8_t flid" 48fa504546SEnji Cooper.Fa "uint32_t pidx" 49fa504546SEnji Cooper.Fc 5034bac11eSSean Bruno.Ft int 51fa504546SEnji Cooper.Fo isc_rxd_pkt_get 52fa504546SEnji Cooper.Fa "void *sc" 53fa504546SEnji Cooper.Fa "if_rxd_info_t ri" 54fa504546SEnji Cooper.Fc 5534bac11eSSean Bruno.Ss "Global Variables" 5634bac11eSSean Bruno.Vt extern struct if_txrx 5734bac11eSSean Bruno.Sh DATA STRUCTURES 58fa504546SEnji CooperThe device dependent mechanisms for handling packet transmit and receive are 59fa504546SEnji Cooperprimarily defined by the functions named above. 60fa504546SEnji CooperThe if_pkt_info data structure contains statistics and identifying info 61fa504546SEnji Coopernecessary for packet transmission. 62fa504546SEnji CooperWhile the data structure for packet receipt is the if_rxd_info structure. 6334bac11eSSean Bruno.Ss The if_pkt_info Structure 6434bac11eSSean BrunoThe fields of 6534bac11eSSean Bruno.Vt "struct if_pkt_info" 6634bac11eSSean Brunoare as follows: 6734bac11eSSean Bruno.Bl -tag -width ".Va if_capabilities" -offset indent 6834bac11eSSean Bruno.It Va ipi_len 6934bac11eSSean Bruno.Pq Vt "uint32_t" 7034bac11eSSean BrunoDenotes the size of packet to be sent on the transmit queue. 7134bac11eSSean Bruno.It Va ipi_segs 7234bac11eSSean Bruno.Pq Vt "bus_dma_segment_t *" 73fa504546SEnji CooperA pointer to the bus_dma_segment of the device independent transfer queue 74fa504546SEnji Cooperdefined in iflib. 7534bac11eSSean Bruno.It Va ipi_qsidx 76fa504546SEnji CooperUnique index value assigned sequentially to each transmit queue. 77fa504546SEnji CooperUsed to reference the currently transmitting queue. 7834bac11eSSean Bruno.It Va ipi_nsegs 7934bac11eSSean Bruno.Pq Vt "uint16_t" 80fa504546SEnji CooperNumber of descriptors to be read into the device dependent transfer 81fa504546SEnji Cooperdescriptors. 8234bac11eSSean Bruno.It Va ipi_ndescs 8334bac11eSSean Bruno.Pq Vt "uint16_t" 84fa504546SEnji CooperNumber of descriptors in use. 85fa504546SEnji CooperCalculated by subtracting the old pidx value from the new pidx value. 8634bac11eSSean Bruno.It Va ipi_flags 8734bac11eSSean Bruno.Pq Vt "uint16_t" 8834bac11eSSean BrunoFlags defined on a per packet basis. 8934bac11eSSean Bruno.It Va ipi_pidx 9034bac11eSSean Bruno.Pq Vt "uint32_t" 91fa504546SEnji CooperValue of first pidx sent to the isc_encap function for encapsulation and 92fa504546SEnji Coopersubsequent transmission. 9334bac11eSSean Bruno.It Va ipi_new_pidx 9434bac11eSSean Bruno.Pq Vt "uint32_t" 95fa504546SEnji CooperValue set after the termination of the isc_encap function. 96fa504546SEnji CooperThis value will become the first pidx sent to the isc-encap the next time that 97fa504546SEnji Cooperthe function is called. 9834bac11eSSean Bruno.It Va \fBThe Following Fields Are Used For Offload Handling\fP 9934bac11eSSean Bruno.It Va ipi_csum_flags 10034bac11eSSean Bruno.Pq Vt "uint64_t" 101fa504546SEnji CooperFlags describing the checksum values, used on a per packet basis. 10234bac11eSSean Bruno.It Va ipi_tso_segsz 10334bac11eSSean Bruno.Pq Vt "uint16_t" 10434bac11eSSean BrunoSize of the TSO Segment Size. 10534bac11eSSean Bruno.It Va ipi_mflags 10634bac11eSSean Bruno.Pq Vt "uint16_t" 10734bac11eSSean BrunoFlags describing the operational parameters of the mbuf. 10834bac11eSSean Bruno.It Va ipi_vtag 10934bac11eSSean Bruno.Pq Vt "uint16_t" 11034bac11eSSean BrunoContains the VLAN information in the Ethernet Frame. 11134bac11eSSean Bruno.It Va ipi_etype 11234bac11eSSean Bruno.Pq Vt "uint16_t" 11334bac11eSSean BrunoType of ethernet header protocol as contained by the struct ether_vlan_header. 11434bac11eSSean Bruno.It Va ipi_ehrdlen 11534bac11eSSean Bruno.Pq Vt "uint8_t" 11634bac11eSSean BrunoLength of the Ethernet Header. 11734bac11eSSean Bruno.It Va ipi_ip_hlen 11834bac11eSSean Bruno.Pq Vt "uint8_t" 11934bac11eSSean BrunoLength of the TCP Header 12034bac11eSSean Bruno.It Va ipi_tcp_hlen 12134bac11eSSean Bruno.Pq Vt "uint8_t" 12234bac11eSSean BrunoLength of the TCP Header. 12334bac11eSSean Bruno.It Va ipi_tcp_hflags 12434bac11eSSean Bruno.Pq Vt "uint8_t" 12534bac11eSSean BrunoFlags describing the operational parameters of the TCP Header. 12634bac11eSSean Bruno.It Va ipi_ipproto 12734bac11eSSean Bruno.Pq Vt "uint8_t" 128fa504546SEnji CooperSpecifies the type of IP Protocol in use. 129fa504546SEnji CooperExample TCP, UDP, or SCTP. 13034bac11eSSean Bruno.El 13134bac11eSSean Bruno.Ss The if_rxd_info Structure 13234bac11eSSean BrunoThe fields of 13334bac11eSSean Bruno.Vt "struct if_rxd_info" 13434bac11eSSean Brunoare as follows: 13534bac11eSSean Bruno.Bl -tag -width ".Va if_capabilities" -offset indent 13634bac11eSSean Bruno.It Va iri_qsidx 13734bac11eSSean Bruno.Pq Vt "uint16_t" 138fa504546SEnji CooperUnique index value assigned sequentially to each receive queue. 139fa504546SEnji CooperUsed to reference the currently receiving queue. 14034bac11eSSean Bruno.It Va iri_vtag 14134bac11eSSean Bruno.Pq Vt "uint16_t" 14234bac11eSSean BrunoContains the VLAN information in the Ethernet Frame. 14334bac11eSSean Bruno.It Va iri_len 14434bac11eSSean Bruno.Pq Vt "uint16_t" 14534bac11eSSean BrunoDenotes the size of a received packet. 14634bac11eSSean Bruno.It Va iri_next_offset 14734bac11eSSean Bruno.Pq Vt "uint16_t" 148fa504546SEnji CooperDenotes the offset value for the next packet to be receive. 149fa504546SEnji CooperA Null value signifies the end of packet. 15034bac11eSSean Bruno.It Va iri_cidx 15134bac11eSSean Bruno.Pq Vt "uint32_t" 152fa504546SEnji CooperDenotes the index value of the packet currently being processed in the 153fa504546SEnji Cooperconsumer queue. 15434bac11eSSean Bruno.It Va iri_flowid 15534bac11eSSean Bruno.Pq Vt "uint32_t" 15634bac11eSSean BrunoValue of the RSS hash for the packet. 15734bac11eSSean Bruno.It Va iri_flags 15834bac11eSSean Bruno.Pq Vt "uint" 159fa504546SEnji Cooper Flags describing the operational parameters of the mbuf contained in the 160fa504546SEnji Cooper receive packet. 16134bac11eSSean Bruno.It Va iri_csum_flags 16234bac11eSSean Bruno.Pq Vt "uint32_t" 16334bac11eSSean BrunoFlags describing the checksum value contained in the receive packet. 16434bac11eSSean Bruno.It Va iri_csum_data 16534bac11eSSean Bruno.Pq Vt "uint32_t" 166fa504546SEnji CooperChecksum data contained in the 167fa504546SEnji Cooper.Xr mbuf 9 168fa504546SEnji Cooperpacket header. 16934bac11eSSean Bruno.It Va iri_m 17034bac11eSSean Bruno.Pq Vt "struct mbuf *" 17134bac11eSSean BrunoA mbuf for drivers that manage their own receive queues. 17234bac11eSSean Bruno.It Va iri_ifp 17334bac11eSSean Bruno.Pq Vt "struct ifnet *" 174fa504546SEnji CooperA link back to the interface structure. 175fa504546SEnji CooperUtilized by drivers that have multiple interface per softc. 17634bac11eSSean Bruno.It Va iri_rsstype 17734bac11eSSean Bruno.Pq Vt "uint8_t" 17834bac11eSSean BrunoThe value of the RSS hash type. 17934bac11eSSean Bruno.It Va iri_pad 18034bac11eSSean Bruno.Pq Vt "uint8_t" 18134bac11eSSean BrunoThe length of any padding contained by the received data. 18234bac11eSSean Bruno.It Va iri_qidx 18334bac11eSSean Bruno.Pq Vt "uint8_t" 184fa504546SEnji CooperRepresents the type of queue event. 185fa504546SEnji CooperIf value >= 0 then it is the freelist id otherwise it is a completion queue 186fa504546SEnji Cooperevent. 18734bac11eSSean Bruno.El 18834bac11eSSean Bruno.Sh FUNCTIONS 189fa504546SEnji CooperAll function calls are associated exclusively with either packet transmission 190fa504546SEnji Cooperor receipt. 1916b35d82cSEitan AdlerThe void *sc passed as the first argument to all of the following functions 192fa504546SEnji Cooperrepresents the driver's softc. 19334bac11eSSean Bruno.Ss Transmit Packet Functions 19434bac11eSSean Bruno.Bl -ohang -offset indent 19534bac11eSSean Bruno.It Fn isc_txd_encap 196fa504546SEnji CooperTransmit function that sends a packet on an interface. 197fa504546SEnji CooperThe if_pkt_info data structure contains data information fields describing the 198fa504546SEnji Cooperpacket. 199fa504546SEnji CooperThis function returns 0 if successful, otherwise an error value is returned. 20034bac11eSSean Bruno.It Fn isc_txd_flush 201fa504546SEnji CooperFlush function is called immediately after the isc_txd_encap function transmits 202fa504546SEnji Coopera packet. 203fa504546SEnji CooperIt updates the hardware producer index or increments the descriptors used to 204fa504546SEnji Cooperpidx_or_credits in the queue designated by the qid number. 205fa504546SEnji CooperThis is often referred to as poking the doorbell register. 20634bac11eSSean Bruno.It Fn isc_txd_credits_update 207fa504546SEnji CooperCredit function advances the buffer ring and calculates the credits 208fa504546SEnji Cooper(descriptors) processed. 209fa504546SEnji CooperUntil the I/O is complete it cleans the range in case of multisegments and 210fa504546SEnji Cooperupdates the count of processed packets. 211fa504546SEnji CooperThe function returns the number of processed credits. 21234bac11eSSean Bruno.El 21334bac11eSSean Bruno.Ss Receive Packet Functions 21434bac11eSSean Bruno.Bl -ohang -offset indent 21534bac11eSSean Bruno.It Fn isc_rxd_available 216fa504546SEnji CooperFunction calculates the remaining number of descriptors from a position given 217fa504546SEnji Cooperby idx. 218fa504546SEnji CooperThe function returns this value. 21934bac11eSSean Bruno.It Fn isc_rxd_refill 220fa504546SEnji CooperStarting with the physical address paddrs, the function reads a packet into the 221fa504546SEnji Cooperrx_ring until a value designated by count is reached. 222fa504546SEnji Coopervaddrs is typically not needed and is provided for devices that place their own 223fa504546SEnji Coopermetadata in the packet header. 22434bac11eSSean Bruno.It Fn isc_rxd_flush 225fa504546SEnji CooperFlush function updates the producer pointer on the free list flid in queue set 226fa504546SEnji Coopernumber qid to pidx to reflect the presence of new buffers. 22734bac11eSSean Bruno.It Fn isc_rxd_pkt_get 228fa504546SEnji CooperProcess a single software descriptor. 229fa504546SEnji Cooperrxr->rx_base[i] contains a descriptor that describes a received packet. 230fa504546SEnji CooperHardware specific information about the buffer referred to by ri is returned in 231fa504546SEnji Cooperthe data structure if_rxd_info 23234bac11eSSean Bruno.El 233fa504546SEnji Cooper.Sh SEE ALSO 234fa504546SEnji Cooper.Xr iflibdd 9 , 235fa504546SEnji Cooper.Xr iflibdi 9 , 236fa504546SEnji Cooper.Xr mbuf 9 23734bac11eSSean Bruno.Sh AUTHORS 23834bac11eSSean BrunoThis manual page was written by 23934bac11eSSean Bruno.An Nicole Graziano 240