Networking: Get rid of the tcp_mss macro. It is confusing and only obfuscates what is really going on

This commit is contained in:
Gregory Nutt 2015-08-27 08:39:17 -06:00
parent 007aabc46f
commit 3bcdb218ff
7 changed files with 14 additions and 20 deletions

2
arch

@ -1 +1 @@
Subproject commit 5336c646386607424e3426fb488d73241abb5f08
Subproject commit 3077bd096b77a5a49ff80cc460dc024fe69cb078

View File

@ -102,7 +102,7 @@ config NET_SLIP_MTU
bytes of data: 40 + 128. I believe that is to allow for the 2x
worst cast packet expansion. Ideally we would like to advertise the
256 MSS, but restrict transfers to 128 bytes (possibly by modifying
the tcp_mss() macro).
the MSS value in the TCP connection structure).
config NET_SLIP_TCP_RECVWNDO

View File

@ -423,8 +423,8 @@ uint16_t devif_dev_event(FAR struct net_driver_s *dev, void *pvconn,
* The amount of data that actually is sent out after a call to this
* function is determined by the maximum amount of data TCP allows. uIP
* will automatically crop the data so that only the appropriate
* amount of data is sent. The function tcp_mss() can be used to query
* uIP for the amount of data that actually will be sent.
* amount of data is sent. The mss field of the TCP connection structure
* can be used to determine the amount of data that actually will be sent.
*
* Note: This function does not guarantee that the sent data will
* arrive at the destination. If the data is lost in the network, the

View File

@ -354,9 +354,9 @@ static uint16_t sendfile_interrupt(FAR struct net_driver_s *dev, FAR void *pvcon
uint32_t sndlen = pstate->snd_flen - pstate->snd_sent;
if (sndlen > tcp_mss(conn))
if (sndlen > conn->mss)
{
sndlen = tcp_mss(conn);
sndlen = conn->mss;
}
/* Check if we have "space" in the window */

View File

@ -101,12 +101,6 @@
devif_conn_callback_free(g_netdevices, cb, NULL)
#endif
/* Get the current maximum segment size that can be sent on the current
* TCP connection.
*/
#define tcp_mss(conn) ((conn)->mss)
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
/* TCP write buffer access macros */

View File

@ -697,9 +697,9 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev,
*/
sndlen = WRB_PKTLEN(wrb) - WRB_SENT(wrb);
if (sndlen > tcp_mss(conn))
if (sndlen > conn->mss)
{
sndlen = tcp_mss(conn);
sndlen = conn->mss;
}
if (sndlen > conn->winsize)

View File

@ -442,12 +442,12 @@ static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev,
if (sndlen >= CONFIG_NET_TCP_SPLIT_SIZE)
{
/* sndlen is the number of bytes remaining to be sent.
* tcp_mss(conn) will return the number of bytes that can sent
* conn->mss will provide the number of bytes that can sent
* in one packet. The difference, then, is the number of bytes
* that would be sent in the next packet after this one.
*/
int32_t next_sndlen = sndlen - tcp_mss(conn);
int32_t next_sndlen = sndlen - conn->mss;
/* Is this the even packet in the packet pair transaction? */
@ -474,13 +474,13 @@ static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev,
{
/* Will there be another (even) packet afer this one?
* (next_sndlen > 0) Will the split condition occur on that
* next, even packet? ((next_sndlen - tcp_mss(conn)) < 0) If
* next, even packet? ((next_sndlen - conn->mss) < 0) If
* so, then perform the split now to avoid the case where the
* byte count is less than CONFIG_NET_TCP_SPLIT_SIZE on the
* next pair.
*/
if (next_sndlen > 0 && (next_sndlen - tcp_mss(conn)) < 0)
if (next_sndlen > 0 && (next_sndlen - conn->mss) < 0)
{
/* Here, we know that sndlen must be MSS < sndlen <= 2*MSS
* and so (sndlen / 2) is <= MSS.
@ -497,9 +497,9 @@ static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev,
#endif /* CONFIG_NET_TCP_SPLIT */
if (sndlen > tcp_mss(conn))
if (sndlen > conn->mss)
{
sndlen = tcp_mss(conn);
sndlen = conn->mss;
}
/* Check if we have "space" in the window */