Documentation
¶
Overview ¶
Package ethdev wraps RTE Ethernet Device API.
Please refer to DPDK Programmer's Guide for reference and caveats.
Index ¶
- Constants
- func CountAvail() int
- func CountTotal() int
- func RegisterTelemetryLSC(name string)
- func TxBufferSize(mbufCnt int) uintptr
- type DevFlags
- type DevInfo
- func (info *DevInfo) DevFlags() DevFlags
- func (info *DevInfo) DriverName() string
- func (info *DevInfo) InterfaceName() string
- func (info *DevInfo) MaxMTU() uint16
- func (info *DevInfo) MaxRxPktLen() uint32
- func (info *DevInfo) MaxRxQueues() uint16
- func (info *DevInfo) MaxTxQueues() uint16
- func (info *DevInfo) MinMTU() uint16
- func (info *DevInfo) MinRxBufSize() uint32
- func (info *DevInfo) NbRxQueues() uint16
- func (info *DevInfo) NbTxQueues() uint16
- func (info *DevInfo) RetaSize() uint16
- type EthLink
- type FcConf
- type GoStats
- type IntrConf
- type MACAddr
- type Option
- type Port
- func (pid Port) Close()
- func (pid Port) DevConfigure(nrxq, ntxq uint16, opts ...Option) error
- func (pid Port) EthLinkGet() (EthLink, error)
- func (pid Port) EthLinkGetNowait() (EthLink, error)
- func (pid Port) FlowCtrlGet(conf *FcConf) error
- func (pid Port) FlowCtrlSet(conf *FcConf) error
- func (pid Port) GetMTU() (uint16, error)
- func (pid Port) InfoGet(info *DevInfo) error
- func (pid Port) IsValid() bool
- func (pid Port) MACAddrGet(addr *MACAddr) error
- func (pid Port) Name() (string, error)
- func (pid Port) PromiscDisable() error
- func (pid Port) PromiscEnable() error
- func (p Port) RegisterCallbackLSC() error
- func (pid Port) Reset() error
- func (pid Port) RssHashConfGet(conf *RssConf) error
- func (pid Port) RssHashUpdate(conf *RssConf) error
- func (pid Port) RssRetaQuery(conf []RssRetaEntry64, retaSize uint16) error
- func (pid Port) RssRetaUpdate(conf []RssRetaEntry64, retaSize uint16) error
- func (pid Port) RxBurst(qid uint16, pkts []*mbuf.Mbuf) uint16
- func (pid Port) RxqSetup(qid, nDesc uint16, mp *mempool.Mempool, opts ...QueueOption) error
- func (pid Port) SetLinkDown() error
- func (pid Port) SetLinkUp() error
- func (pid Port) SetMTU(mtu uint16) error
- func (pid Port) SocketID() int
- func (pid Port) Start() error
- func (pid Port) StatsGet(stats *Stats) error
- func (pid Port) StatsReset() error
- func (pid Port) Stop()
- func (pid Port) TxBuffer(qid uint16, buf *TxBuffer, m *mbuf.Mbuf) uint16
- func (pid Port) TxBufferFlush(qid uint16, buf *TxBuffer) uint16
- func (pid Port) TxBurst(qid uint16, pkts []*mbuf.Mbuf) uint16
- func (pid Port) TxqSetup(qid, nDesc uint16, opts ...QueueOption) error
- func (p Port) UnregisterCallbackLSC() error
- func (pid Port) XstatGetByID(ids, values []uint64) (int, error)
- func (pid Port) XstatNameIDs() (map[uint64]string, error)
- func (pid Port) XstatNames() ([]XstatName, error)
- func (pid Port) XstatsGet(out []Xstat) (int, error)
- func (pid Port) XstatsReset() error
- type QueueOption
- type RssConf
- type RssRetaEntry64
- type RxMode
- type RxqConf
- type Stats
- type Thresh
- type TxBuffer
- type TxMode
- type TxqConf
- type Xstat
- type XstatName
Constants ¶
const ( // Disable flow control. FcNone uint32 = C.RTE_ETH_FC_NONE // RX pause frame, enable flowctrl on TX side. FcRxPause uint32 = C.RTE_ETH_FC_RX_PAUSE // TX pause frame, enable flowctrl on RX side. FcTxPause uint32 = C.RTE_ETH_FC_TX_PAUSE // Enable flow control on both side. FcFull uint32 = C.RTE_ETH_FC_FULL )
This enum indicates the flow control mode.
Variables ¶
This section is empty.
Functions ¶
func CountAvail ¶
func CountAvail() int
CountAvail gets the number of ports which are usable for the application.
These devices must be iterated by using the macro RTE_ETH_FOREACH_DEV or RTE_ETH_FOREACH_DEV_OWNED_BY to deal with non-contiguous ranges of devices.
func CountTotal ¶
func CountTotal() int
CountTotal gets the total number of ports which are allocated.
Some devices may not be available for the application.
func RegisterTelemetryLSC ¶
func RegisterTelemetryLSC(name string)
RegisterTelemetryLSC registers telemetry handlers for accessing LSC counters.
func TxBufferSize ¶
TxBufferSize is the occupied memory for TxBuffer of length mbufCnt.
Types ¶
type DevFlags ¶
type DevFlags uint32
DevFlags represent the value of dev_flags member of rte_eth_dev_info struct.
type DevInfo ¶
type DevInfo C.struct_rte_eth_dev_info
DevInfo is a structure used to retrieve the contextual information of an Ethernet device, such as the controlling driver of the device, etc...
func (*DevInfo) DriverName ¶
DriverName returns driver_name as a Go string.
func (*DevInfo) InterfaceName ¶
InterfaceName is the name of the interface in the system.
func (*DevInfo) MaxRxPktLen ¶
MaxRxPktLen returns maximum configurable length of Rx pkt.
func (*DevInfo) MaxRxQueues ¶
MaxRxQueues returns maximum number of Rx queues.
func (*DevInfo) MaxTxQueues ¶
MaxTxQueues returns maximum number of Tx queues.
func (*DevInfo) MinRxBufSize ¶
MinRxBufSize returns minimum Rx buffer size per descriptor supported by HW.
func (*DevInfo) NbRxQueues ¶
NbRxQueues returns number of configured RX queues for the device.
func (*DevInfo) NbTxQueues ¶
NbTxQueues returns number of configured TX queues for the device.
type EthLink ¶
type EthLink C.struct_go_rte_eth_link
EthLink is a structure used to retrieve link-level information of an Ethernet port.
type FcConf ¶
type FcConf C.struct_rte_eth_fc_conf
FcConf is a structure used to configure Ethernet flow control parameter. These parameters will be configured into the register of the NIC. Please refer to the corresponding data sheet for proper value.
type GoStats ¶
type GoStats struct {
Ipackets uint64 `metric:"ipackets" type:"counter"`
Opackets uint64 `metric:"opackets" type:"counter"`
Ibytes uint64 `metric:"ibytes" type:"counter"`
Obytes uint64 `metric:"obytes" type:"counter"`
Imissed uint64 `metric:"imissed" type:"counter"`
Ierrors uint64 `metric:"ierrors" type:"counter"`
Oerrors uint64 `metric:"oerrors" type:"counter"`
RxNoMbuf uint64 `metric:"rxnombuf" type:"counter"`
}
GoStats contains counters from rte_eth_stats.
type IntrConf ¶
type IntrConf struct {
LSC, RXQ, RMV bool
}
IntrConf is used to enable/disable interrupts.
type MACAddr ¶
type MACAddr C.struct_rte_ether_addr
MACAddr is a universally administered address is uniquely assigned to a device by its manufacturer. The first three octets (in transmission order) contain the Organizationally Unique Identifier (OUI). The following three (MAC-48 and EUI-48) octets are assigned by that organization with the only constraint of uniqueness. A locally administered address is assigned to a device by a network administrator and does not contain OUIs.
func (*MACAddr) HardwareAddr ¶
func (addr *MACAddr) HardwareAddr() net.HardwareAddr
HardwareAddr converts MACAddr into Go's native net.HardwareAddr.
type Option ¶
type Option struct {
// contains filtered or unexported fields
}
Option represents device option which is then used by DevConfigure to setup Ethernet device.
func OptIntrConf ¶
OptIntrConf is used to specify interrupt configuration.
func OptLinkSpeeds ¶
OptLinkSpeeds sets allowed speeds for the device. LinkSpeedFixed disables link autonegotiation, and a unique speed shall be set. Otherwise, the bitmap defines the set of speeds to be advertised. If the special value LinkSpeedAutoneg is used, all speeds supported are advertised.
func OptLoopbackMode ¶
OptLoopbackMode specifies loopback operation mode. By default the value is 0, meaning the loopback mode is disabled. Read the datasheet of given ethernet controller for details. The possible values of this field are defined in implementation of each driver.
type Port ¶
type Port uint16
Port is the number of the Ethernet device.
func GetPortByName ¶
GetPortByName gets the port ID from device name. The device name should be specified as below:
- PCIe address (Domain:Bus:Device.Function), for example- 0000:02:00.0
- SoC device name, for example- fsl-gmac0
- vdev dpdk name, for example- net_[pcap0|null0|tun0|tap0]
(0) if successful. (-ENODEV or -EINVAL) in case of failure.
func (Port) Close ¶
func (pid Port) Close()
Close a stopped Ethernet device. The device cannot be restarted! The function frees all port resources if the driver supports the flag RTE_ETH_DEV_CLOSE_REMOVE.
func (Port) DevConfigure ¶
DevConfigure configures an Ethernet device. This function must be invoked first before any other function in the Ethernet API. This function can also be re-invoked when a device is in the stopped state.
nrxq and ntxq are the numbers of receive and transmit queues to set up for the Ethernet device, respectively.
Several Opt* options may be specified as well.
func (Port) EthLinkGet ¶
EthLinkGet retrieves the link status (up/down), the duplex mode (half/full), the negotiation (auto/fixed), and if available, the speed (Mbps).
It might need to wait up to 9 seconds.
Returns:
(0) if successful. (-ENOTSUP) if the function is not supported in PMD driver. (-ENODEV) if port_id invalid. (-EINVAL) if bad parameter.
func (Port) EthLinkGetNowait ¶
EthLinkGetNowait retrieves the link status (up/down), the duplex mode (half/full), the negotiation (auto/fixed), and if available, the speed (Mbps).
Returns:
(0) if successful. (-ENOTSUP) if the function is not supported in PMD driver. (-ENODEV) if port_id invalid. (-EINVAL) if bad parameter.
func (Port) FlowCtrlGet ¶
FlowCtrlGet gets current status of the Ethernet link flow control for Ethernet device.
func (Port) FlowCtrlSet ¶
FlowCtrlSet configures the Ethernet link flow control for Ethernet device.
func (Port) InfoGet ¶
InfoGet retrieves the contextual information of an Ethernet device.
As part of this function, a number of of fields in dev_info will be initialized as follows:
rx_desc_lim = lim tx_desc_lim = lim
Where lim is defined within the rte_eth_dev_info_get as
const struct rte_eth_desc_lim lim = { .nb_max = UINT16_MAX, .nb_min
= 0, .nb_align = 1, .nb_seg_max = UINT16_MAX, .nb_mtu_seg_max =
UINT16_MAX, };
device = dev->device min_mtu = RTE_ETHER_MIN_MTU max_mtu =
UINT16_MAX
The following fields will be populated if support for dev_infos_get() exists for the device and the rte_eth_dev 'dev' has been populated successfully with a call to it:
driver_name = dev->device->driver->name nb_rx_queues = dev->data->nb_rx_queues nb_tx_queues = dev->data->nb_tx_queues dev_flags = &dev->data->dev_flags
func (Port) MACAddrGet ¶
MACAddrGet retrieves the Ethernet address of an Ethernet device.
func (Port) Name ¶
Name get the device name from port id. The device name is specified as below:
- PCIe address (Domain:Bus:Device.Function), for example- 0000:02:00.0
- SoC device name, for example- fsl-gmac0
- vdev dpdk name, for example- net_[pcap0|null0|tun0|tap0]
(0) if successful. (-ENODEV) if port_id is invalid. (-EINVAL) on failure.
func (Port) PromiscDisable ¶
PromiscDisable disables receipt in promiscuous mode for an Ethernet device.
func (Port) PromiscEnable ¶
PromiscEnable enables receipt in promiscuous mode for an Ethernet device.
func (Port) RegisterCallbackLSC ¶
RegisterCallbackLSC installs a callback for RTE_ETH_EVENT_INTR_LSC event which counts all occurred events.
func (Port) Reset ¶
Reset a Ethernet device and keep its port id.
When a port has to be reset passively, the DPDK application can invoke this function. For example when a PF is reset, all its VFs should also be reset. Normally a DPDK application can invoke this function when RTE_ETH_EVENT_INTR_RESET event is detected, but can also use it to start a port reset in other circumstances.
When this function is called, it first stops the port and then calls the PMD specific dev_uninit( ) and dev_init( ) to return the port to initial state, in which no Tx and Rx queues are setup, as if the port has been reset and not started. The port keeps the port id it had before the function call.
After calling rte_eth_dev_reset( ), the application should use rte_eth_dev_configure( ), rte_eth_rx_queue_setup( ), rte_eth_tx_queue_setup( ), and rte_eth_dev_start( ) to reconfigure the device as appropriate.
Note: To avoid unexpected behavior, the application should stop calling Tx and Rx functions before calling rte_eth_dev_reset( ). For thread safety, all these controlling functions should be called from the same thread.
Return codes:
(0) if successful.
(-EINVAL) if port identifier is invalid.
(-ENOTSUP) if hardware doesn't support this function.
(-EPERM) if not ran from the primary process.
(-EIO) if re-initialisation failed or device is removed.
(-ENOMEM) if the reset failed due to OOM.
(-EAGAIN) if the reset temporarily failed and should be retried later.
func (Port) RssHashConfGet ¶
RssHashConfGet retrieves current configuration of Receive Side Scaling hash computation of Ethernet device.
func (Port) RssHashUpdate ¶
RssHashUpdate updates configuration of Receive Side Scaling hash computation of Ethernet device.
func (Port) RssRetaQuery ¶
func (pid Port) RssRetaQuery(conf []RssRetaEntry64, retaSize uint16) error
RssRetaQuery queries Redirection Table(RETA) of Receive Side Scaling of Ethernet device.
conf is a RETA to query. For each requested reta entry, corresponding bit in mask must be set. retaSize is a redirection table size. The table size can be queried by rte_eth_dev_info_get().
Returns:
(0) if successful. (-ENODEV) if port_id is invalid. (-ENOTSUP) if hardware doesn't support. (-EINVAL) if bad parameter. (-EIO) if device is removed.
func (Port) RssRetaUpdate ¶
func (pid Port) RssRetaUpdate(conf []RssRetaEntry64, retaSize uint16) error
RssRetaUpdate updates Redirection Table(RETA) of Receive Side Scaling of Ethernet device.
conf is a RETA to update. retaSize is redirection table size. The table size can be queried by rte_eth_dev_info_get().
Returns:
(0) if successful. (-ENODEV) if port_id is invalid. (-ENOTSUP) if hardware doesn't support. (-EINVAL) if bad parameter. (-EIO) if device is removed.
func (Port) RxBurst ¶
RxBurst receives packets for port pid and queue qid. Returns number of packets retrieved into pkts.
func (Port) RxqSetup ¶
RxqSetup allocates and sets up a receive queue for an Ethernet device.
The function allocates a contiguous block of memory for nDesc receive descriptors from a memory zone associated with *socket_id* and initializes each receive descriptor with a network buffer allocated from the memory pool *mb_pool*.
qid is the index of the receive queue to set up. The value must be in the range [0, nb_rx_queue - 1] previously supplied to rte_eth_dev_configure().
nDesc is the number of receive descriptors to allocate for the receive ring.
mp is the pointer to the memory pool from which to allocate *rte_mbuf* network memory buffers to populate each descriptor of the receive ring.
opts specifies the configuration data to be used for the receive queue. The *rx_conf* structure contains an *rx_thresh* structure with the values of the Prefetch, Host, and Write-Back threshold registers of the receive ring. In addition it contains the hardware offloads features to activate using the DEV_RX_OFFLOAD_* flags. If an offloading set in rx_conf->offloads hasn't been set in the input argument eth_conf->rxmode.offloads to rte_eth_dev_configure(), it is a new added offloading, it must be per-queue type and it is enabled for the queue. No need to repeat any bit in rx_conf->offloads which has already been enabled in rte_eth_dev_configure() at port level. An offloading enabled at port level can't be disabled at queue level.
Return codes:
- 0: Success, receive queue correctly set up.
- -EIO: if device is removed.
-EINVAL: The memory pool pointer is null or the size of network buffers which can be allocated from this memory pool does not fit the various buffer sizes allowed by the device controller.
-ENOMEM: Unable to allocate the receive ring descriptors or to allocate network memory buffers from the memory pool when initializing receive descriptors.
func (Port) SetLinkDown ¶
SetLinkDown set link status to 'down' an Ethernet device. The device rx/tx functionality will be disabled if success, and it can be re-enabled with a call to rte_eth_dev_set_link_up().
Return codes:
0: Success, Ethernet device linked down.
<0: Error code of the driver device link down function.
func (Port) SetLinkUp ¶
SetLinkUp set link status to 'up' an Ethernet device.
Set device link up will re-enable the device rx/tx functionality after it is previously set device linked down.
Return codes:
0: Success, Ethernet device linked up.
<0: Error code of the driver device link up function.
func (Port) SocketID ¶
SocketID returns the NUMA socket to which an Ethernet device is connected. The function may return a default of zero if the socket could not be determined. -1 is returned if the port_id value is out of range.
func (Port) Start ¶
Start an Ethernet device.
The device start step is the last one and consists of setting the configured offload features and in starting the transmit and the receive units of the device.
Device RTE_ETH_DEV_NOLIVE_MAC_ADDR flag causes MAC address to be set before PMD port start callback function is invoked.
On success, all basic functions exported by the Ethernet API (link status, receive/transmit, and so on) can be invoked.
Return codes:
- 0: Success, Ethernet device started.
- <0: Error code of the driver device start function.
func (Port) Stop ¶
func (pid Port) Stop()
Stop an Ethernet device. The device can be restarted with a call to rte_eth_dev_start().
func (Port) TxBuffer ¶
TxBuffer buffers a single packet for future transmission on a port and queue.
This function takes a single mbuf/packet and buffers it for later transmission on the particular port and queue specified. Once the buffer is full of packets, an attempt will be made to transmit all the buffered packets. In case of error, where not all packets can be transmitted, a callback is called with the unsent packets as a parameter. If no callback is explicitly set up, the unsent packets are just freed back to the owning mempool. The function returns the number of packets actually sent i.e. 0 if no buffer flush occurred, otherwise the number of packets successfully flushed
func (Port) TxBufferFlush ¶
TxBufferFlush Send any packets queued up for transmission on a port and HW queue.
This causes an explicit flush of packets previously buffered via the rte_eth_tx_buffer() function. It returns the number of packets successfully sent to the NIC, and calls the error callback for any unsent packets. Unless explicitly set up otherwise, the default callback simply frees the unsent packets back to the owning mempool.
func (Port) TxBurst ¶
TxBurst sends packets over port pid and queue qid. Returns number of packets sent from pkts.
func (Port) TxqSetup ¶
func (pid Port) TxqSetup(qid, nDesc uint16, opts ...QueueOption) error
TxqSetup allocates and set up a transmit queue for an Ethernet device.
qid is the index of the transmit queue to set up. The value must be in the range [0, nb_tx_queue - 1] previously supplied to rte_eth_dev_configure().
nDesc is the number of transmit descriptors to allocate for the transmit ring.
OptSocket specifies the socket identifier in case of NUMA. Its value can be *SOCKET_ID_ANY* if there is no NUMA constraint for the DMA memory allocated for the transmit descriptors of the ring.
OptTxqConf specifies configuration data to be used for the transmit queue. NULL value is allowed, in which case default TX configuration will be used.
The *tx_conf* structure contains the following data:
- The *tx_thresh* structure with the values of the Prefetch, Host, and Write-Back threshold registers of the transmit ring. When setting Write-Back threshold to the value greater then zero, *tx_rs_thresh* value should be explicitly set to one.
- The *tx_free_thresh* value indicates the [minimum] number of network buffers that must be pending in the transmit ring to trigger their [implicit] freeing by the driver transmit function.
- The *tx_rs_thresh* value indicates the [minimum] number of transmit descriptors that must be pending in the transmit ring before setting the RS bit on a descriptor by the driver transmit function. The *tx_rs_thresh* value should be less or equal then *tx_free_thresh* value, and both of them should be less then *nb_tx_desc* - 3.
- The *offloads* member contains Tx offloads to be enabled. If an offloading set in tx_conf->offloads hasn't been set in the input argument eth_conf->txmode.offloads to rte_eth_dev_configure(), it is a new added offloading, it must be per-queue type and it is enabled for the queue. No need to repeat any bit in tx_conf->offloads which has already been enabled in rte_eth_dev_configure() at port level. An offloading enabled at port level can't be disabled at queue level.
Note that setting *tx_free_thresh* or *tx_rs_thresh* value to 0 forces the transmit function to use default values. Return codes:
- 0: Success, the transmit queue is correctly set up.
- -ENOMEM: Unable to allocate the transmit ring descriptors.
func (Port) UnregisterCallbackLSC ¶
UnregisterCallbackLSC removes callback for RTE_ETH_EVENT_INTR_LSC event which counts all occurred events.
func (Port) XstatGetByID ¶
XstatGetByID retrieves extended statistics of an Ethernet device.
ids is the IDs array given by app to retrieve specific statistics. May be nil to retrieve all available statistics or, if values is nil as well, just the number of available statistics.
values is the array to be filled in with requested device statistics. Must not be nil if ids are specified (not nil).
Returns:
A positive value lower or equal to len(values): success. The return value is the number of entries filled in the stats table.
A positive value higher than len(values): success: The given statistics table is too small. The return value corresponds to the size that should be given to succeed. The entries in the table are not valid and shall not be used by the caller.
Otherwise, error is returned.
func (Port) XstatNameIDs ¶
XstatNameIDs returns names of extended statistics mapped by their ID and an error. This is supposed to be called to cache counter ids and not used in hot path.
func (Port) XstatNames ¶
XstatNames returns list of names for custom eth dev stats.
type QueueOption ¶
type QueueOption struct {
// contains filtered or unexported fields
}
QueueOption represents an option which is used to setup RX/TX queue on Ethernet device.
func OptRxqConf ¶
func OptRxqConf(conf RxqConf) QueueOption
OptRxqConf specifies the configuration an RX ring of an Ethernet port.
func OptSocket ¶
func OptSocket(socket int) QueueOption
OptSocket specifies the NUMA socket id for RX/TX queue. The socket argument is the socket identifier in case of NUMA. The value can be SOCKET_ID_ANY if there is no NUMA constraint for the DMA memory allocated for the receive/transmit descriptors of the ring.
func OptTxqConf ¶
func OptTxqConf(conf TxqConf) QueueOption
OptTxqConf specifies the configuration an TX ring of an Ethernet port.
type RssConf ¶
type RssConf struct {
/**< If not NULL, 40-byte hash key. */
Key []byte
/**< Hash functions to apply. */
Hf uint64
}
RssConf is a structure used to configure the Receive Side Scaling (RSS) feature of an Ethernet port. If not nil, the Key points to an array holding the RSS key to use for hashing specific header fields of received packets. Otherwise, a default random hash key is used by the device driver.
To maintain compatibility the Key should be 40 bytes long. To be compatible, this length will be checked in i40e only. Others assume 40 bytes to be used as before.
The Hf field indicates the different types of IPv4/IPv6 packets to which the RSS hashing must be applied. Supplying an *rss_hf* equal to zero disables the RSS feature.
type RssRetaEntry64 ¶
type RssRetaEntry64 C.struct_rte_eth_rss_reta_entry64
RssRetaEntry64 is a structure used to configure 64 entries of Redirection Table of the Receive Side Scaling (RSS) feature of an Ethernet port. To configure more than 64 entries supported by hardware, an array of this structure is needed.
func (*RssRetaEntry64) Mask ¶
func (conf *RssRetaEntry64) Mask() *uint64
Mask returns bits indicating which entries need to be updated/queried.
func (*RssRetaEntry64) Reta ¶
func (conf *RssRetaEntry64) Reta() (reta []uint16)
Reta returns group of 64 redirection table entries. You may set elements of returned slice but no appends are allowed.
type RxMode ¶
type RxMode struct {
// The multi-queue packet distribution mode to be used, e.g. RSS.
// See MqRx* constants.
MqMode uint
// Requested MTU or MaxRxPktLen if JUMBO_FRAME enabled (for releases older than 21.11).
MTU uint32
// hdr buf size (header_split enabled).
SplitHdrSize uint16
// Per-port Rx offloads to be set using RxOffload* flags. Only
// offloads set on rx_offload_capa field on rte_eth_dev_info
// structure are allowed to be set.
Offloads uint64
}
RxMode is used to configure Ethernet device through OptRxMode option.
type RxqConf ¶
type RxqConf struct {
Thresh
// Drives the freeing of RX descriptors.
FreeThresh uint16
// Drop packets if no descriptors are available.
DropEn uint8
// Do not start queue with rte_eth_dev_start().
DeferredStart uint8
// Per-queue Rx offloads to be set using RxOffload* flags.
// Only offloads set on rx_queue_offload_capa or rx_offload_capa
// fields on rte_eth_dev_info structure are allowed to be set.
Offloads uint64
}
RxqConf is a s tructure used to configure an RX ring of an Ethernet port.
type Thresh ¶
type Thresh struct {
// Ring prefetch threshold.
PThresh uint8
// Ring host threshold.
HThresh uint8
// Ring writeback threshold.
WThresh uint8
}
Thresh is a structure used to configure the ring threshold registers of an RX/TX queue for an Ethernet port.
type TxBuffer ¶
type TxBuffer C.struct_rte_eth_dev_tx_buffer
TxBuffer is a structure used to buffer packets for future TX Used by APIs rte_eth_tx_buffer and rte_eth_tx_buffer_flush.
func NewTxBuffer ¶
NewTxBuffer creates new TxBuffer with cnt mbufs.
type TxMode ¶
type TxMode struct {
// TX multi-queues mode.
MqMode uint
// Per-port Tx offloads to be set using DevTxOffload*
// flags. Only offloads set on tx_offload_capa field on
// rte_eth_dev_info structure are allowed to be set.
Offloads uint64
// For i40e specifically.
Pvid uint16
// If set, reject sending out tagged pkts.
HwVlanRejectTagged bool
// If set, reject sending out untagged pkts
HwVlanRejectUntagged bool
// If set, enable port based VLAN insertion
HwVlanInsertPvid bool
}
TxMode is used to configure Ethernet device through OptTxMode option.
type TxqConf ¶
type TxqConf struct {
Thresh
// Drives the setting of RS bit on TXDs.
RsThresh uint16
// Start freeing TX buffers if there are less free descriptors
// than this value.
FreeThresh uint16
// Do not start queue with rte_eth_dev_start().
DeferredStart uint8
// Per-queue Tx offloads to be set using DevTxOffload* flags. Only
// offloads set on tx_queue_offload_capa or tx_offload_capa fields
// on rte_eth_dev_info structure are allowed to be set.
Offloads uint64
}
TxqConf is a structure used to configure a TX ring of an Ethernet port.
type Xstat ¶
type Xstat struct {
// Index of an element in XstatsNames array.
Index uint64
// Value of stats.
Value uint64
}
Xstat reflect C rte_eth_xstats struct.
func XstatDiff ¶
XstatDiff computes delta from incoming stats array (incoming) and old stats array (old) with the result placed in delta.
If old contains zero-value Xstat the resulting delta is zero to filter out outliers.
If old doesn't contain Xstat contained in incoming new Xstat is appended to old.
If delta doesn't contain new Xstat it is appended.
The resulting "old" (now updated) and delta are returned.