From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org
Subject: [dpdk-dev] [virtio-net-pmd PATCH v2 14/17] pmd: adapt to new rte_mbuf structure
Date: Mon, 19 May 2014 15:56:26 +0200 [thread overview]
Message-ID: <1400507789-18453-15-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <1400507789-18453-1-git-send-email-olivier.matz@6wind.com>
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@6wind.com>
---
virtio_user.c | 44 +++++++++++++++++++++-----------------------
1 file changed, 21 insertions(+), 23 deletions(-)
diff --git a/virtio_user.c b/virtio_user.c
index 4e73aa3..5df7dde 100644
--- a/virtio_user.c
+++ b/virtio_user.c
@@ -192,11 +192,11 @@ struct virtio_pmd_ctrl {
typedef struct igb_tx_queue rte_txq_t;
typedef struct igb_rx_queue rte_rxq_t;
/* until dpdk-1.3, bit-fields vlan_macip are flat in rte_pktmbuf */
-#define RTE_MBUF_VLAN_MAC_IP(m) (m)->pkt.vlan_tci
+#define RTE_MBUF_VLAN_MAC_IP(m) (m)->vlan_tci
#else /* since dpdk-1.3 */
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
#endif
/* This part is taken from ixgbe and igb pmd drivers. */
@@ -205,14 +205,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)->pkt.data - \
- (uint64_t)(mb)->buf_addr) + \
- (mb)->buf_physaddr
+ (uint64_t) ((mb)->buf_physaddr + (mb)->data_off)
static inline int
virtio_has_feature(const struct virtio_net_adapter* adapter,
@@ -442,7 +440,7 @@ virtio_recv_buf(rte_rxq_t *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
i = idx;
buf = (struct rte_mbuf*)rq->user[i];
- buf->pkt.data = ((char *)buf->buf_addr + RTE_PKTMBUF_HEADROOM);
+ buf->data_off = RTE_PKTMBUF_HEADROOM;
ptr = (struct virtio_pmd_net_hdr*)
((char*)buf->buf_addr + hdr_offt);
@@ -460,11 +458,11 @@ virtio_recv_buf(rte_rxq_t *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
rq->last_used++;
rq->freeslots++;
- buf->pkt.nb_segs = n_frag;
- buf->pkt.next = NULL;
- buf->pkt.pkt_len = len;
- buf->pkt.data_len = len;
- buf->pkt.in_port = rq->port_id;
+ buf->nb_segs = n_frag;
+ buf->next = NULL;
+ buf->pkt_len = len;
+ buf->data_len = len;
+ buf->in_port = rq->port_id;
buf->ol_flags = 0; /* RSS - FDIR // Error */
RTE_MBUF_VLAN_MAC_IP(buf) = 0;
@@ -485,17 +483,17 @@ virtio_recv_buf(rte_rxq_t *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
i = idx;
buf = (struct rte_mbuf*)rq->user[i];
- buf->pkt.data = ((char *)buf->buf_addr + hdr_offt);
+ buf->data_off = hdr_offt;
- buf->pkt.next = NULL;
- buf->pkt.data_len = len;
+ buf->next = NULL;
+ buf->data_len = len;
/* New tail */
- cur_seg->pkt.next = buf;
+ cur_seg->next = buf;
cur_seg = buf;
/* Update head pkt_len */
- rx_pkts[completed]->pkt.pkt_len += len;
+ rx_pkts[completed]->pkt_len += len;
rq->vr.desc[i].next = rq->head;
rq->head = idx;
@@ -505,7 +503,7 @@ virtio_recv_buf(rte_rxq_t *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts)
n_frag--;
}
- rq->stats.ibytes += rx_pkts[completed]->pkt.pkt_len;
+ rq->stats.ibytes += rx_pkts[completed]->pkt_len;
rq->stats.ipackets++;
completed++;
}
@@ -613,11 +611,11 @@ static inline int
virtio_send_packet(struct virtio_net_vring* tq, struct rte_mbuf* mbuf)
{
unsigned int head, prev, i, avail;
- unsigned int nseg = mbuf->pkt.nb_segs;
+ unsigned int nseg = mbuf->nb_segs;
struct rte_mbuf* cur = mbuf;
unsigned int hdr_len;
unsigned long hdr_phys;
- uint32_t len = mbuf->pkt.pkt_len;
+ uint32_t len = mbuf->pkt_len;
/* No need to send empty packets. */
if (len == 0) {
@@ -642,13 +640,13 @@ virtio_send_packet(struct virtio_net_vring* tq, struct rte_mbuf* mbuf)
tq->vr.desc[head].len = hdr_len;
tq->user[head] = NULL;
- for (i = tq->vr.desc[head].next; nseg > 0; nseg--, cur = cur->pkt.next) {
- if (!cur->pkt.data_len) {
+ for (i = tq->vr.desc[head].next; nseg > 0; nseg--, cur = cur->next) {
+ if (!cur->data_len) {
continue;
}
tq->vr.desc[i].flags = VRING_DESC_F_NEXT;
tq->vr.desc[i].addr = RTE_MBUF_DATA_DMA_ADDR(cur);
- tq->vr.desc[i].len = cur->pkt.data_len;
+ tq->vr.desc[i].len = cur->data_len;
tq->user[i] = cur;
prev = i;
i = tq->vr.desc[i].next;
--
1.9.2
next prev parent reply other threads:[~2014-05-19 13:57 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-05-19 13:56 [dpdk-dev] [PATCH v2 00/17] ixgbe/mbuf: add TSO support Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 01/17] igb/ixgbe: fix IP checksum calculation Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 02/17] mbuf: rename RTE_MBUF_SCATTER_GATHER into RTE_MBUF_REFCNT Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 03/17] mbuf: remove rte_ctrlmbuf Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 04/17] mbuf: remove the rte_pktmbuf structure Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 05/17] mbuf: merge physaddr and buf_len in a bitfield Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 06/17] mbuf: cosmetic changes in rte_mbuf structure Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 07/17] mbuf: replace data pointer by an offset Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 08/17] mbuf: add functions to get the name of an ol_flag Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 09/17] mbuf: change ol_flags to 32 bits Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 10/17] mbuf: rename vlan_macip_len in hw_offload and increase its size Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 11/17] testpmd: modify source address to validate checksum calculation Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 12/17] mbuf: generic support of TCP segmentation offload Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [PATCH v2 13/17] ixgbe: support " Olivier Matz
2014-05-19 13:56 ` Olivier Matz [this message]
2014-05-19 13:56 ` [dpdk-dev] [vmxnet3-usermap PATCH v2 15/17] pmd: remove support of old dpdk versions Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [vmxnet3-usermap PATCH v2 16/17] pmd: adapt to new rte_mbuf structure Olivier Matz
2014-05-19 13:56 ` [dpdk-dev] [memnic PATCH v2 17/17] " Olivier Matz
2014-05-22 15:02 ` [dpdk-dev] [PATCH v2 00/17] add TSO support Thomas Monjalon
2014-05-22 16:09 ` Venkatesan, Venky
2014-05-23 14:22 ` Olivier MATZ
2014-05-23 14:43 ` Venkatesan, Venky
2014-05-26 11:59 ` Olivier MATZ
2014-05-23 12:47 ` Ananyev, Konstantin
2014-05-23 14:32 ` Olivier MATZ
2014-05-26 15:20 ` Ananyev, Konstantin
2014-11-03 7:32 ` [dpdk-dev] [PATCH v2 00/17] ixgbe/mbuf: " Liu, Jijiang
2014-11-03 10:12 ` Olivier MATZ
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1400507789-18453-15-git-send-email-olivier.matz@6wind.com \
--to=olivier.matz@6wind.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).