From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wg0-f48.google.com (mail-wg0-f48.google.com [74.125.82.48]) by dpdk.org (Postfix) with ESMTP id 3D81BB0C6 for ; Mon, 19 May 2014 15:57:09 +0200 (CEST) Received: by mail-wg0-f48.google.com with SMTP id b13so7973441wgh.19 for ; Mon, 19 May 2014 06:57:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=XNq9aX3rzbTJIqMG3ZeXQiQ626vigkl5zw+TA/npYFk=; b=NqMS+L06OcxEhw+BBiaPNTLPlWL7W0aaqF/xb8U7ydfjsAVTNMMpD9FOGgAj9yM3K/ Z8QKPDGBuc2AQLLu2MTjUT6X/0e9624+DyjaQBg8ZRXCvHrAdjgIGwERT5Dw0YTU8Cqu lFF8wkkrky7ak3PCAWsJRiK+3Tx2VUERl2uQwfOiUjBxwKzdo6VPGYJFep7NLu4jVAE2 Yc8A1wi/e1sM3si4Z8r0/y1ZHM1vwnCMXTEP0TG3SzLElqaE+gMgtJPCseU5Dvjyh6R6 B+Mx/cM4X+nogib431bpKUPI2tQgG2C7dykZKLnLZ/tPgfM5zg7lm0SOTsVrVg3o8/5y 9nhg== X-Gm-Message-State: ALoCoQmJynPQL4eftN5HDznLnFv/V0XcyK5xkdrG7Bt4xJNrBwXc235UIIJQnzuU9zL61BK1VJls X-Received: by 10.180.228.42 with SMTP id sf10mr13068315wic.33.1400507838101; Mon, 19 May 2014 06:57:18 -0700 (PDT) Received: from glumotte.dev.6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id t18sm15201828wiv.16.2014.05.19.06.57.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 May 2014 06:57:17 -0700 (PDT) From: Olivier Matz To: dev@dpdk.org Date: Mon, 19 May 2014 15:56:28 +0200 Message-Id: <1400507789-18453-17-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 1.9.2 In-Reply-To: <1400507789-18453-1-git-send-email-olivier.matz@6wind.com> References: <1400507789-18453-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [vmxnet3-usermap PATCH v2 16/17] pmd: adapt to new rte_mbuf structure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 May 2014 13:57:09 -0000 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 --- 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