[dpdk-dev] [vmxnet3-usermap PATCH v2 16/17] pmd: adapt to new rte_mbuf structure
Olivier Matz
olivier.matz at 6wind.com
Mon May 19 15:56:28 CEST 2014
The rte_mbuf structure is modified by the following commits in dpdk:
mbuf: rename vlan_macip_len in hw_offload and increase its size
mbuf: change ol_flags to 32 bits
mbuf: replace data pointer by an offset
mbuf: merge physaddr and buf_len in a bitfield
mbuf: remove the rte_pktmbuf structure
mbuf: remove rte_ctrlmbuf
We need to modify to conform to this new struct.
Signed-off-by: Olivier Matz <olivier.matz at 6wind.com>
---
pmd/vmxnet3.c | 51 ++++++++++++++++++++++++---------------------------
1 file changed, 24 insertions(+), 27 deletions(-)
diff --git a/pmd/vmxnet3.c b/pmd/vmxnet3.c
index 3f3f715..69bc4d5 100644
--- a/pmd/vmxnet3.c
+++ b/pmd/vmxnet3.c
@@ -54,7 +54,7 @@
typedef void rte_txq_t;
typedef void rte_rxq_t;
-#define RTE_MBUF_VLAN_MAC_IP(m) (m)->pkt.vlan_macip.f.vlan_tci
+#define RTE_MBUF_VLAN_MAC_IP(m) (m)->hw_offload.vlan_tci
#define VMXNET3_MAX_MAC_ADDRS 1
@@ -73,14 +73,12 @@ rte_rxmbuf_alloc(struct rte_mempool *mp)
{
struct rte_mbuf *m;
m = __rte_mbuf_raw_alloc(mp);
- __rte_mbuf_sanity_check(m, RTE_MBUF_PKT, 0);
+ __rte_mbuf_sanity_check(m, 0);
return m;
}
#define RTE_MBUF_DATA_DMA_ADDR(mb) \
- (uint64_t) ((mb)->buf_physaddr + \
- (uint64_t) ((char *)((mb)->pkt.data) - \
- (char *)(mb)->buf_addr))
+ (uint64_t) ((mb)->buf_physaddr + (mb)->data_off)
#ifndef min
#define min(x, y) ((x)<(y) ? (x) : (y))
@@ -314,16 +312,15 @@ queue_rx_complete(struct vmxnet3_rx_queue *rq,
/* Buffer information */
if ((*binfo & 0x01) == VMXNET3_RXD_BTYPE_HEAD) {
- buf->pkt.data = ((char *)buf->buf_addr +
- RTE_PKTMBUF_HEADROOM);
+ buf->data_off = RTE_PKTMBUF_HEADROOM;
} else {
- buf->pkt.data = (char *)buf->buf_addr;
+ buf->data_off = 0;
}
- buf->pkt.nb_segs = 1;
- buf->pkt.next = NULL;
- buf->pkt.pkt_len = rcd->len;
- buf->pkt.data_len = rcd->len;
- buf->pkt.in_port = rq->port_id;
+ buf->nb_segs = 1;
+ buf->next = NULL;
+ buf->pkt_len = rcd->len;
+ buf->data_len = rcd->len;
+ buf->in_port = rq->port_id;
buf->ol_flags = 0; // RSS - FDIR // Error
RTE_MBUF_VLAN_MAC_IP(buf) = 0;
@@ -344,11 +341,11 @@ queue_rx_complete(struct vmxnet3_rx_queue *rq,
head = tail = buf;
prev_tail = NULL;
} else {
- tail->pkt.next = buf;
+ tail->next = buf;
prev_tail = tail;
tail = buf;
- ++head->pkt.nb_segs;
- head->pkt.pkt_len += rcd->len;
+ ++head->nb_segs;
+ head->pkt_len += rcd->len;
}
assert(head != NULL);
@@ -381,8 +378,8 @@ queue_rx_complete(struct vmxnet3_rx_queue *rq,
assert(head != tail);
if (unlikely(rcd->len == 0)) {
/* Remove useless empty fragment. */
- prev_tail->pkt.next = NULL;
- --head->pkt.nb_segs;
+ prev_tail->next = NULL;
+ --head->nb_segs;
tail = prev_tail;
prev_tail = NULL;
rte_pktmbuf_free(buf);
@@ -474,7 +471,7 @@ send_packet(struct vmxnet3_tx_queue *tq,
/* Make sure len doesn't overflow. */
assert(len >= 0);
- assert((unsigned int)len <= mbuf->pkt.pkt_len);
+ assert((unsigned int)len <= mbuf->pkt_len);
/* Zero-sized packets can't be transmitted. Silently ignore them. */
if (len == 0) {
@@ -488,7 +485,7 @@ send_packet(struct vmxnet3_tx_queue *tq,
* than the first segment size and less or equal to
* VMXNET3_HDR_COPY_SIZE.
*/
- copy_size = ((mbuf->pkt.data_len < len) ? mbuf->pkt.data_len : len);
+ copy_size = ((mbuf->data_len < len) ? mbuf->data_len : len);
if (copy_size > VMXNET3_HDR_COPY_SIZE)
copy_size = VMXNET3_HDR_COPY_SIZE;
@@ -502,11 +499,11 @@ send_packet(struct vmxnet3_tx_queue *tq,
* An extra descriptor is required for the data ring part if
* copy_size is nonzero.
*/
- count = mbuf->pkt.nb_segs;
+ count = mbuf->nb_segs;
assert(count >= 1);
- if (mbuf->pkt.data_len == copy_size) {
+ if (mbuf->data_len == copy_size) {
/* First segment is either in the data ring or empty. */
- cur = mbuf->pkt.next;
+ cur = mbuf->next;
offset = 0;
} else {
/* Rest of the first segment needs its own descriptor. */
@@ -550,7 +547,7 @@ send_packet(struct vmxnet3_tx_queue *tq,
dw2 |= (copy_size & (VMXNET3_TXD_GEN - 1));
tdd = tq->data_ring.base + tq->tx_ring.next2fill;
/* Copy to the data ring. */
- memcpy(tdd->data, mbuf->pkt.data, copy_size);
+ memcpy(tdd->data, rte_pktmbuf_mtod(mbuf, char *), copy_size);
tmp.txd.addr =
rte_cpu_to_le_64(tq->data_ring.basePA +
tq->tx_ring.next2fill *
@@ -581,7 +578,7 @@ send_packet(struct vmxnet3_tx_queue *tq,
int buf_size;
assert(cur != NULL);
- buf_size = min(len, (cur->pkt.data_len - offset));
+ buf_size = min(len, (cur->data_len - offset));
if (buf_size == 0) {
/*
* Can't fill a descriptor with an empty segment,
@@ -625,7 +622,7 @@ send_packet(struct vmxnet3_tx_queue *tq,
gdesc = tq->tx_ring.base + tq->tx_ring.next2fill;
skip:
offset = 0;
- cur = cur->pkt.next;
+ cur = cur->next;
}
/* Reverse gen bit in SOP descriptor. */
@@ -781,7 +778,7 @@ eth_tx_burst(rte_txq_t *txq,
int num;
for (num = 0; num < nb_pkts; num++) {
- int ret = send_packet(tq, tx_pkts[num]->pkt.pkt_len,
+ int ret = send_packet(tq, tx_pkts[num]->pkt_len,
tx_pkts[num]);
if (ret == -1) {
break;
--
1.9.2
More information about the dev
mailing list