net: add MPLS header structure

Add the Mpls header structure in librte_net. It will be used by next
patch that adds the support of Mpls L2 layer in the software packet
type parser.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Olivier Matz 2018-10-23 09:46:48 +02:00 committed by Ferruh Yigit
parent 1193403422
commit e480cf487a
3 changed files with 45 additions and 2 deletions

View File

@ -20,6 +20,6 @@ SRCS-$(CONFIG_RTE_LIBRTE_NET) += rte_arp.c
SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include := rte_ip.h rte_tcp.h rte_udp.h rte_esp.h
SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_sctp.h rte_icmp.h rte_arp.h
SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_ether.h rte_gre.h rte_net.h
SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h
SYMLINK-$(CONFIG_RTE_LIBRTE_NET)-include += rte_net_crc.h rte_mpls.h
include $(RTE_SDK)/mk/rte.lib.mk

View File

@ -13,7 +13,8 @@ headers = files('rte_ip.h',
'rte_ether.h',
'rte_gre.h',
'rte_net.h',
'rte_net_crc.h')
'rte_net_crc.h',
'rte_mpls.h')
sources = files('rte_arp.c', 'rte_net.c', 'rte_net_crc.c')
deps += ['mbuf']

42
lib/librte_net/rte_mpls.h Normal file
View File

@ -0,0 +1,42 @@
/* SPDX-License-Identifier: BSD-3-Clause
* Copyright(c) 2016 6WIND S.A.
*/
#ifndef _RTE_MPLS_H_
#define _RTE_MPLS_H_
/**
* @file
*
* MPLS-related defines
*/
#include <stdint.h>
#include <rte_byteorder.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* MPLS header.
*/
struct mpls_hdr {
uint16_t tag_msb; /**< Label(msb). */
#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN
uint8_t tag_lsb:4; /**< Label(lsb). */
uint8_t tc:3; /**< Traffic class. */
uint8_t bs:1; /**< Bottom of stack. */
#else
uint8_t bs:1; /**< Bottom of stack. */
uint8_t tc:3; /**< Traffic class. */
uint8_t tag_lsb:4; /**< label(lsb) */
#endif
uint8_t ttl; /**< Time to live. */
} __attribute__((__packed__));
#ifdef __cplusplus
}
#endif
#endif /* RTE_MPLS_H_ */