From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) by dpdk.org (Postfix) with ESMTP id 6320A5953 for ; Mon, 19 May 2014 15:57:05 +0200 (CEST) Received: by mail-wi0-f172.google.com with SMTP id hi2so4170803wib.17 for ; Mon, 19 May 2014 06:57:13 -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=JiCRGjkz3CaQmBinRvETOQLT/Yc3Rf2sPj+/nmvMM6A=; b=gvvS6ZDABRO9q4cOP0F6huHU4Efgd9O9SV+XzI+9DqDXyD+/9F0lbyYqgF3nosUYSF HbvHGMWgx+Wvc7j8lLsBk4T+/xVMLRBHoOROZDYqB/LurpRKW/38FuJ8byG6QGoRt3lH SfPguuJWP+tR3GcshQw8+AkwuUmsioa2+HMR/t8OgkCGNbhcVlYknMQxgeJVkE4fdA0m nGt5synTlaWVR7+4fN2EbTg1xQDyB9xUK/11FAx4fbfBSPPVK+OqCyqLEg9QDS1nk9Wa xk5B/ZcKJW1WrLlg5RazD85FGSWPfTKjfqjl1xqRYoS14TFJ2aJBQWe4u2CkCwxCU5Yl 9khw== X-Gm-Message-State: ALoCoQnx10BPigSgEHmEubbsGTjK3hzn2OGErEOTJ26PTxbUmkAQh6Nu/6CT1mMbSFp+0DPb7RGl X-Received: by 10.180.97.10 with SMTP id dw10mr13404887wib.38.1400507833903; Mon, 19 May 2014 06:57:13 -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.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 May 2014 06:57:13 -0700 (PDT) From: Olivier Matz To: dev@dpdk.org Date: Mon, 19 May 2014 15:56:26 +0200 Message-Id: <1400507789-18453-15-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] [virtio-net-pmd PATCH v2 14/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:05 -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 --- 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