func (pid Port) TxBuffer(qid uint16, buf *TxBuffer, m *mbuf.Mbuf) uint16 {
	return uint16(C.rte_eth_tx_buffer(C.uint16_t(pid), C.uint16_t(qid),
		(*C.struct_rte_eth_dev_tx_buffer)(unsafe.Pointer(buf)),
		(*C.struct_rte_mbuf)(unsafe.Pointer(m))))
}
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
package ethdev
import "C"
import (
	"reflect"
	"unsafe"
	"github.com/yerden/go-dpdk/mbuf"
)
type TxBuffer C.struct_rte_eth_dev_tx_buffer
func fracCeilRound(x int, y int) int {
	n := x / y
	if y*n != x {
		n++
	}
	return n
}
func NewTxBuffer(cnt int) *TxBuffer {
	amount := TxBufferSize(cnt)
	ptrSize := unsafe.Sizeof(&mbuf.Mbuf{})
	data := make([]*mbuf.Mbuf, fracCeilRound(int(amount), int(ptrSize)))
	buf := (*TxBuffer)(unsafe.Pointer(&data[0]))
	buf.Init(cnt)
	return buf
}
func TxBufferSize(mbufCnt int) uintptr {
	return unsafe.Sizeof(TxBuffer{}) + uintptr(mbufCnt)*unsafe.Sizeof(&mbuf.Mbuf{})
}
func (pid Port) RxBurst(qid uint16, pkts []*mbuf.Mbuf) uint16 {
	return uint16(C.rte_eth_rx_burst(C.uint16_t(pid), C.uint16_t(qid),
		(**C.struct_rte_mbuf)(unsafe.Pointer(&pkts[0])), C.uint16_t(len(pkts))))
}
func (pid Port) TxBurst(qid uint16, pkts []*mbuf.Mbuf) uint16 {
	return uint16(C.rte_eth_tx_burst(C.uint16_t(pid), C.uint16_t(qid),
		(**C.struct_rte_mbuf)(unsafe.Pointer(&pkts[0])), C.uint16_t(len(pkts))))
}
func (pid Port) TxBufferFlush(qid uint16, buf *TxBuffer) uint16 {
	return uint16(C.rte_eth_tx_buffer_flush(C.uint16_t(pid), C.uint16_t(qid),
		(*C.struct_rte_eth_dev_tx_buffer)(unsafe.Pointer(buf))))
}