net/: Fix alignment and spacing problems found by tools/nxstyle.

This commit is contained in:
Gregory Nutt
2019-07-02 18:02:23 -06:00
parent 7b554d6665
commit 1346f29151
42 changed files with 198 additions and 194 deletions
+7 -7
View File
@@ -82,15 +82,15 @@ static void arp_send_terminate(FAR struct arp_send_s *state, int result)
{ {
/* Don't allow any further call backs. */ /* Don't allow any further call backs. */
state->snd_sent = true; state->snd_sent = true;
state->snd_result = (int16_t)result; state->snd_result = (int16_t)result;
state->snd_cb->flags = 0; state->snd_cb->flags = 0;
state->snd_cb->priv = NULL; state->snd_cb->priv = NULL;
state->snd_cb->event = NULL; state->snd_cb->event = NULL;
/* Wake up the waiting thread */ /* Wake up the waiting thread */
nxsem_post(&state->snd_sem); nxsem_post(&state->snd_sem);
} }
/**************************************************************************** /****************************************************************************
+3 -3
View File
@@ -167,10 +167,10 @@ FAR struct bluetooth_container_s *bluetooth_container_allocate(void)
if (container != NULL) if (container != NULL)
{ {
/* Zero and tag the allocated meta-data structure. */ /* Zero and tag the allocated meta-data structure. */
memset(container, 0, sizeof(struct bluetooth_container_s)); memset(container, 0, sizeof(struct bluetooth_container_s));
container->bn_pool = pool; container->bn_pool = pool;
} }
return container; return container;
+15 -15
View File
@@ -146,28 +146,28 @@ static int bluetooth_queue_frame(FAR struct bluetooth_conn_s *conn,
if (conn->bc_backlog >= CONFIG_NET_BLUETOOTH_BACKLOG) if (conn->bc_backlog >= CONFIG_NET_BLUETOOTH_BACKLOG)
{ {
DEBUGASSERT(conn->bc_backlog == CONFIG_NET_BLUETOOTH_BACKLOG); DEBUGASSERT(conn->bc_backlog == CONFIG_NET_BLUETOOTH_BACKLOG);
/* Remove the container from the tail RX input queue. */ /* Remove the container from the tail RX input queue. */
container = conn->bc_rxhead; container = conn->bc_rxhead;
DEBUGASSERT(container != NULL); DEBUGASSERT(container != NULL);
conn->bc_rxhead = container->bn_flink; conn->bc_rxhead = container->bn_flink;
container->bn_flink = NULL; container->bn_flink = NULL;
/* Did the RX queue become empty? */ /* Did the RX queue become empty? */
if (conn->bc_rxhead == NULL) if (conn->bc_rxhead == NULL)
{ {
conn->bc_rxtail = NULL; conn->bc_rxtail = NULL;
} }
DEBUGASSERT(container != NULL && container->bn_iob != NULL); DEBUGASSERT(container != NULL && container->bn_iob != NULL);
/* Free both the IOB and the container */ /* Free both the IOB and the container */
iob_free(container->bn_iob); iob_free(container->bn_iob);
bluetooth_container_free(container); bluetooth_container_free(container);
} }
else else
{ {
+4 -4
View File
@@ -163,11 +163,11 @@ static ssize_t bluetooth_recvfrom_rxqueue(FAR struct radio_driver_s *radio,
} }
#if CONFIG_NET_BLUETOOTH_BACKLOG > 0 #if CONFIG_NET_BLUETOOTH_BACKLOG > 0
/* Decrement the count of frames in the queue. */ /* Decrement the count of frames in the queue. */
DEBUGASSERT(conn->bc_backlog > 0); DEBUGASSERT(conn->bc_backlog > 0);
conn->bc_backlog--; conn->bc_backlog--;
DEBUGASSERT((int)conn->bc_backlog == bluetooth_count_frames(conn)); DEBUGASSERT((int)conn->bc_backlog == bluetooth_count_frames(conn));
#endif #endif
/* Extract the IOB containing the frame from the container */ /* Extract the IOB containing the frame from the container */
+3 -3
View File
@@ -167,10 +167,10 @@ FAR struct ieee802154_container_s *ieee802154_container_allocate(void)
if (container != NULL) if (container != NULL)
{ {
/* Zero and tag the allocated meta-data structure. */ /* Zero and tag the allocated meta-data structure. */
memset(container, 0, sizeof(struct ieee802154_container_s)); memset(container, 0, sizeof(struct ieee802154_container_s));
container->ic_pool = pool; container->ic_pool = pool;
} }
return container; return container;
+9 -9
View File
@@ -154,8 +154,8 @@ static int ieee802154_queue_frame(FAR struct ieee802154_conn_s *conn,
* delete the oldest frame from the head of the RX queue. * delete the oldest frame from the head of the RX queue.
*/ */
if (conn->backlog >= CONFIG_NET_IEEE802154_BACKLOG) if (conn->backlog >= CONFIG_NET_IEEE802154_BACKLOG)
{ {
DEBUGASSERT(conn->backlog == CONFIG_NET_IEEE802154_BACKLOG); DEBUGASSERT(conn->backlog == CONFIG_NET_IEEE802154_BACKLOG);
/* Remove the container from the tail RX input queue. */ /* Remove the container from the tail RX input queue. */
@@ -178,15 +178,15 @@ static int ieee802154_queue_frame(FAR struct ieee802154_conn_s *conn,
iob_free(container->ic_iob); iob_free(container->ic_iob);
ieee802154_container_free(container); ieee802154_container_free(container);
} }
else else
{ {
/* Increment the count of frames in the queue. */ /* Increment the count of frames in the queue. */
conn->backlog++; conn->backlog++;
} }
DEBUGASSERT((int)conn->backlog == ieee802154_count_frames(conn)); DEBUGASSERT((int)conn->backlog == ieee802154_count_frames(conn));
#endif #endif
return OK; return OK;
+4 -4
View File
@@ -161,11 +161,11 @@ static ssize_t ieee802154_recvfrom_rxqueue(FAR struct radio_driver_s *radio,
} }
#if CONFIG_NET_IEEE802154_BACKLOG > 0 #if CONFIG_NET_IEEE802154_BACKLOG > 0
/* Decrement the count of frames in the queue. */ /* Decrement the count of frames in the queue. */
DEBUGASSERT(conn->backlog > 0); DEBUGASSERT(conn->backlog > 0);
conn->backlog--; conn->backlog--;
DEBUGASSERT((int)conn->backlog == ieee802154_count_frames(conn)); DEBUGASSERT((int)conn->backlog == ieee802154_count_frames(conn));
#endif #endif
/* Extract the IOB containing the frame from the container */ /* Extract the IOB containing the frame from the container */
+1 -1
View File
@@ -291,7 +291,7 @@ static inline int tcp_close_disconnect(FAR struct socket *psock)
ret = clock_gettime(CLOCK_REALTIME, &abstime); ret = clock_gettime(CLOCK_REALTIME, &abstime);
if (ret >= 0) if (ret >= 0)
{ {
/* NOTE: s_linger's unit is deciseconds so we don't need to update /* NOTE: s_linger's unit is deciseconds so we don't need to update
* abstime.tv_nsec here. * abstime.tv_nsec here.
*/ */
+1 -1
View File
@@ -255,7 +255,7 @@ static inline void inet_tcp_newdata(FAR struct net_driver_s *dev,
#else #else
nerr("ERROR: packet data lost (%d bytes)\n", dev->d_len - recvlen); nerr("ERROR: packet data lost (%d bytes)\n", dev->d_len - recvlen);
#endif #endif
} }
/* Indicate no data in the buffer */ /* Indicate no data in the buffer */
+2 -2
View File
@@ -96,8 +96,8 @@ int ipv6_getpeername(FAR struct socket *psock, FAR struct sockaddr *addr,
* been implemented. * been implemented.
*/ */
return -ENOSYS; return -ENOSYS;
} }
/* Verify that the socket has been connected */ /* Verify that the socket has been connected */
+2 -2
View File
@@ -97,8 +97,8 @@ int ipv6_getsockname(FAR struct socket *psock, FAR struct sockaddr *addr,
* been implemented. * been implemented.
*/ */
return -ENOSYS; return -ENOSYS;
} }
/* Set the port number */ /* Set the port number */
+1 -1
View File
@@ -307,7 +307,7 @@ static int ipv6_packet_conversion(FAR struct net_driver_s *dev,
} }
} }
/* The packet was not forwarded (or the HOP limit was exceeded) */ /* The packet was not forwarded (or the HOP limit was exceeded) */
ipv6_dropstats(ipv6); ipv6_dropstats(ipv6);
return ret; return ret;
+2 -2
View File
@@ -118,9 +118,9 @@ ssize_t psock_local_sendto(FAR struct socket *psock, FAR const void *buf,
if (tolen < sizeof(sa_family_t) + 2) if (tolen < sizeof(sa_family_t) + 2)
{ {
/* EFAULT - An invalid user space address was specified for a parameter */ /* EFAULT - An invalid user space address was specified for a parameter */
return -EFAULT; return -EFAULT;
} }
/* Make sure that half duplex FIFO has been created. /* Make sure that half duplex FIFO has been created.
+2 -2
View File
@@ -106,7 +106,7 @@ FAR struct net_driver_s *netdev_findbyindex(int ifindex)
* registered. * registered.
*/ */
if (dev->d_ifindex == ifindex) if (dev->d_ifindex == ifindex)
#else #else
/* NOTE that this option is not a safe way to enumerate network /* NOTE that this option is not a safe way to enumerate network
* devices: There could be changes to the list of registered device * devices: There could be changes to the list of registered device
@@ -165,7 +165,7 @@ int netdev_nextindex(int ifindex)
net_unlock(); net_unlock();
return ifindex + 1; return ifindex + 1;
} }
} }
net_unlock(); net_unlock();
+4 -4
View File
@@ -144,9 +144,9 @@ static int ifconf_ipv4_callback(FAR struct net_driver_s *dev, FAR void *arg)
net_ipv4addr_copy(inaddr->sin_addr.s_addr, dev->d_ipaddr); net_ipv4addr_copy(inaddr->sin_addr.s_addr, dev->d_ipaddr);
} }
/* Increment the size of the buffer in any event */ /* Increment the size of the buffer in any event */
ifc->ifc_len += sizeof(struct ifreq); ifc->ifc_len += sizeof(struct ifreq);
} }
return 0; return 0;
@@ -221,9 +221,9 @@ static int ifconf_ipv6_callback(FAR struct net_driver_s *dev, FAR void *arg)
net_ipv6addr_copy(inaddr->sin6_addr.s6_addr16, dev->d_ipv6addr); net_ipv6addr_copy(inaddr->sin6_addr.s6_addr16, dev->d_ipv6addr);
} }
/* Increment the size of the buffer in any event */ /* Increment the size of the buffer in any event */
lifc->lifc_len += sizeof(struct lifreq); lifc->lifc_len += sizeof(struct lifreq);
} }
return 0; return 0;
+2 -2
View File
@@ -153,9 +153,9 @@ int netdev_unregister(FAR struct net_driver_s *dev)
} }
else else
{ {
/* The entry was at the beginning of the list */ /* The entry was at the beginning of the list */
g_netdevices = curr->flink; g_netdevices = curr->flink;
} }
curr->flink = NULL; curr->flink = NULL;
+2 -2
View File
@@ -425,10 +425,10 @@ static int netprocfs_retransmissions(FAR struct netprocfs_file_s *netfile)
len += snprintf(&netfile->line[len], NET_LINELEN - len, " ----"); len += snprintf(&netfile->line[len], NET_LINELEN - len, " ----");
#endif #endif
#ifdef CONFIG_NET_ICMP #ifdef CONFIG_NET_ICMP
len += snprintf(&netfile->line[len], NET_LINELEN - len, " ----"); len += snprintf(&netfile->line[len], NET_LINELEN - len, " ----");
#endif #endif
#ifdef CONFIG_NET_ICMPv6 #ifdef CONFIG_NET_ICMPv6
len += snprintf(&netfile->line[len], NET_LINELEN - len, " ----"); len += snprintf(&netfile->line[len], NET_LINELEN - len, " ----");
#endif #endif
len += snprintf(&netfile->line[len], NET_LINELEN - len, "\n"); len += snprintf(&netfile->line[len], NET_LINELEN - len, "\n");
+4 -4
View File
@@ -90,8 +90,8 @@ int net_addroute_ipv4(in_addr_t target, in_addr_t netmask, in_addr_t router)
ret = net_openroute_ipv4(O_WRONLY | O_APPEND | O_CREAT, &fshandle); ret = net_openroute_ipv4(O_WRONLY | O_APPEND | O_CREAT, &fshandle);
if (ret < 0) if (ret < 0)
{ {
nerr("ERROR: Could not open IPv4 routing table: %d\n", ret); nerr("ERROR: Could not open IPv4 routing table: %d\n", ret);
return ret; return ret;
} }
/* Then append the new entry to the end of the routing table */ /* Then append the new entry to the end of the routing table */
@@ -124,8 +124,8 @@ int net_addroute_ipv6(net_ipv6addr_t target, net_ipv6addr_t netmask,
ret = net_openroute_ipv6(O_WRONLY | O_APPEND | O_CREAT, &fshandle); ret = net_openroute_ipv6(O_WRONLY | O_APPEND | O_CREAT, &fshandle);
if (ret < 0) if (ret < 0)
{ {
nerr("ERROR: Could not open IPv6 routing table: %d\n", ret); nerr("ERROR: Could not open IPv6 routing table: %d\n", ret);
return ret; return ret;
} }
/* Then append the new entry to the end of the routing table */ /* Then append the new entry to the end of the routing table */
+1 -1
View File
@@ -161,7 +161,7 @@ static sem_t g_ipv6_cachelock;
#endif #endif
/**************************************************************************** /****************************************************************************
* Public Function Prototypes * Public Functions
****************************************************************************/ ****************************************************************************/
/**************************************************************************** /****************************************************************************
+6 -6
View File
@@ -206,8 +206,8 @@ int net_delroute_ipv4(in_addr_t target, in_addr_t netmask)
ret = net_lockroute_ipv4(); ret = net_lockroute_ipv4();
if (ret < 0) if (ret < 0)
{ {
nerr("ERROR: net_lockroute_ipv4 failed: %d\n", ret); nerr("ERROR: net_lockroute_ipv4 faled: %d\n", ret);
return ret; return ret;
} }
/* Get the size of the routing table (in entries) */ /* Get the size of the routing table (in entries) */
@@ -252,8 +252,8 @@ int net_delroute_ipv4(in_addr_t target, in_addr_t netmask)
ret = net_openroute_ipv4(O_RDWR, &fshandle); ret = net_openroute_ipv4(O_RDWR, &fshandle);
if (ret < 0) if (ret < 0)
{ {
nerr("ERROR: Could not open IPv4 routing table: %d\n", ret); nerr("ERROR: Could not open IPv4 routing table: %d\n", ret);
goto errout_with_lock; goto errout_with_lock;
} }
#ifdef CONFIG_ROUTE_IPv4_CACHEROUTE #ifdef CONFIG_ROUTE_IPv4_CACHEROUTE
@@ -354,8 +354,8 @@ int net_delroute_ipv6(net_ipv6addr_t target, net_ipv6addr_t netmask)
ret = net_lockroute_ipv6(); ret = net_lockroute_ipv6();
if (ret < 0) if (ret < 0)
{ {
nerr("ERROR: net_lockroute_ipv6 failed: %d\n", ret); nerr("ERROR: net_lockroute_ipv6 failed: %d\n", ret);
return ret; return ret;
} }
/* Get the size of the routing table (in entries) */ /* Get the size of the routing table (in entries) */
+1 -1
View File
@@ -517,7 +517,7 @@ ssize_t net_writeroute_ipv6(FAR struct file *filep,
ntotal = nwritten; ntotal = nwritten;
break; break;
} }
ntotal += nwritten; ntotal += nwritten;
src += nwritten; src += nwritten;
+18 -18
View File
@@ -90,18 +90,18 @@ int net_foreachroute_ipv4(route_handler_ipv4_t handler, FAR void *arg)
* the traversal. * the traversal.
*/ */
if (ret == -ENOENT) if (ret == -ENOENT)
{ {
/* The routing table does not exit.. return successful completion */ /* The routing table does not exit.. return successful completion */
ninfo("The IPv4 routing table file does not exist\n"); ninfo("The IPv4 routing table file does not exist\n");
return OK; return OK;
} }
/* Some other error occurred. */ /* Some other error occurred. */
nerr("ERROR: Could not open IPv4 routing table: %d\n", ret); nerr("ERROR: Could not open IPv4 routing table: %d\n", ret);
return ret; return ret;
} }
/* Read each entry from the routing table */ /* Read each entry from the routing table */
@@ -159,18 +159,18 @@ int net_foreachroute_ipv6(route_handler_ipv6_t handler, FAR void *arg)
* the traversal. * the traversal.
*/ */
if (ret == -ENOENT) if (ret == -ENOENT)
{ {
/* The routing table does not exit.. return successful completion */ /* The routing table does not exit.. return successful completion */
ninfo("The IPv6 routing table file does not exist\n"); ninfo("The IPv6 routing table file does not exist\n");
return OK; return OK;
} }
/* Some other error occurred. */ /* Some other error occurred. */
nerr("ERROR: Could not open IPv6 routing table: %d\n", ret); nerr("ERROR: Could not open IPv6 routing table: %d\n", ret);
return ret; return ret;
} }
/* Read each entry from the routing table */ /* Read each entry from the routing table */
+27 -27
View File
@@ -151,40 +151,40 @@ static uint16_t sixlowpan_protosize(FAR const struct ipv6_hdr_s *ipv6hdr,
/* Copy the following protocol header, */ /* Copy the following protocol header, */
switch (ipv6hdr->proto) switch (ipv6hdr->proto)
{ {
#ifdef CONFIG_NET_TCP #ifdef CONFIG_NET_TCP
case IP_PROTO_TCP: case IP_PROTO_TCP:
{ {
FAR struct tcp_hdr_s *tcp = FAR struct tcp_hdr_s *tcp =
&((FAR struct ipv6tcp_hdr_s *)ipv6hdr)->tcp; &((FAR struct ipv6tcp_hdr_s *)ipv6hdr)->tcp;
/* The TCP header length is encoded in the top 4 bits of the /* The TCP header length is encoded in the top 4 bits of the
* tcpoffset field (in units of 32-bit words). * tcpoffset field (in units of 32-bit words).
*/ */
protosize = ((uint16_t)tcp->tcpoffset >> 4) << 2; protosize = ((uint16_t)tcp->tcpoffset >> 4) << 2;
} }
break; break;
#endif #endif
#ifdef CONFIG_NET_UDP #ifdef CONFIG_NET_UDP
case IP_PROTO_UDP: case IP_PROTO_UDP:
protosize = UDP_HDRLEN; protosize = UDP_HDRLEN;
break; break;
#endif #endif
#ifdef CONFIG_NET_ICMPv6 #ifdef CONFIG_NET_ICMPv6
case IP_PROTO_ICMP6: case IP_PROTO_ICMP6:
protosize = ICMPv6_HDRLEN; protosize = ICMPv6_HDRLEN;
break; break;
#endif #endif
default: default:
nwarn("WARNING: Unrecognized proto: %u\n", ipv6hdr->proto); nwarn("WARNING: Unrecognized proto: %u\n", ipv6hdr->proto);
protosize = 0; protosize = 0;
break; break;
} }
return protosize; return protosize;
} }
@@ -495,8 +495,8 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
ret = sixlowpan_radio_framelen(radio); ret = sixlowpan_radio_framelen(radio);
if (ret < 0) if (ret < 0)
{ {
nerr("ERROR: sixlowpan_radio_framelen() failed: %d\n", ret); nerr("ERROR: sixlowpan_radio_framelen() failed: %d\n", ret);
return ret; return ret;
} }
/* Limit to the maximum size supported by the IOBs */ /* Limit to the maximum size supported by the IOBs */
@@ -513,8 +513,8 @@ int sixlowpan_queue_frames(FAR struct radio_driver_s *radio,
ret -= SIXLOWPAN_MAC_FCSSIZE; ret -= SIXLOWPAN_MAC_FCSSIZE;
if (ret < MAX_MACHDR || ret > UINT16_MAX) if (ret < MAX_MACHDR || ret > UINT16_MAX)
{ {
nerr("ERROR: Invalid frame size: %d\n", ret); nerr("ERROR: Invalid frame size: %d\n", ret);
return ret; return ret;
} }
framelen = (uint16_t)ret; framelen = (uint16_t)ret;
+4 -4
View File
@@ -457,11 +457,11 @@ static uint16_t tcp_send_eventhandler(FAR struct net_driver_s *dev,
DEBUGASSERT(psock != NULL); DEBUGASSERT(psock != NULL);
if (_SS_ISCONNECTED(psock->s_flags)) if (_SS_ISCONNECTED(psock->s_flags))
{ {
/* Report the disconnection event to all socket clones */ /* Report the disconnection event to all socket clones */
tcp_lost_connection(psock, sinfo->s_cb, flags); tcp_lost_connection(psock, sinfo->s_cb, flags);
} }
/* Report not connected to the sender */ /* Report not connected to the sender */
+1 -1
View File
@@ -186,5 +186,5 @@ int net_fstat(int sockfd, FAR struct stat *buf)
break; break;
} }
return ret; return ret;
} }
+4 -4
View File
@@ -174,10 +174,10 @@ int sockfd_allocate(int minsd)
* as the socket descriptor. * as the socket descriptor.
*/ */
memset(&list->sl_sockets[i], 0, sizeof(struct socket)); memset(&list->sl_sockets[i], 0, sizeof(struct socket));
list->sl_sockets[i].s_crefs = 1; list->sl_sockets[i].s_crefs = 1;
_net_semgive(list); _net_semgive(list);
return i + __SOCKFD_OFFSET; return i + __SOCKFD_OFFSET;
} }
} }
+1 -1
View File
@@ -193,7 +193,7 @@ static int accept_eventhandler(FAR struct tcp_conn_s *listener,
listener->accept_private = NULL; listener->accept_private = NULL;
listener->accept = NULL; listener->accept = NULL;
ret = OK; ret = OK;
} }
return ret; return ret;
} }
+18 -18
View File
@@ -179,30 +179,30 @@ int tcp_backlogdestroy(FAR struct tcp_conn_s *conn)
if (conn->backlog) if (conn->backlog)
{ {
/* Remove the backlog structure reference from the connection */ /* Remove the backlog structure reference from the connection */
blg = conn->backlog; blg = conn->backlog;
conn->backlog = NULL; conn->backlog = NULL;
/* Handle any pending connections in the backlog */ /* Handle any pending connections in the backlog */
while ((blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&blg->bl_pending)) != NULL) while ((blc = (FAR struct tcp_blcontainer_s *)sq_remfirst(&blg->bl_pending)) != NULL)
{ {
blconn = blc->bc_conn; blconn = blc->bc_conn;
if (blconn) if (blconn)
{ {
/* REVISIT -- such connections really need to be gracefully closed */ /* REVISIT -- such connections really need to be gracefully closed */
blconn->blparent = NULL; blconn->blparent = NULL;
blconn->backlog = NULL; blconn->backlog = NULL;
blconn->crefs = 0; blconn->crefs = 0;
tcp_free(blconn); tcp_free(blconn);
} }
} }
/* Then free the entire backlog structure */ /* Then free the entire backlog structure */
kmm_free(blg); kmm_free(blg);
} }
return OK; return OK;
+4 -4
View File
@@ -548,13 +548,13 @@ found:
conn->rto = (conn->sa >> 3) + conn->sv; conn->rto = (conn->sa >> 3) + conn->sv;
} }
/* Set the acknowledged flag. */ /* Set the acknowledged flag. */
flags |= TCP_ACKDATA; flags |= TCP_ACKDATA;
/* Reset the retransmission timer. */ /* Reset the retransmission timer. */
conn->timer = conn->rto; conn->timer = conn->rto;
} }
/* Do different things depending on in what state the connection is. */ /* Do different things depending on in what state the connection is. */
+1 -1
View File
@@ -286,7 +286,7 @@ int tcp_accept_connection(FAR struct net_driver_s *dev,
if (listener->accept) if (listener->accept)
{ {
/* Yes.. accept the connection */ /* Yes.. accept the connection */
ret = listener->accept(listener, conn); ret = listener->accept(listener, conn);
} }
+3 -3
View File
@@ -641,9 +641,9 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
return flags; return flags;
} }
/* Check if we are being asked to retransmit data */ /* Check if we are being asked to retransmit data */
else if ((flags & TCP_REXMIT) != 0) else if ((flags & TCP_REXMIT) != 0)
{ {
FAR struct tcp_wrbuffer_s *wrb; FAR struct tcp_wrbuffer_s *wrb;
FAR sq_entry_t *entry; FAR sq_entry_t *entry;
@@ -872,7 +872,7 @@ static uint16_t psock_send_eventhandler(FAR struct net_driver_s *dev,
* be set for this write buffer. * be set for this write buffer.
*/ */
if (TCP_WBSEQNO(wrb) == (unsigned)-1) if (TCP_WBSEQNO(wrb) == (unsigned)-1)
{ {
TCP_WBSEQNO(wrb) = conn->isn + conn->sent; TCP_WBSEQNO(wrb) = conn->isn + conn->sent;
} }
+4 -4
View File
@@ -472,11 +472,11 @@ static uint16_t tcpsend_eventhandler(FAR struct net_driver_s *dev,
DEBUGASSERT(psock != NULL); DEBUGASSERT(psock != NULL);
if (_SS_ISCONNECTED(psock->s_flags)) if (_SS_ISCONNECTED(psock->s_flags))
{ {
/* Report not connected */ /* Report not connected */
tcp_lost_connection(psock, pstate->snd_cb, flags); tcp_lost_connection(psock, pstate->snd_cb, flags);
} }
pstate->snd_sent = -ENOTCONN; pstate->snd_sent = -ENOTCONN;
goto end_wait; goto end_wait;
+8 -8
View File
@@ -234,11 +234,11 @@ static uint16_t ack_eventhandler(FAR struct net_driver_s *dev,
DEBUGASSERT(psock != NULL); DEBUGASSERT(psock != NULL);
if (_SS_ISCONNECTED(psock->s_flags)) if (_SS_ISCONNECTED(psock->s_flags))
{ {
/* Report not connected */ /* Report not connected */
tcp_lost_connection(psock, pstate->snd_ackcb, flags); tcp_lost_connection(psock, pstate->snd_ackcb, flags);
} }
/* Report not connected */ /* Report not connected */
@@ -377,11 +377,11 @@ static uint16_t sendfile_eventhandler(FAR struct net_driver_s *dev,
DEBUGASSERT(psock != NULL); DEBUGASSERT(psock != NULL);
if (_SS_ISCONNECTED(psock->s_flags)) if (_SS_ISCONNECTED(psock->s_flags))
{ {
/* Report not connected */ /* Report not connected */
tcp_lost_connection(psock, pstate->snd_datacb, flags); tcp_lost_connection(psock, pstate->snd_datacb, flags);
} }
/* Report not connected */ /* Report not connected */
+5 -5
View File
@@ -103,11 +103,11 @@ uint32_t tcp_getsequence(FAR uint8_t *seqno)
/* Combine the sequence number from network (big-endian) order */ /* Combine the sequence number from network (big-endian) order */
value = (uint32_t)seqno[0] << 24 | value = (uint32_t)seqno[0] << 24 |
(uint32_t)seqno[1] << 16 | (uint32_t)seqno[1] << 16 |
(uint32_t)seqno[2] << 8 | (uint32_t)seqno[2] << 8 |
(uint32_t)seqno[3]; (uint32_t)seqno[3];
return value; return value;
} }
/**************************************************************************** /****************************************************************************
+1 -1
View File
@@ -291,7 +291,7 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
goto done; goto done;
} }
/* Exponential backoff. */ /* Exponential backoff. */
conn->timer = TCP_RTO << (conn->nrtx > 4 ? 4: conn->nrtx); conn->timer = TCP_RTO << (conn->nrtx > 4 ? 4: conn->nrtx);
(conn->nrtx)++; (conn->nrtx)++;
+3 -3
View File
@@ -143,10 +143,10 @@ static int udp_input(FAR struct net_driver_s *dev, unsigned int iplen)
chksum = ~udp_ipv4_chksum(dev); chksum = ~udp_ipv4_chksum(dev);
} }
#endif /* CONFIG_NET_IPv6 */ #endif /* CONFIG_NET_IPv6 */
} }
if (chksum != 0) if (chksum != 0)
{ {
#ifdef CONFIG_NET_STATISTICS #ifdef CONFIG_NET_STATISTICS
g_netstats.udp.drop++; g_netstats.udp.drop++;
g_netstats.udp.chkerr++; g_netstats.udp.chkerr++;
+1 -1
View File
@@ -378,7 +378,7 @@ int udp_pollsetup(FAR struct socket *psock, FAR struct pollfd *fds)
fds->revents |= (POLLRDNORM & fds->events); fds->revents |= (POLLRDNORM & fds->events);
} }
if (psock_udp_cansend(psock) >= 0) if (psock_udp_cansend(psock) >= 0)
{ {
/* Normal data may be sent without blocking (at least one byte). */ /* Normal data may be sent without blocking (at least one byte). */
+8 -8
View File
@@ -190,8 +190,8 @@ static void sendto_writebuffer_release(FAR struct socket *psock,
* the write buffer queue. * the write buffer queue.
*/ */
ret = sendto_next_transfer(psock, conn); ret = sendto_next_transfer(psock, conn);
} }
} }
while (wrb != NULL && ret < 0); while (wrb != NULL && ret < 0);
} }
@@ -864,12 +864,12 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
* write buffer queue. * write buffer queue.
*/ */
ret = sendto_next_transfer(psock, conn); ret = sendto_next_transfer(psock, conn);
if (ret < 0) if (ret < 0)
{ {
(void)sq_remlast(&conn->write_q); (void)sq_remlast(&conn->write_q);
goto errout_with_wrb; goto errout_with_wrb;
} }
net_unlock(); net_unlock();
} }
+3 -3
View File
@@ -246,9 +246,9 @@ static uint16_t sendto_eventhandler(FAR struct net_driver_s *dev,
else else
#endif /* CONFIG_NET_SOCKOPTS */ #endif /* CONFIG_NET_SOCKOPTS */
{ {
/* No timeout. Just wait for the next polling cycle */ /* No timeout. Just wait for the next polling cycle */
return flags; return flags;
} }
} }
@@ -507,7 +507,7 @@ ssize_t psock_udp_sendto(FAR struct socket *psock, FAR const void *buf,
nerr("ERROR: udp_find_raddr_device failed\n"); nerr("ERROR: udp_find_raddr_device failed\n");
ret = -ENETUNREACH; ret = -ENETUNREACH;
goto errout_with_lock; goto errout_with_lock;
} }
/* Make sure that the device is in the UP state */ /* Make sure that the device is in the UP state */
+3 -1
View File
@@ -238,7 +238,9 @@ FAR struct usrsock_conn_s *usrsock_active(int16_t usockid)
while ((conn = usrsock_nextconn(conn)) != NULL) while ((conn = usrsock_nextconn(conn)) != NULL)
{ {
if (conn->usockid == usockid) if (conn->usockid == usockid)
return conn; {
return conn;
}
} }
return NULL; return NULL;
+4 -2
View File
@@ -81,8 +81,10 @@ static uint16_t poll_event(FAR struct net_driver_s *dev, FAR void *pvconn,
DEBUGASSERT(!info || (info->psock && info->fds)); DEBUGASSERT(!info || (info->psock && info->fds));
if (!info) if (info == NULL)
return flags; {
return flags;
}
if (flags & USRSOCK_EVENT_ABORT) if (flags & USRSOCK_EVENT_ABORT)
{ {
+1 -1
View File
@@ -113,7 +113,7 @@ static uint8_t net_msbits8(uint8_t byval)
static inline uint8_t net_msbits16(uint16_t hword) static inline uint8_t net_msbits16(uint16_t hword)
{ {
uint8_t ones; uint8_t ones;
/* Look at the MS byte of the 16-bit value */ /* Look at the MS byte of the 16-bit value */