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

@@ -11,7 +11,7 @@
* Common functions for the TCP implementation, such as functions
* for manipulating the data structures and the TCP timer functions. TCP functions
* related to input and output is found in tcp_in.c and tcp_out.c respectively.\n
*
*
* TCP connection setup
* --------------------
* The functions used for setting up connections is similar to that of
@@ -24,7 +24,7 @@
* - tcp_listen() and tcp_listen_with_backlog()
* - tcp_accept()
* - tcp_connect()
*
*
* Sending TCP data
* ----------------
* TCP data is sent by enqueueing the data with a call to tcp_write() and
@@ -34,7 +34,7 @@
* - tcp_write()
* - tcp_output()
* - tcp_sent()
*
*
* Receiving TCP data
* ------------------
* TCP data reception is callback based - an application specified
@@ -44,7 +44,7 @@
* window.
* - tcp_recv()
* - tcp_recved()
*
*
* Application polling
* -------------------
* When a connection is idle (i.e., no data is either transmitted or
@@ -62,7 +62,7 @@
* - tcp_close()
* - tcp_abort()
* - tcp_err()
*
*
*/
/*
@@ -469,7 +469,7 @@ tcp_close_shutdown_fin(struct tcp_pcb *pcb)
* a closing state), the connection is closed, and put in a closing state.
* The pcb is then automatically freed in tcp_slowtmr(). It is therefore
* unsafe to reference it (unless an error is returned).
*
*
* The function may return ERR_MEM if no memory
* was available for closing the connection. If so, the application
* should wait and try again either by using the acknowledgment
@@ -797,7 +797,7 @@ tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err)
* When an incoming connection is accepted, the function specified with
* the tcp_accept() function will be called. The pcb has to be bound
* to a local port with the tcp_bind() function.
*
*
* The tcp_listen() function returns a new connection identifier, and
* the one passed as an argument to the function will be
* deallocated. The reason for this behavior is that less memory is
@@ -812,7 +812,7 @@ tcp_accept_null(void *arg, struct tcp_pcb *pcb, err_t err)
* The backlog limits the number of outstanding connections
* in the listen queue to the value specified by the backlog argument.
* To use it, your need to set TCP_LISTEN_BACKLOG=1 in your lwipopts.h.
*
*
* @param pcb the original tcp_pcb
* @param backlog the incoming connections queue limit
* @return tcp_pcb used for listening, consumes less memory.
@@ -892,6 +892,9 @@ tcp_listen_with_backlog_and_err(struct tcp_pcb *pcb, u8_t backlog, err_t *err)
lpcb->netif_idx = NETIF_NO_INDEX;
lpcb->ttl = pcb->ttl;
lpcb->tos = pcb->tos;
#if LWIP_VLAN_PCP
lpcb->netif_hints.tci = pcb->netif_hints.tci;
#endif /* LWIP_VLAN_PCP */
#if LWIP_IPV4 && LWIP_IPV6
IP_SET_TYPE_VAL(lpcb->remote_ip, pcb->local_ip.type);
#endif /* LWIP_IPV4 && LWIP_IPV6 */
@@ -1049,7 +1052,7 @@ again:
* Connects to another host. The function given as the "connected"
* argument will be called when the connection has been established.
* Sets up the pcb to connect to the remote host and sends the
* initial SYN segment which opens the connection.
* initial SYN segment which opens the connection.
*
* The tcp_connect() function returns immediately; it does not wait for
* the connection to be properly setup. Instead, it will call the
@@ -1721,14 +1724,14 @@ tcp_kill_prio(u8_t prio)
mprio = LWIP_MIN(TCP_PRIO_MAX, prio);
/* We want to kill connections with a lower prio, so bail out if
/* We want to kill connections with a lower prio, so bail out if
* supplied prio is 0 - there can never be a lower prio
*/
if (mprio == 0) {
return;
}
/* We only want kill connections with a lower prio, so decrement prio by one
/* We only want kill connections with a lower prio, so decrement prio by one
* and start searching for oldest connection with same or lower priority than mprio.
* We want to find the connections with the lowest possible prio, and among
* these the one with the longest inactivity time.
@@ -2051,7 +2054,7 @@ tcp_sent(struct tcp_pcb *pcb, tcp_sent_fn sent)
* @ingroup tcp_raw
* Used to specify the function that should be called when a fatal error
* has occurred on the connection.
*
*
* If a connection is aborted because of an error, the application is
* alerted of this event by the err callback. Errors that might abort a
* connection are when there is a shortage of memory. The callback
@@ -2101,7 +2104,7 @@ tcp_accept(struct tcp_pcb *pcb, tcp_accept_fn accept)
* number of TCP coarse grained timer shots, which typically occurs
* twice a second. An interval of 10 means that the application would
* be polled every 5 seconds.
*
*
* When a connection is idle (i.e., no data is either transmitted or
* received), lwIP will repeatedly poll the application by calling a
* specified callback function. This can be used either as a watchdog

View File

@@ -690,6 +690,9 @@ tcp_listen_input(struct tcp_pcb_listen *pcb)
#if LWIP_CALLBACK_API || TCP_LISTEN_BACKLOG
npcb->listener = pcb;
#endif /* LWIP_CALLBACK_API || TCP_LISTEN_BACKLOG */
#if LWIP_VLAN_PCP
npcb->netif_hints.tci = pcb->netif_hints.tci;
#endif /* LWIP_VLAN_PCP */
/* inherit socket options */
npcb->so_options = pcb->so_options & SOF_INHERITED;
npcb->netif_idx = pcb->netif_idx;