[dpdk-dev] [PATCH 5/5] mbuf: Add in second vlan tag field to mbuf

2014-09-17 Thread Stephen Hemminger
On Wed, 17 Sep 2014 11:01:42 +0100
Bruce Richardson  wrote:

> Packets with double vlan tags are relatively common. Applications can be
> written to use these, and some NICs (such as those supported by the i40e
> driver) have hardware support for double vlan tags. To support apps and
> drivers using double vlan tags, we need to add in a second vlan tag
> field into the mbuf. The existing vlan_tci field is renamed vlan_tci0 to
> take account of the fact that there is now a vlan_tci1 field.
> 
> Signed-off-by: Bruce Richardson 
> ---
>  app/test-pmd/flowgen.c|  2 +-
>  app/test-pmd/macfwd.c |  2 +-
>  app/test-pmd/macswap.c|  2 +-
>  app/test-pmd/rxonly.c |  2 +-
>  app/test-pmd/testpmd.c|  4 ++--
>  app/test-pmd/txonly.c |  2 +-
>  app/test/packet_burst_generator.c |  4 ++--
>  examples/ipv4_multicast/main.c|  3 ++-
>  examples/vhost/main.c |  2 +-
>  lib/librte_mbuf/rte_mbuf.h| 10 ++
>  lib/librte_pmd_e1000/em_rxtx.c|  8 
>  lib/librte_pmd_e1000/igb_rxtx.c   |  6 +++---
>  lib/librte_pmd_i40e/i40e_rxtx.c   |  8 
>  lib/librte_pmd_ixgbe/ixgbe_rxtx.c |  8 
>  lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c |  4 ++--
>  15 files changed, 35 insertions(+), 32 deletions(-)
> 
> diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
> index 8b4ed9a..cd68916 100644
> --- a/app/test-pmd/flowgen.c
> +++ b/app/test-pmd/flowgen.c
> @@ -208,7 +208,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
>   pkt->nb_segs= 1;
>   pkt->pkt_len= pkt_size;
>   pkt->ol_flags   = ol_flags;
> - pkt->vlan_tci   = vlan_tci;
> + pkt->vlan_tci0  = vlan_tci;
>   pkt->l2_len = sizeof(struct ether_hdr);
>   pkt->l3_len = sizeof(struct ipv4_hdr);
>   pkts_burst[nb_pkt]  = pkt;
> diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c
> index 38bae23..3e91050 100644
> --- a/app/test-pmd/macfwd.c
> +++ b/app/test-pmd/macfwd.c
> @@ -118,7 +118,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
>   mb->ol_flags = txp->tx_ol_flags;
>   mb->l2_len = sizeof(struct ether_hdr);
>   mb->l3_len = sizeof(struct ipv4_hdr);
> - mb->vlan_tci = txp->tx_vlan_id;
> + mb->vlan_tci0 = txp->tx_vlan_id;
>   }
>   nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
>   fs->tx_packets += nb_tx;
> diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c
> index 1786095..02b04d7 100644
> --- a/app/test-pmd/macswap.c
> +++ b/app/test-pmd/macswap.c
> @@ -120,7 +120,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
>   mb->ol_flags = txp->tx_ol_flags;
>   mb->l2_len = sizeof(struct ether_hdr);
>   mb->l3_len = sizeof(struct ipv4_hdr);
> - mb->vlan_tci = txp->tx_vlan_id;
> + mb->vlan_tci0 = txp->tx_vlan_id;
>   }
>   nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
>   fs->tx_packets += nb_tx;
> diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
> index 98c788b..a4c8797 100644
> --- a/app/test-pmd/rxonly.c
> +++ b/app/test-pmd/rxonly.c
> @@ -165,7 +165,7 @@ pkt_burst_receive(struct fwd_stream *fs)
>   printf(" - FDIR hash=0x%x - FDIR id=0x%x ",
>  mb->hash.fdir.hash, mb->hash.fdir.id);
>   if (ol_flags & PKT_RX_VLAN_PKT)
> - printf(" - VLAN tci=0x%x", mb->vlan_tci);
> + printf(" - VLAN tci0=0x%x", mb->vlan_tci0);
>   printf("\n");
>   if (ol_flags != 0) {
>   int rxf;
> diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
> index 5751607..fdf3296 100644
> --- a/app/test-pmd/testpmd.c
> +++ b/app/test-pmd/testpmd.c
> @@ -406,8 +406,8 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,
>   mb->ol_flags = 0;
>   mb->data_off = RTE_PKTMBUF_HEADROOM;
>   mb->nb_segs  = 1;
> - mb->l2_l3_len   = 0;
> - mb->vlan_tci = 0;
> + mb->l2_l3_len= 0;
> + mb->vlan_tci0= 0;
>   mb->hash.rss = 0;
>  }
>  
> diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
> index 3d08005..52b2f06 100644
> --- a/app/test-pmd/txonly.c
> +++ b/app/test-pmd/txonly.c
> @@ -264,7 +264,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
>   pkt->nb_segs = tx_pkt_nb_segs;
>   pkt->pkt_len = tx_pkt_length;
>   pkt->ol_flags = ol_flags;
> - pkt->vlan_tci  = vlan_tci;
> + pkt->vlan_tci0 = vlan_tci;
>   pkt->l2_len = sizeof(struct ether_hdr);
>   pkt->l3_len = sizeof(struct ipv4_hdr);
>   pkts_burst[nb_pkt] = pkt;
> diff --git a/app/test/packet_burst_generator.c 
> 

[dpdk-dev] [PATCH 5/5] mbuf: Add in second vlan tag field to mbuf

2014-09-17 Thread Bruce Richardson
Packets with double vlan tags are relatively common. Applications can be
written to use these, and some NICs (such as those supported by the i40e
driver) have hardware support for double vlan tags. To support apps and
drivers using double vlan tags, we need to add in a second vlan tag
field into the mbuf. The existing vlan_tci field is renamed vlan_tci0 to
take account of the fact that there is now a vlan_tci1 field.

Signed-off-by: Bruce Richardson 
---
 app/test-pmd/flowgen.c|  2 +-
 app/test-pmd/macfwd.c |  2 +-
 app/test-pmd/macswap.c|  2 +-
 app/test-pmd/rxonly.c |  2 +-
 app/test-pmd/testpmd.c|  4 ++--
 app/test-pmd/txonly.c |  2 +-
 app/test/packet_burst_generator.c |  4 ++--
 examples/ipv4_multicast/main.c|  3 ++-
 examples/vhost/main.c |  2 +-
 lib/librte_mbuf/rte_mbuf.h| 10 ++
 lib/librte_pmd_e1000/em_rxtx.c|  8 
 lib/librte_pmd_e1000/igb_rxtx.c   |  6 +++---
 lib/librte_pmd_i40e/i40e_rxtx.c   |  8 
 lib/librte_pmd_ixgbe/ixgbe_rxtx.c |  8 
 lib/librte_pmd_vmxnet3/vmxnet3_rxtx.c |  4 ++--
 15 files changed, 35 insertions(+), 32 deletions(-)

diff --git a/app/test-pmd/flowgen.c b/app/test-pmd/flowgen.c
index 8b4ed9a..cd68916 100644
--- a/app/test-pmd/flowgen.c
+++ b/app/test-pmd/flowgen.c
@@ -208,7 +208,7 @@ pkt_burst_flow_gen(struct fwd_stream *fs)
pkt->nb_segs= 1;
pkt->pkt_len= pkt_size;
pkt->ol_flags   = ol_flags;
-   pkt->vlan_tci   = vlan_tci;
+   pkt->vlan_tci0  = vlan_tci;
pkt->l2_len = sizeof(struct ether_hdr);
pkt->l3_len = sizeof(struct ipv4_hdr);
pkts_burst[nb_pkt]  = pkt;
diff --git a/app/test-pmd/macfwd.c b/app/test-pmd/macfwd.c
index 38bae23..3e91050 100644
--- a/app/test-pmd/macfwd.c
+++ b/app/test-pmd/macfwd.c
@@ -118,7 +118,7 @@ pkt_burst_mac_forward(struct fwd_stream *fs)
mb->ol_flags = txp->tx_ol_flags;
mb->l2_len = sizeof(struct ether_hdr);
mb->l3_len = sizeof(struct ipv4_hdr);
-   mb->vlan_tci = txp->tx_vlan_id;
+   mb->vlan_tci0 = txp->tx_vlan_id;
}
nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
fs->tx_packets += nb_tx;
diff --git a/app/test-pmd/macswap.c b/app/test-pmd/macswap.c
index 1786095..02b04d7 100644
--- a/app/test-pmd/macswap.c
+++ b/app/test-pmd/macswap.c
@@ -120,7 +120,7 @@ pkt_burst_mac_swap(struct fwd_stream *fs)
mb->ol_flags = txp->tx_ol_flags;
mb->l2_len = sizeof(struct ether_hdr);
mb->l3_len = sizeof(struct ipv4_hdr);
-   mb->vlan_tci = txp->tx_vlan_id;
+   mb->vlan_tci0 = txp->tx_vlan_id;
}
nb_tx = rte_eth_tx_burst(fs->tx_port, fs->tx_queue, pkts_burst, nb_rx);
fs->tx_packets += nb_tx;
diff --git a/app/test-pmd/rxonly.c b/app/test-pmd/rxonly.c
index 98c788b..a4c8797 100644
--- a/app/test-pmd/rxonly.c
+++ b/app/test-pmd/rxonly.c
@@ -165,7 +165,7 @@ pkt_burst_receive(struct fwd_stream *fs)
printf(" - FDIR hash=0x%x - FDIR id=0x%x ",
   mb->hash.fdir.hash, mb->hash.fdir.id);
if (ol_flags & PKT_RX_VLAN_PKT)
-   printf(" - VLAN tci=0x%x", mb->vlan_tci);
+   printf(" - VLAN tci0=0x%x", mb->vlan_tci0);
printf("\n");
if (ol_flags != 0) {
int rxf;
diff --git a/app/test-pmd/testpmd.c b/app/test-pmd/testpmd.c
index 5751607..fdf3296 100644
--- a/app/test-pmd/testpmd.c
+++ b/app/test-pmd/testpmd.c
@@ -406,8 +406,8 @@ testpmd_mbuf_ctor(struct rte_mempool *mp,
mb->ol_flags = 0;
mb->data_off = RTE_PKTMBUF_HEADROOM;
mb->nb_segs  = 1;
-   mb->l2_l3_len   = 0;
-   mb->vlan_tci = 0;
+   mb->l2_l3_len= 0;
+   mb->vlan_tci0= 0;
mb->hash.rss = 0;
 }

diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c
index 3d08005..52b2f06 100644
--- a/app/test-pmd/txonly.c
+++ b/app/test-pmd/txonly.c
@@ -264,7 +264,7 @@ pkt_burst_transmit(struct fwd_stream *fs)
pkt->nb_segs = tx_pkt_nb_segs;
pkt->pkt_len = tx_pkt_length;
pkt->ol_flags = ol_flags;
-   pkt->vlan_tci  = vlan_tci;
+   pkt->vlan_tci0 = vlan_tci;
pkt->l2_len = sizeof(struct ether_hdr);
pkt->l3_len = sizeof(struct ipv4_hdr);
pkts_burst[nb_pkt] = pkt;
diff --git a/app/test/packet_burst_generator.c 
b/app/test/packet_burst_generator.c
index 9e747a4..66f2a29 100644
--- a/app/test/packet_burst_generator.c
+++ b/app/test/packet_burst_generator.c
@@ -264,7 +264,7 @@ nomore_mbuf: