diff mbox

linux-generic: pktio: support new pktio_entry states

Message ID 1460103190-6746-1-git-send-email-matias.elo@nokia.com
State Accepted
Commit 4c8ea5e660033fe338625602b4d93358dcd36c25
Headers show

Commit Message

Elo, Matias (Nokia - FI/Espoo) April 8, 2016, 8:13 a.m. UTC
Use new pktio_entry states in netmap and dpdk pktio
implementations. Fixes build for both pktio types.

Signed-off-by: Matias Elo <matias.elo@nokia.com>
---
 platform/linux-generic/include/odp_packet_dpdk.h | 1 -
 platform/linux-generic/pktio/dpdk.c              | 7 +++----
 platform/linux-generic/pktio/netmap.c            | 4 ++--
 3 files changed, 5 insertions(+), 7 deletions(-)

Comments

Bill Fischofer April 8, 2016, 12:14 p.m. UTC | #1
On Fri, Apr 8, 2016 at 3:13 AM, Matias Elo <matias.elo@nokia.com> wrote:

> Use new pktio_entry states in netmap and dpdk pktio

> implementations. Fixes build for both pktio types.

>

> Signed-off-by: Matias Elo <matias.elo@nokia.com>

>


Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>



> ---

>  platform/linux-generic/include/odp_packet_dpdk.h | 1 -

>  platform/linux-generic/pktio/dpdk.c              | 7 +++----

>  platform/linux-generic/pktio/netmap.c            | 4 ++--

>  3 files changed, 5 insertions(+), 7 deletions(-)

>

> diff --git a/platform/linux-generic/include/odp_packet_dpdk.h

> b/platform/linux-generic/include/odp_packet_dpdk.h

> index 6e00d2d..747ab72 100644

> --- a/platform/linux-generic/include/odp_packet_dpdk.h

> +++ b/platform/linux-generic/include/odp_packet_dpdk.h

> @@ -54,7 +54,6 @@ typedef struct {

>         uint16_t mtu;                     /**< maximum transmission unit */

>         /** DPDK packet pool name (pktpool_<ifname>) */

>         char pool_name[IF_NAMESIZE + 8];

> -       odp_bool_t started;               /**< DPDK device has been

> started */

>         /** Use system call to get/set vdev promisc mode */

>         odp_bool_t vdev_sysc_promisc;

>         uint8_t port_id;                  /**< DPDK port identifier */

> diff --git a/platform/linux-generic/pktio/dpdk.c

> b/platform/linux-generic/pktio/dpdk.c

> index 3fce723..623433f 100644

> --- a/platform/linux-generic/pktio/dpdk.c

> +++ b/platform/linux-generic/pktio/dpdk.c

> @@ -320,7 +320,7 @@ static int dpdk_close(pktio_entry_t *pktio_entry)

>

> rte_pktmbuf_free(pkt_dpdk->rx_cache[i].s.pkt[idx++]);

>         }

>

> -       if (pkt_dpdk->started)

> +       if (pktio_entry->s.state != STATE_OPENED)

>                 rte_eth_dev_close(pkt_dpdk->port_id);

>

>         return 0;

> @@ -636,7 +636,6 @@ static int dpdk_start(pktio_entry_t *pktio_entry)

>                         ret, port_id);

>                 return -1;

>         }

> -       pkt_dpdk->started = 1;

>

>         return 0;

>  }

> @@ -771,7 +770,7 @@ static int dpdk_recv_queue(pktio_entry_t *pktio_entry,

>         int i;

>         unsigned cache_idx;

>

> -       if (odp_unlikely(pktio_entry->s.state == STATE_STOP))

> +       if (odp_unlikely(pktio_entry->s.state != STATE_STARTED))

>                 return 0;

>

>         if (!pkt_dpdk->lockless_rx)

> @@ -834,7 +833,7 @@ static int dpdk_send_queue(pktio_entry_t *pktio_entry,

>         int i;

>         int mbufs;

>

> -       if (odp_unlikely(pktio_entry->s.state == STATE_STOP))

> +       if (odp_unlikely(pktio_entry->s.state != STATE_STARTED))

>                 return 0;

>

>         if (!pktio_entry->s.pkt_dpdk.lockless_tx)

> diff --git a/platform/linux-generic/pktio/netmap.c

> b/platform/linux-generic/pktio/netmap.c

> index df5a108..0e160c5 100644

> --- a/platform/linux-generic/pktio/netmap.c

> +++ b/platform/linux-generic/pktio/netmap.c

> @@ -667,7 +667,7 @@ static int netmap_recv_queue(pktio_entry_t

> *pktio_entry, int index,

>         int max_fd = 0;

>         fd_set empty_rings;

>

> -       if (odp_unlikely(pktio_entry->s.state == STATE_STOP))

> +       if (odp_unlikely(pktio_entry->s.state != STATE_STARTED))

>                 return 0;

>

>         FD_ZERO(&empty_rings);

> @@ -722,7 +722,7 @@ static int netmap_send_queue(pktio_entry_t

> *pktio_entry, int index,

>         unsigned slot_id;

>         char *buf;

>

> -       if (odp_unlikely(pktio_entry->s.state == STATE_STOP))

> +       if (odp_unlikely(pktio_entry->s.state != STATE_STARTED))

>                 return 0;

>

>         /* Only one netmap tx ring per pktout queue */

> --

> 1.9.1

>

> _______________________________________________

> lng-odp mailing list

> lng-odp@lists.linaro.org

> https://lists.linaro.org/mailman/listinfo/lng-odp

>
Maxim Uvarov April 8, 2016, 3:13 p.m. UTC | #2
That was merged,
Maxim.

On 04/08/16 15:14, Bill Fischofer wrote:
>
>
> On Fri, Apr 8, 2016 at 3:13 AM, Matias Elo <matias.elo@nokia.com 
> <mailto:matias.elo@nokia.com>> wrote:
>
>     Use new pktio_entry states in netmap and dpdk pktio
>     implementations. Fixes build for both pktio types.
>
>     Signed-off-by: Matias Elo <matias.elo@nokia.com
>     <mailto:matias.elo@nokia.com>>
>
>
> Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org 
> <mailto:bill.fischofer@linaro.org>>
>
>     ---
>      platform/linux-generic/include/odp_packet_dpdk.h | 1 -
>      platform/linux-generic/pktio/dpdk.c              | 7 +++----
>      platform/linux-generic/pktio/netmap.c            | 4 ++--
>      3 files changed, 5 insertions(+), 7 deletions(-)
>
>     diff --git a/platform/linux-generic/include/odp_packet_dpdk.h
>     b/platform/linux-generic/include/odp_packet_dpdk.h
>     index 6e00d2d..747ab72 100644
>     --- a/platform/linux-generic/include/odp_packet_dpdk.h
>     +++ b/platform/linux-generic/include/odp_packet_dpdk.h
>     @@ -54,7 +54,6 @@ typedef struct {
>             uint16_t mtu;                     /**< maximum
>     transmission unit */
>             /** DPDK packet pool name (pktpool_<ifname>) */
>             char pool_name[IF_NAMESIZE + 8];
>     -       odp_bool_t started;               /**< DPDK device has
>     been started */
>             /** Use system call to get/set vdev promisc mode */
>             odp_bool_t vdev_sysc_promisc;
>             uint8_t port_id;                  /**< DPDK port identifier */
>     diff --git a/platform/linux-generic/pktio/dpdk.c
>     b/platform/linux-generic/pktio/dpdk.c
>     index 3fce723..623433f 100644
>     --- a/platform/linux-generic/pktio/dpdk.c
>     +++ b/platform/linux-generic/pktio/dpdk.c
>     @@ -320,7 +320,7 @@ static int dpdk_close(pktio_entry_t *pktio_entry)
>     rte_pktmbuf_free(pkt_dpdk->rx_cache[i].s.pkt[idx++]);
>             }
>
>     -       if (pkt_dpdk->started)
>     +       if (pktio_entry->s.state != STATE_OPENED)
>                     rte_eth_dev_close(pkt_dpdk->port_id);
>
>             return 0;
>     @@ -636,7 +636,6 @@ static int dpdk_start(pktio_entry_t *pktio_entry)
>                             ret, port_id);
>                     return -1;
>             }
>     -       pkt_dpdk->started = 1;
>
>             return 0;
>      }
>     @@ -771,7 +770,7 @@ static int dpdk_recv_queue(pktio_entry_t
>     *pktio_entry,
>             int i;
>             unsigned cache_idx;
>
>     -       if (odp_unlikely(pktio_entry->s.state == STATE_STOP))
>     +       if (odp_unlikely(pktio_entry->s.state != STATE_STARTED))
>                     return 0;
>
>             if (!pkt_dpdk->lockless_rx)
>     @@ -834,7 +833,7 @@ static int dpdk_send_queue(pktio_entry_t
>     *pktio_entry,
>             int i;
>             int mbufs;
>
>     -       if (odp_unlikely(pktio_entry->s.state == STATE_STOP))
>     +       if (odp_unlikely(pktio_entry->s.state != STATE_STARTED))
>                     return 0;
>
>             if (!pktio_entry->s.pkt_dpdk.lockless_tx)
>     diff --git a/platform/linux-generic/pktio/netmap.c
>     b/platform/linux-generic/pktio/netmap.c
>     index df5a108..0e160c5 100644
>     --- a/platform/linux-generic/pktio/netmap.c
>     +++ b/platform/linux-generic/pktio/netmap.c
>     @@ -667,7 +667,7 @@ static int netmap_recv_queue(pktio_entry_t
>     *pktio_entry, int index,
>             int max_fd = 0;
>             fd_set empty_rings;
>
>     -       if (odp_unlikely(pktio_entry->s.state == STATE_STOP))
>     +       if (odp_unlikely(pktio_entry->s.state != STATE_STARTED))
>                     return 0;
>
>             FD_ZERO(&empty_rings);
>     @@ -722,7 +722,7 @@ static int netmap_send_queue(pktio_entry_t
>     *pktio_entry, int index,
>             unsigned slot_id;
>             char *buf;
>
>     -       if (odp_unlikely(pktio_entry->s.state == STATE_STOP))
>     +       if (odp_unlikely(pktio_entry->s.state != STATE_STARTED))
>                     return 0;
>
>             /* Only one netmap tx ring per pktout queue */
>     --
>     1.9.1
>
>     _______________________________________________
>     lng-odp mailing list
>     lng-odp@lists.linaro.org <mailto:lng-odp@lists.linaro.org>
>     https://lists.linaro.org/mailman/listinfo/lng-odp
>
>
>
>
> _______________________________________________
> lng-odp mailing list
> lng-odp@lists.linaro.org
> https://lists.linaro.org/mailman/listinfo/lng-odp
diff mbox

Patch

diff --git a/platform/linux-generic/include/odp_packet_dpdk.h b/platform/linux-generic/include/odp_packet_dpdk.h
index 6e00d2d..747ab72 100644
--- a/platform/linux-generic/include/odp_packet_dpdk.h
+++ b/platform/linux-generic/include/odp_packet_dpdk.h
@@ -54,7 +54,6 @@  typedef struct {
 	uint16_t mtu;			  /**< maximum transmission unit */
 	/** DPDK packet pool name (pktpool_<ifname>) */
 	char pool_name[IF_NAMESIZE + 8];
-	odp_bool_t started;		  /**< DPDK device has been started */
 	/** Use system call to get/set vdev promisc mode */
 	odp_bool_t vdev_sysc_promisc;
 	uint8_t port_id;		  /**< DPDK port identifier */
diff --git a/platform/linux-generic/pktio/dpdk.c b/platform/linux-generic/pktio/dpdk.c
index 3fce723..623433f 100644
--- a/platform/linux-generic/pktio/dpdk.c
+++ b/platform/linux-generic/pktio/dpdk.c
@@ -320,7 +320,7 @@  static int dpdk_close(pktio_entry_t *pktio_entry)
 			rte_pktmbuf_free(pkt_dpdk->rx_cache[i].s.pkt[idx++]);
 	}
 
-	if (pkt_dpdk->started)
+	if (pktio_entry->s.state != STATE_OPENED)
 		rte_eth_dev_close(pkt_dpdk->port_id);
 
 	return 0;
@@ -636,7 +636,6 @@  static int dpdk_start(pktio_entry_t *pktio_entry)
 			ret, port_id);
 		return -1;
 	}
-	pkt_dpdk->started = 1;
 
 	return 0;
 }
@@ -771,7 +770,7 @@  static int dpdk_recv_queue(pktio_entry_t *pktio_entry,
 	int i;
 	unsigned cache_idx;
 
-	if (odp_unlikely(pktio_entry->s.state == STATE_STOP))
+	if (odp_unlikely(pktio_entry->s.state != STATE_STARTED))
 		return 0;
 
 	if (!pkt_dpdk->lockless_rx)
@@ -834,7 +833,7 @@  static int dpdk_send_queue(pktio_entry_t *pktio_entry,
 	int i;
 	int mbufs;
 
-	if (odp_unlikely(pktio_entry->s.state == STATE_STOP))
+	if (odp_unlikely(pktio_entry->s.state != STATE_STARTED))
 		return 0;
 
 	if (!pktio_entry->s.pkt_dpdk.lockless_tx)
diff --git a/platform/linux-generic/pktio/netmap.c b/platform/linux-generic/pktio/netmap.c
index df5a108..0e160c5 100644
--- a/platform/linux-generic/pktio/netmap.c
+++ b/platform/linux-generic/pktio/netmap.c
@@ -667,7 +667,7 @@  static int netmap_recv_queue(pktio_entry_t *pktio_entry, int index,
 	int max_fd = 0;
 	fd_set empty_rings;
 
-	if (odp_unlikely(pktio_entry->s.state == STATE_STOP))
+	if (odp_unlikely(pktio_entry->s.state != STATE_STARTED))
 		return 0;
 
 	FD_ZERO(&empty_rings);
@@ -722,7 +722,7 @@  static int netmap_send_queue(pktio_entry_t *pktio_entry, int index,
 	unsigned slot_id;
 	char *buf;
 
-	if (odp_unlikely(pktio_entry->s.state == STATE_STOP))
+	if (odp_unlikely(pktio_entry->s.state != STATE_STARTED))
 		return 0;
 
 	/* Only one netmap tx ring per pktout queue */