From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) by dpdk.org (Postfix) with ESMTP id 93F3458EE for ; Thu, 25 Jul 2013 22:39:26 +0200 (CEST) Received: by mail-wi0-f180.google.com with SMTP id c10so72004wiw.7 for ; Thu, 25 Jul 2013 13:39:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:subject:date:message-id:x-mailer:x-gm-message-state; bh=d2ofArvlrH4Yw58+OfHaMg9pkd+eWtwLjePnFbAa/2E=; b=pzWctUcAgVZoLRq4Q9c572vbzxuKocpyvk/GadWbDDwZ/J1OSWOaEE42097cfq/mvS QAAnwqyxsZpdUnQg6KV+g6qLBYAuTzzzRYqBjMOy5Feis8t3d6+18uCJqrDLgIvWytuZ tGnp5J34ZU7YOoiHTr363j0RC8eUBjYwK35LU3xOPJ2Z8/s5hMMYwIhiooVR6PmdA375 1RfKw3zILys+Fxc4geThck/v3U5MYiMDAP8et2IA3xwyV6sqhLda8dCbR0KOZqc9uetc kZRUdLveCM22scw1SkhBPFB2G722nGYM9CX/gRr0REUlR9TNtKocIZ7u+V8PYQ4+/tTL ySSQ== X-Received: by 10.194.63.46 with SMTP id d14mr32845628wjs.81.1374784789144; Thu, 25 Jul 2013 13:39:49 -0700 (PDT) Received: from 6wind.com (6wind.net2.nerim.net. [213.41.180.237]) by mx.google.com with ESMTPSA id fs8sm434152wib.0.2013.07.25.13.39.46 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 25 Jul 2013 13:39:48 -0700 (PDT) Received: by 6wind.com (sSMTP sendmail emulation); Thu, 25 Jul 2013 22:39:46 +0200 From: Thomas Monjalon To: dev@dpdk.org Date: Thu, 25 Jul 2013 22:39:46 +0200 Message-Id: <1374784786-24470-1-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 1.7.10.4 X-Gm-Message-State: ALoCoQkqnUgEvPn0XChC3EBlehDUsRnAF6XweykcmFxUM8bxlyxhaVRkeitW0WwjCODktw34YUpg Subject: [dpdk-dev] [vmxnet3 PATCH] pmd: support dpdk-1.3 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: Thu, 25 Jul 2013 20:39:27 -0000 API changes in DPDK 1.3: - queue arrays are already allocated by rte_ethdev - queue could be released for reconfiguration (not supported) - queue struct becomes an opaque pointer - vlan_filter_set can return an error - bit-fields vlan_macip have moved Signed-off-by: Thomas Monjalon --- pmd/vmxnet3.c | 43 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/pmd/vmxnet3.c b/pmd/vmxnet3.c index 8dc1650..1718f8d 100644 --- a/pmd/vmxnet3.c +++ b/pmd/vmxnet3.c @@ -1,5 +1,5 @@ /* - * Copyright 6WIND 2012-2013, All rights reserved. + * Copyright 2012-2013 6WIND S.A. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -47,13 +47,26 @@ /* Dependency over DPDK */ #include #include +#include + +#define DPDK_VERSION_BEFORE(x,y) RTE_VERSION < RTE_VERSION_NUM(x,y,0,0) +#define DPDK_VERSION_SINCE(x,y) RTE_VERSION >= RTE_VERSION_NUM(x,y,0,0) /* Local includes */ #include "vmxnet3_shm_shared.h" #include "vmx_user.h" +#if DPDK_VERSION_BEFORE(1,3) +/* until dpdk-1.3, queue structs are igb ones */ 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 +#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 +#endif #define VMXNET3_MAX_MAC_ADDRS 1 @@ -324,7 +337,7 @@ queue_rx_complete(struct vmxnet3_rx_queue *rq, buf->pkt.data_len = rcd->len; buf->pkt.in_port = rq->port_id; buf->ol_flags = 0; // RSS - FDIR // Error - buf->pkt.vlan_tci = 0; + RTE_MBUF_VLAN_MAC_IP(buf) = 0; if (unlikely(rep == NULL)) { /* Can't allocate replacement mbuf, drop packet and @@ -734,7 +747,11 @@ vmxnet3_rss_configure(const struct rte_eth_dev *dev) * Clear VLAN Filter table and declare VLAN filtering capability, * so that we can enable VLAN filtering by simply adding entries in it. */ +#if DPDK_VERSION_SINCE(1,3) +static int +#else static void +#endif vmxnet3_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) { const struct vmxnet3_adapter *priv; @@ -748,7 +765,11 @@ vmxnet3_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) if (!(devRead->misc.uptFeatures & UPT1_F_RXVLAN)) { RTE_LOG(WARNING, PMD, "%s(): No VLAN enabled for device\n", __func__); +#if DPDK_VERSION_SINCE(1,3) + return -1; +#else return; +#endif } if (on) { @@ -756,6 +777,10 @@ vmxnet3_vlan_filter_set(struct rte_eth_dev *dev, uint16_t vlan_id, int on) } else { VMXNET3_CLEAR_VFTABLE_ENTRY(vfTable, vlan_id); } + +#if DPDK_VERSION_SINCE(1,3) + return 0; +#endif } /* Exported Rx function after Rx Queue setup. */ @@ -976,6 +1001,7 @@ vmxnet3_dev_start(struct rte_eth_dev *dev) return ret; } +#if DPDK_VERSION_BEFORE(1,3) /* Allocate array of pointers to register queues */ static int pointer_array_alloc(void **pointer_array, uint16_t *size, uint16_t new_size) @@ -997,12 +1023,17 @@ pointer_array_alloc(void **pointer_array, uint16_t *size, uint16_t new_size) static int vmxnet3_dev_configure(struct rte_eth_dev *dev, uint16_t nb_rx_q, uint16_t nb_tx_q) +#else +static int +vmxnet3_dev_configure(struct rte_eth_dev *dev) +#endif { const struct vmxnet3_adapter* priv; struct Vmxnet3_DSDevRead *devRead; unsigned int i; u32 *vfTable; +#if DPDK_VERSION_BEFORE(1,3) int ret; /* Allocate array of pointers to RX queues */ @@ -1020,6 +1051,7 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev, rte_panic("%s(): port_id=%d: allocation of array " "of %d pointers to TX queues failed\n", __func__, dev->data->port_id, nb_tx_q); +#endif priv = (struct vmxnet3_adapter*)dev->data->dev_private; @@ -1360,7 +1392,7 @@ vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev, tq->hthresh = tx_conf->tx_thresh.hthresh; tq->wthresh = tx_conf->tx_thresh.wthresh; - dev->data->tx_queues[queue_idx] = (struct igb_tx_queue*)tq; + dev->data->tx_queues[queue_idx] = (rte_txq_t*)tq; dev->tx_pkt_burst = eth_tx_burst; return 0; @@ -1392,6 +1424,11 @@ static struct eth_dev_ops vmxnet3_eth_dev_ops = { .vlan_filter_set = vmxnet3_vlan_filter_set, .rx_queue_setup = vmxnet3_dev_rx_queue_setup, .tx_queue_setup = vmxnet3_dev_tx_queue_setup, +#if DPDK_VERSION_SINCE(1,3) + /* Reconfiguration not supported yet */ + .rx_queue_release = NULL, + .tx_queue_release = NULL, +#endif .dev_led_on = NULL, .dev_led_off = NULL, .flow_ctrl_set = NULL, -- 1.7.10.4