summaryrefslogtreecommitdiffstats
path: root/src/pal
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2017-02-15 17:17:18 +0200
committerIdo Barnea <ibarnea@cisco.com>2017-02-16 15:38:30 +0200
commitaf52e17f717ee272577bcaa3524b272531752423 (patch)
treed6e05ad8e24629776549da98910d43801295e9f3 /src/pal
parent76338aa3565f381df1f415b10d3d22bb5b8d71b6 (diff)
VLAN keyword in platform config file will now make all traffic be sent over vlan
Signed-off-by: Ido Barnea <ibarnea@cisco.com>
Diffstat (limited to 'src/pal')
-rw-r--r--src/pal/common/common_mbuf.h6
-rwxr-xr-xsrc/pal/linux/mbuf.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/src/pal/common/common_mbuf.h b/src/pal/common/common_mbuf.h
index c52842bd..3816d203 100644
--- a/src/pal/common/common_mbuf.h
+++ b/src/pal/common/common_mbuf.h
@@ -17,6 +17,12 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
+static inline void add_vlan(rte_mbuf_t *m, uint16_t vlan_id) {
+ m->ol_flags = PKT_TX_VLAN_PKT;
+ m->l2_len = 14;
+ m->vlan_tci = vlan_id;
+}
+
static inline rte_mbuf_t * utl_rte_pktmbuf_add_after2(rte_mbuf_t *m1,rte_mbuf_t *m2){
utl_rte_pktmbuf_check(m1);
utl_rte_pktmbuf_check(m2);
diff --git a/src/pal/linux/mbuf.h b/src/pal/linux/mbuf.h
index 2996b514..17b7c7ad 100755
--- a/src/pal/linux/mbuf.h
+++ b/src/pal/linux/mbuf.h
@@ -32,6 +32,7 @@ typedef struct rte_mbuf rte_mbuf_t;
#define MAGIC2 0x11223344
#define IND_ATTACHED_MBUF (1ULL << 62) /**< Indirect attached mbuf */
+#define PKT_TX_VLAN_PKT (1ULL << 57) /**< TX packet is a 802.1q VLAN packet. */
#define RTE_MBUF_INDIRECT(mb) ((mb)->ol_flags & IND_ATTACHED_MBUF)
#define RTE_MBUF_TO_BADDR(mb) (((struct rte_mbuf *)(mb)) + 1)
#define RTE_MBUF_FROM_BADDR(ba) (((struct rte_mbuf *)(ba)) - 1)
@@ -65,6 +66,7 @@ struct rte_mbuf {
uint64_t ol_flags; /**< Offload features. */
uint16_t l2_len;
uint16_t l3_len;
+ uint16_t vlan_tci;
} ;
typedef struct rte_mempool rte_mempool_t;