Implement task #11620: Add outgoing VLAN PCP support for Ethernet level QoS

Apply rebased patch from Timmy Brolin
This commit is contained in:
Dirk Ziegelmeier
2018-10-19 22:30:17 +02:00
parent 64bc2c3df7
commit 95aba99f41
5 changed files with 66 additions and 34 deletions

View File

@@ -248,14 +248,20 @@ typedef u8_t netif_addr_idx_t;
#define NETIF_ADDR_IDX_MAX 0x7F
#endif
#if LWIP_NETIF_HWADDRHINT || LWIP_VLAN_PCP
#define LWIP_NETIF_USE_HINTS 1
struct netif_hint {
#if LWIP_NETIF_HWADDRHINT
#define LWIP_NETIF_USE_HINTS 1
struct netif_hint {
netif_addr_idx_t addr_hint;
};
#else /* LWIP_NETIF_HWADDRHINT */
#define LWIP_NETIF_USE_HINTS 0
#endif /* LWIP_NETIF_HWADDRHINT */
u8_t addr_hint;
#endif
#if LWIP_VLAN_PCP
/** VLAN hader is set if this is >= 0 (but must be <= 0xFFFF) */
s32_t tci;
#endif
};
#else /* LWIP_NETIF_HWADDRHINT || LWIP_VLAN_PCP */
#define LWIP_NETIF_USE_HINTS 0
#endif /* LWIP_NETIF_HWADDRHINT || LWIP_VLAN_PCP*/
/** Generic data structure used for all lwIP network interfaces.
* The following fields should be filled in by the initialization
@@ -348,7 +354,7 @@ struct netif {
u8_t flags;
/** descriptive abbreviation */
char name[2];
/** number of this interface. Used for @ref if_api and @ref netifapi_netif,
/** number of this interface. Used for @ref if_api and @ref netifapi_netif,
* as well as for IPv6 zones */
u8_t num;
#if LWIP_IPV6_AUTOCONFIG

View File

@@ -677,6 +677,18 @@
#define ETHARP_SUPPORT_VLAN 0
#endif
/**
* LWIP_VLAN_PCP==1: Enable outgoing VLAN taggning of frames on a per-PCB basis
* for QoS purposes. With this feature enabled, each PCB has a new variable: "tci".
* (Tag Control Identifier). The TCI contains three fields: VID, CFI and PCP.
* VID is the VLAN ID, which should be set to zero.
* The "CFI" bit is used to enable or disable VLAN tags for the PCB.
* PCP (Priority Code Point) is a 3 bit field used for Ethernet level QoS.
*/
#ifndef LWIP_VLAN_PCP
#define LWIP_VLAN_PCP 0
#endif
/** LWIP_ETHERNET==1: enable ethernet support even though ARP might be disabled
*/
#if !defined LWIP_ETHERNET || defined __DOXYGEN__
@@ -1548,13 +1560,13 @@
* link level header. The default is 14, the standard value for
* Ethernet.
*/
#if !defined PBUF_LINK_HLEN || defined __DOXYGEN__
#if defined LWIP_HOOK_VLAN_SET && !defined __DOXYGEN__
#define PBUF_LINK_HLEN (18 + ETH_PAD_SIZE)
#else /* LWIP_HOOK_VLAN_SET */
#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
#endif /* LWIP_HOOK_VLAN_SET */
#endif
#if !defined PBUF_LINK_HLEN || defined __DOXYGEN__
#if (defined LWIP_HOOK_VLAN_SET || LWIP_VLAN_PCP) && !defined __DOXYGEN__
#define PBUF_LINK_HLEN (18 + ETH_PAD_SIZE)
#else /* LWIP_HOOK_VLAN_SET || LWIP_VLAN_PCP */
#define PBUF_LINK_HLEN (14 + ETH_PAD_SIZE)
#endif /* LWIP_HOOK_VLAN_SET || LWIP_VLAN_PCP */
#endif
/**
* PBUF_LINK_ENCAPSULATION_HLEN: the number of bytes that should be allocated
@@ -1626,7 +1638,7 @@
#endif
/**
* LWIP_NETIF_EXT_STATUS_CALLBACK==1: Support an extended callback function
* LWIP_NETIF_EXT_STATUS_CALLBACK==1: Support an extended callback function
* for several netif related event that supports multiple subscribers.
* @see netif_ext_status_callback
*/
@@ -2423,7 +2435,7 @@
* All addresses that have a scope according to the default policy (link-local
* unicast addresses, interface-local and link-local multicast addresses) should
* now have a zone set on them before being passed to the core API, although
* lwIP will currently attempt to select a zone on the caller's behalf when
* lwIP will currently attempt to select a zone on the caller's behalf when
* necessary. Applications that directly assign IPv6 addresses to interfaces
* (which is NOT recommended) must now ensure that link-local addresses carry
* the netif's zone. See the new ip6_zone.h header file for more information and
@@ -3061,8 +3073,8 @@
* - src: source eth address
* - dst: destination eth address
* - eth_type: ethernet type to packet to be sent\n
*
*
*
*
* Return values:
* - &lt;0: Packet shall not contain VLAN header.
* - 0 &lt;= return value &lt;= 0xFFFF: Packet shall contain VLAN header. Return value is prio_vid in host byte order.