From 88a0e82934a62b72daed4d59c8470ece9ef1de7f Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 17 Jan 2015 05:59:13 -0600 Subject: [PATCH] Networking: Remove field d_sndata from the device structure. It is the same as d_appdata and unnecessary --- include/nuttx/net/netdev.h | 10 ++-------- net/arp/arp_poll.c | 2 -- net/devif/devif_iobsend.c | 4 ++-- net/devif/devif_pktsend.c | 2 +- net/devif/devif_send.c | 2 +- net/icmp/icmp_poll.c | 2 -- net/icmpv6/icmpv6_poll.c | 2 -- net/igmp/igmp_poll.c | 2 -- net/pkt/pkt_input.c | 1 - net/pkt/pkt_poll.c | 2 -- net/socket/net_sendfile.c | 2 +- net/socket/sendto.c | 2 +- net/tcp/tcp_appsend.c | 2 -- net/tcp/tcp_input.c | 1 - net/tcp/tcp_poll.c | 2 -- net/tcp/tcp_timer.c | 1 - net/udp/udp_input.c | 1 - net/udp/udp_poll.c | 2 -- 18 files changed, 8 insertions(+), 34 deletions(-) diff --git a/include/nuttx/net/netdev.h b/include/nuttx/net/netdev.h index e66c378d5f..f6785996e4 100644 --- a/include/nuttx/net/netdev.h +++ b/include/nuttx/net/netdev.h @@ -146,17 +146,11 @@ struct net_driver_s #endif /* d_appdata points to the location where application data can be read from - * or written into a packet. + * or written to in the the packet buffer. */ uint8_t *d_appdata; - /* This is a pointer into d_buf where a user application may append - * data to be sent. - */ - - uint8_t *d_snddata; - #ifdef CONFIG_NET_TCPURGDATA /* This pointer points to any urgent TCP data that has been received. Only * present if compiled with support for urgent data (CONFIG_NET_TCPURGDATA). @@ -185,7 +179,7 @@ struct net_driver_s uint16_t d_len; /* When d_buf contains outgoing xmit data, d_sndlen is non-zero and represents - * the amount of application data after d_snddata + * the amount of application data after d_appdata */ uint16_t d_sndlen; diff --git a/net/arp/arp_poll.c b/net/arp/arp_poll.c index 111547b319..854fce929f 100644 --- a/net/arp/arp_poll.c +++ b/net/arp/arp_poll.c @@ -82,8 +82,6 @@ int arp_poll(FAR struct net_driver_s *dev, devif_poll_callback_t callback) /* Setup for the ARP callback (most of these do not apply) */ dev->d_appdata = NULL; - dev->d_snddata = NULL; - dev->d_len = 0; dev->d_sndlen = 0; diff --git a/net/devif/devif_iobsend.c b/net/devif/devif_iobsend.c index 27e1adcbc8..f1f0248b6e 100644 --- a/net/devif/devif_iobsend.c +++ b/net/devif/devif_iobsend.c @@ -103,13 +103,13 @@ void devif_iob_send(FAR struct net_driver_s *dev, FAR struct iob_s *iob, /* Copy the data from the I/O buffer chain to the device buffer */ - iob_copyout(dev->d_snddata, iob, len, offset); + iob_copyout(dev->d_appdata, iob, len, offset); dev->d_sndlen = len; #ifdef CONFIG_NET_TCP_WRBUFFER_DUMP /* Dump the outgoing device buffer */ - lib_dumpbuffer("devif_iob_send", dev->d_snddata, len); + lib_dumpbuffer("devif_iob_send", dev->d_appdata, len); #endif } diff --git a/net/devif/devif_pktsend.c b/net/devif/devif_pktsend.c index 1dc1a41a6c..d03548eda7 100644 --- a/net/devif/devif_pktsend.c +++ b/net/devif/devif_pktsend.c @@ -87,7 +87,7 @@ * an xmit or poll request from the the network interface driver. * * This is almost identical to calling devif_send() except that the data to - * be sent is copied into dev->d_buf (vs. dev->d_snddata), since there is + * be sent is copied into dev->d_buf (vs. dev->d_appdata), since there is * no header on the data. * * Assumptions: diff --git a/net/devif/devif_send.c b/net/devif/devif_send.c index 1738c28e50..0409ba3daf 100644 --- a/net/devif/devif_send.c +++ b/net/devif/devif_send.c @@ -96,6 +96,6 @@ void devif_send(struct net_driver_s *dev, const void *buf, int len) { DEBUGASSERT(dev && len > 0 && len < NET_DEV_MTU(dev)); - memcpy(dev->d_snddata, buf, len); + memcpy(dev->d_appdata, buf, len); dev->d_sndlen = len; } diff --git a/net/icmp/icmp_poll.c b/net/icmp/icmp_poll.c index 6c3f63b26c..4f99464ddf 100644 --- a/net/icmp/icmp_poll.c +++ b/net/icmp/icmp_poll.c @@ -91,8 +91,6 @@ void icmp_poll(FAR struct net_driver_s *dev) /* Setup for the application callback */ dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPICMP_HDRLEN]; - dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPICMP_HDRLEN]; - dev->d_len = 0; dev->d_sndlen = 0; diff --git a/net/icmpv6/icmpv6_poll.c b/net/icmpv6/icmpv6_poll.c index 8c06b53d25..20ca9210c7 100644 --- a/net/icmpv6/icmpv6_poll.c +++ b/net/icmpv6/icmpv6_poll.c @@ -91,8 +91,6 @@ void icmpv6_poll(FAR struct net_driver_s *dev) /* Setup for the application callback */ dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPICMPv6_HDRLEN]; - dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPICMPv6_HDRLEN]; - dev->d_len = 0; dev->d_sndlen = 0; diff --git a/net/igmp/igmp_poll.c b/net/igmp/igmp_poll.c index 7cc1cfb9c2..6beb8a31e6 100644 --- a/net/igmp/igmp_poll.c +++ b/net/igmp/igmp_poll.c @@ -152,8 +152,6 @@ void igmp_poll(FAR struct net_driver_s *dev) /* Setup the poll operation */ dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPIGMP_HDRLEN]; - dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPIGMP_HDRLEN]; - dev->d_len = 0; dev->d_sndlen = 0; diff --git a/net/pkt/pkt_input.c b/net/pkt/pkt_input.c index 9f0ce783ed..733da5596f 100644 --- a/net/pkt/pkt_input.c +++ b/net/pkt/pkt_input.c @@ -109,7 +109,6 @@ int pkt_input(struct net_driver_s *dev) /* Setup for the application callback */ dev->d_appdata = dev->d_buf; - dev->d_snddata = dev->d_buf; dev->d_sndlen = 0; /* Perform the application callback */ diff --git a/net/pkt/pkt_poll.c b/net/pkt/pkt_poll.c index e3db35b569..701ce01176 100644 --- a/net/pkt/pkt_poll.c +++ b/net/pkt/pkt_poll.c @@ -103,8 +103,6 @@ void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn) /* Setup for the application callback */ dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPv4UDP_HDRLEN]; - dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPv4UDP_HDRLEN]; - dev->d_len = 0; dev->d_sndlen = 0; diff --git a/net/socket/net_sendfile.c b/net/socket/net_sendfile.c index 17f7b54780..5274eb4ede 100644 --- a/net/socket/net_sendfile.c +++ b/net/socket/net_sendfile.c @@ -289,7 +289,7 @@ static uint16_t sendfile_interrupt(FAR struct net_driver_s *dev, FAR void *pvcon goto end_wait; } - ret = file_read(pstate->snd_file, dev->d_snddata, sndlen); + ret = file_read(pstate->snd_file, dev->d_appdata, sndlen); if (ret < 0) { int errcode = errno; diff --git a/net/socket/sendto.c b/net/socket/sendto.c index 7576d74275..1bd9495cf7 100644 --- a/net/socket/sendto.c +++ b/net/socket/sendto.c @@ -207,7 +207,7 @@ static uint16_t sendto_interrupt(struct net_driver_s *dev, void *conn, else { - /* Copy the user data into d_snddata and send it */ + /* Copy the user data into d_appdata and send it */ devif_send(dev, pstate->st_buffer, pstate->st_buflen); pstate->st_sndlen = pstate->st_buflen; diff --git a/net/tcp/tcp_appsend.c b/net/tcp/tcp_appsend.c index 339e2f2558..ad4d43afbc 100644 --- a/net/tcp/tcp_appsend.c +++ b/net/tcp/tcp_appsend.c @@ -188,8 +188,6 @@ void tcp_rexmit(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, nllvdbg("result: %04x d_sndlen: %d conn->unacked: %d\n", result, dev->d_sndlen, conn->unacked); - dev->d_appdata = dev->d_snddata; - /* If the application has data to be sent, or if the incoming packet had * new data in it, we must send out a packet. */ diff --git a/net/tcp/tcp_input.c b/net/tcp/tcp_input.c index f851c67ead..f382e2cc80 100644 --- a/net/tcp/tcp_input.c +++ b/net/tcp/tcp_input.c @@ -130,7 +130,6 @@ static void tcp_input(FAR struct net_driver_s *dev, unsigned int iplen) /* Initialize for tcp_send() */ - dev->d_snddata = &dev->d_buf[hdrlen]; dev->d_appdata = &dev->d_buf[hdrlen]; /* Start of TCP input header processing code. */ diff --git a/net/tcp/tcp_poll.c b/net/tcp/tcp_poll.c index 0f61756386..637ac99ac2 100644 --- a/net/tcp/tcp_poll.c +++ b/net/tcp/tcp_poll.c @@ -107,10 +107,8 @@ void tcp_poll(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn) */ #if defined(CONFIG_NET_IPv4) - dev->d_snddata = &dev->d_buf[IPv4TCP_HDRLEN + NET_LL_HDRLEN(dev)]; dev->d_appdata = &dev->d_buf[IPv4TCP_HDRLEN + NET_LL_HDRLEN(dev)]; #else /* if defined(CONFIG_NET_IPv6) */ - dev->d_snddata = &dev->d_buf[IPv6TCP_HDRLEN + NET_LL_HDRLEN(dev)]; dev->d_appdata = &dev->d_buf[IPv6TCP_HDRLEN + NET_LL_HDRLEN(dev)]; #endif diff --git a/net/tcp/tcp_timer.c b/net/tcp/tcp_timer.c index 5ed9c8d103..2d1590b7cc 100644 --- a/net/tcp/tcp_timer.c +++ b/net/tcp/tcp_timer.c @@ -100,7 +100,6 @@ void tcp_timer(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn, { uint8_t result; - dev->d_snddata = &dev->d_buf[IPv4TCP_HDRLEN + NET_LL_HDRLEN(dev)]; dev->d_appdata = &dev->d_buf[IPv4TCP_HDRLEN + NET_LL_HDRLEN(dev)]; /* Increase the TCP sequence number */ diff --git a/net/udp/udp_input.c b/net/udp/udp_input.c index 9062b6dd52..d21d47e1b5 100644 --- a/net/udp/udp_input.c +++ b/net/udp/udp_input.c @@ -167,7 +167,6 @@ static int udp_input(FAR struct net_driver_s *dev, unsigned int iplen) /* Set-up for the application callback */ dev->d_appdata = &dev->d_buf[hdrlen]; - dev->d_snddata = &dev->d_buf[hdrlen]; dev->d_sndlen = 0; /* Perform the application callback */ diff --git a/net/udp/udp_poll.c b/net/udp/udp_poll.c index 43ea3e8cc1..a734cf93d6 100644 --- a/net/udp/udp_poll.c +++ b/net/udp/udp_poll.c @@ -105,10 +105,8 @@ void udp_poll(FAR struct net_driver_s *dev, FAR struct udp_conn_s *conn) #if defined(CONFIG_NET_IPv4) dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPv4UDP_HDRLEN]; - dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPv4UDP_HDRLEN]; #else /* if defined(CONFIG_NET_IPv6) */ dev->d_appdata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPv6UDP_HDRLEN]; - dev->d_snddata = &dev->d_buf[NET_LL_HDRLEN(dev) + IPv6UDP_HDRLEN]; #endif dev->d_len = 0;