func (tx *Tx) Tx(pkt *mbuf.Mbuf) int {
	return int(C.go_wr_tx((*C.struct_tx_port)(tx),
		(*C.struct_rte_mbuf)(unsafe.Pointer(pkt))))
}
Tx submits given packet via port instance.
package port
import "C"
import (
	"errors"
	"unsafe"
	"github.com/yerden/go-dpdk/common"
	"github.com/yerden/go-dpdk/mbuf"
)
var (
	ErrPortCreate = errors.New("port not created")
)
type Rx C.struct_rx_port
type Tx C.struct_tx_port
type RxFactory interface {
	CreateRx(socket int) (*Rx, error)
}
type TxFactory interface {
	CreateTx(socket int) (*Tx, error)
}
func err(n ...interface{}) error {
	if len(n) == 0 {
		return common.RteErrno()
	}
	return common.IntToErr(n[0])
}
func (rx *Rx) doCreate(socket int, arg unsafe.Pointer) error {
	rx.port = C.go_rd_create(rx.ops, arg, C.int(socket))
	if rx.port == nil {
		return ErrPortCreate
	}
	return nil
}
func (rx *Rx) Rx(pkts []*mbuf.Mbuf) int {
	return int(C.go_rd_rx((*C.struct_rx_port)(rx),
		(**C.struct_rte_mbuf)(unsafe.Pointer(&pkts[0])), C.uint32_t(len(pkts))))
}
func (rx *Rx) Free() error {
	return err(C.go_rd_free((*C.struct_rx_port)(rx)))
}
func (tx *Tx) doCreate(socket int, arg unsafe.Pointer) error {
	tx.port = C.go_wr_create(tx.ops, arg, C.int(socket))
	if tx.port == nil {
		return ErrPortCreate
	}
	return nil
}