Rename many functions in net/devif from uip_* to devif_*

This commit is contained in:
Gregory Nutt 2014-06-28 18:36:09 -06:00
parent 5790c94ba3
commit 8e706eb4ff
29 changed files with 94 additions and 92 deletions

View file

@ -88,11 +88,6 @@ struct pkt_conn_s
FAR struct pkt_conn_s *pkt_alloc(void);
/* Allocate a new packet socket data callback */
#define pkt_callbackalloc(conn) uip_callbackalloc(&conn->list)
#define pkt_callbackfree(conn,cb) uip_callbackfree(cb, &conn->list)
/* Free a connection structure that is no longer in use. This should
* be done by the implementation of close()
*/

View file

@ -397,11 +397,6 @@ struct tcp_iphdr_s
struct tcp_conn_s *tcp_alloc(void);
/* Allocate a new TCP data callback */
#define tcp_callbackalloc(conn) uip_callbackalloc(&conn->list)
#define tcp_callbackfree(conn,cb) uip_callbackfree(cb, &conn->list)
/* Free a connection structure that is no longer in use. This should
* be done by the implementation of close()
*/

View file

@ -161,11 +161,6 @@ struct udp_stats_s
FAR struct udp_conn_s *udp_alloc(void);
/* Allocate a new TCP data callback */
#define udp_callbackalloc(conn) uip_callbackalloc(&conn->list)
#define udp_callbackfree(conn,cb) uip_callbackfree(cb, &conn->list)
/* Free a connection structure that is no longer in use. This should
* be done by the implementation of close()
*/

View file

@ -114,7 +114,7 @@ extern "C"
void devif_initialize(void);
/****************************************************************************
* Function: uip_callbackinit
* Function: devif_callback_init
*
* Description:
* Configure the pre-allocated callback structures into a free list.
@ -126,10 +126,10 @@ void devif_initialize(void);
*
****************************************************************************/
void uip_callbackinit(void);
void devif_callback_init(void);
/****************************************************************************
* Function: uip_callbackalloc
* Function: devif_callback_alloc
*
* Description:
* Allocate a callback container from the free list.
@ -141,10 +141,10 @@ void uip_callbackinit(void);
*
****************************************************************************/
FAR struct uip_callback_s *uip_callbackalloc(FAR struct uip_callback_s **list);
FAR struct uip_callback_s *devif_callback_alloc(FAR struct uip_callback_s **list);
/****************************************************************************
* Function: uip_callbackfree
* Function: devif_callback_free
*
* Description:
* Return a callback container to the free list.
@ -156,11 +156,11 @@ FAR struct uip_callback_s *uip_callbackalloc(FAR struct uip_callback_s **list);
*
****************************************************************************/
void uip_callbackfree(FAR struct uip_callback_s *cb,
FAR struct uip_callback_s **list);
void devif_callback_free(FAR struct uip_callback_s *cb,
FAR struct uip_callback_s **list);
/****************************************************************************
* Function: uip_callbackexecute
* Function: devif_callback_execute
*
* Description:
* Execute a list of callbacks.
@ -172,8 +172,8 @@ void uip_callbackfree(FAR struct uip_callback_s *cb,
*
****************************************************************************/
uint16_t uip_callbackexecute(FAR struct net_driver_s *dev, FAR void *pvconn,
uint16_t flags, FAR struct uip_callback_s *list);
uint16_t devif_callback_execute(FAR struct net_driver_s *dev, FAR void *pvconn,
uint16_t flags, FAR struct uip_callback_s *list);
/****************************************************************************
* Send data on the current connection.
@ -199,17 +199,17 @@ uint16_t uip_callbackexecute(FAR struct net_driver_s *dev, FAR void *pvconn,
*
****************************************************************************/
void uip_send(FAR struct net_driver_s *dev, FAR const void *buf, int len);
void devif_send(FAR struct net_driver_s *dev, FAR const void *buf, int len);
#ifdef CONFIG_NET_IOB
struct iob_s;
void uip_iobsend(FAR struct net_driver_s *dev, FAR struct iob_s *buf,
unsigned int len, unsigned int offset);
void devif_iob_send(FAR struct net_driver_s *dev, FAR struct iob_s *buf,
unsigned int len, unsigned int offset);
#endif
#ifdef CONFIG_NET_PKT
void uip_pktsend(FAR struct net_driver_s *dev, FAR const void *buf,
unsigned int len);
void devif_pkt_send(FAR struct net_driver_s *dev, FAR const void *buf,
unsigned int len);
#endif
#undef EXTERN

View file

@ -66,7 +66,7 @@ static FAR struct uip_callback_s *g_cbfreelist = NULL;
****************************************************************************/
/****************************************************************************
* Function: uip_callbackinit
* Function: devif_callback_init
*
* Description:
* Configure the pre-allocated callback structures into a free list.
@ -78,7 +78,7 @@ static FAR struct uip_callback_s *g_cbfreelist = NULL;
*
****************************************************************************/
void uip_callbackinit(void)
void devif_callback_init(void)
{
int i;
for (i = 0; i < CONFIG_NET_NACTIVESOCKETS; i++)
@ -89,7 +89,7 @@ void uip_callbackinit(void)
}
/****************************************************************************
* Function: uip_callbackalloc
* Function: devif_callback_alloc
*
* Description:
* Allocate a callback container from the free list.
@ -101,7 +101,7 @@ void uip_callbackinit(void)
*
****************************************************************************/
FAR struct uip_callback_s *uip_callbackalloc(FAR struct uip_callback_s **list)
FAR struct uip_callback_s *devif_callback_alloc(FAR struct uip_callback_s **list)
{
struct uip_callback_s *ret;
net_lock_t save;
@ -141,7 +141,7 @@ FAR struct uip_callback_s *uip_callbackalloc(FAR struct uip_callback_s **list)
}
/****************************************************************************
* Function: uip_callbackfree
* Function: devif_callback_free
*
* Description:
* Return a callback container to the free list.
@ -153,8 +153,8 @@ FAR struct uip_callback_s *uip_callbackalloc(FAR struct uip_callback_s **list)
*
****************************************************************************/
void uip_callbackfree(FAR struct uip_callback_s *cb,
FAR struct uip_callback_s **list)
void devif_callback_free(FAR struct uip_callback_s *cb,
FAR struct uip_callback_s **list)
{
FAR struct uip_callback_s *prev;
FAR struct uip_callback_s *curr;
@ -208,7 +208,7 @@ void uip_callbackfree(FAR struct uip_callback_s *cb,
}
/****************************************************************************
* Function: uip_callbackexecute
* Function: devif_callback_execute
*
* Description:
* Execute a list of callbacks.
@ -220,8 +220,8 @@ void uip_callbackfree(FAR struct uip_callback_s *cb,
*
****************************************************************************/
uint16_t uip_callbackexecute(FAR struct net_driver_s *dev, void *pvconn,
uint16_t flags, FAR struct uip_callback_s *list)
uint16_t devif_callback_execute(FAR struct net_driver_s *dev, void *pvconn,
uint16_t flags, FAR struct uip_callback_s *list)
{
FAR struct uip_callback_s *next;
net_lock_t save;

View file

@ -118,6 +118,6 @@ void devif_initialize(void)
{
/* Initialize callback support */
uip_callbackinit();
devif_callback_init();
}
#endif /* CONFIG_NET */

View file

@ -82,13 +82,13 @@
****************************************************************************/
/****************************************************************************
* Name: uip_iobsend
* Name: devif_iob_send
*
* Description:
* Called from socket logic in response to a xmit or poll request from the
* the network interface driver.
*
* This is identical to calling uip_send() except that the data is
* This is identical to calling devif_send() except that the data is
* in an I/O buffer chain, rather than a flat buffer.
*
* Assumptions:
@ -97,8 +97,8 @@
*
****************************************************************************/
void uip_iobsend(FAR struct net_driver_s *dev, FAR struct iob_s *iob,
unsigned int len, unsigned int offset)
void devif_iob_send(FAR struct net_driver_s *dev, FAR struct iob_s *iob,
unsigned int len, unsigned int offset)
{
DEBUGASSERT(dev && len > 0 && len < CONFIG_NET_BUFSIZE);
@ -110,7 +110,7 @@ void uip_iobsend(FAR struct net_driver_s *dev, FAR struct iob_s *iob,
#ifdef CONFIG_NET_TCP_WRBUFFER_DUMP
/* Dump the outgoing device buffer */
lib_dumpbuffer("uip_iobsend", dev->d_snddata, len);
lib_dumpbuffer("devif_iob_send", dev->d_snddata, len);
#endif
}

View file

@ -81,13 +81,13 @@
****************************************************************************/
/****************************************************************************
* Name: uip_pktsend
* Name: devif_pkt_send
*
* Description:
* Called from socket logic in order to send a raw packet in response to
* an xmit or poll request from the the network interface driver.
*
* This is almost identical to calling uip_send() except that the data to
* 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
* no header on the data.
*
@ -97,8 +97,8 @@
*
****************************************************************************/
void uip_pktsend(FAR struct net_driver_s *dev, FAR const void *buf,
unsigned int len)
void devif_pkt_send(FAR struct net_driver_s *dev, FAR const void *buf,
unsigned int len)
{
DEBUGASSERT(dev && len > 0 && len < CONFIG_NET_BUFSIZE);

View file

@ -81,7 +81,7 @@
****************************************************************************/
/****************************************************************************
* Name: uip_send
* Name: devif_send
*
* Description:
* Called from socket logic in response to a xmit or poll request from the
@ -93,7 +93,7 @@
*
****************************************************************************/
void uip_send(struct net_driver_s *dev, const void *buf, int len)
void devif_send(struct net_driver_s *dev, const void *buf, int len)
{
DEBUGASSERT(dev && len > 0 && len < CONFIG_NET_BUFSIZE);

View file

@ -185,7 +185,7 @@ void icmp_input(FAR struct net_driver_s *dev)
#ifdef CONFIG_NET_ICMP_PING
else if (picmp->type == ICMP_ECHO_REPLY && g_echocallback)
{
(void)uip_callbackexecute(dev, picmp, UIP_ECHOREPLY, g_echocallback);
(void)devif_callback_execute(dev, picmp, UIP_ECHOREPLY, g_echocallback);
}
#endif
@ -273,7 +273,7 @@ typeerr:
{
/* Dispatch the ECHO reply to the waiting thread */
flags = uip_callbackexecute(dev, picmp, flags, g_echocallback);
flags = devif_callback_execute(dev, picmp, flags, g_echocallback);
}
/* If the ECHO reply was not handled, then drop the packet */

View file

@ -67,8 +67,8 @@
/* Allocate a new ICMP data callback */
#define icmp_callbackalloc() uip_callbackalloc(&g_echocallback)
#define icmp_callbackfree(cb) uip_callbackfree(cb, &g_echocallback)
#define icmp_callback_alloc() devif_callback_alloc(&g_echocallback)
#define icmp_callback_free(cb) devif_callback_free(cb, &g_echocallback)
/****************************************************************************
* Private Types
@ -345,7 +345,7 @@ int uip_ping(uip_ipaddr_t addr, uint16_t id, uint16_t seqno,
/* Set up the callback */
state.png_cb = icmp_callbackalloc();
state.png_cb = icmp_callback_alloc();
if (state.png_cb)
{
state.png_cb->flags = UIP_POLL|UIP_ECHOREPLY;
@ -367,7 +367,7 @@ int uip_ping(uip_ipaddr_t addr, uint16_t id, uint16_t seqno,
nlldbg("Start time: 0x%08x seqno: %d\n", state.png_time, seqno);
net_lockedwait(&state.png_sem);
icmp_callbackfree(state.png_cb);
icmp_callback_free(state.png_cb);
}
net_unlock(save);

View file

@ -98,7 +98,7 @@ void icmp_poll(FAR struct net_driver_s *dev)
/* Perform the application callback */
(void)uip_callbackexecute(dev, NULL, UIP_POLL, g_echocallback);
(void)devif_callback_execute(dev, NULL, UIP_POLL, g_echocallback);
}
#endif /* CONFIG_NET && CONFIG_NET_ICMP && CONFIG_NET_ICMP_PING */

View file

@ -50,6 +50,11 @@
* Pre-processor Definitions
****************************************************************************/
/* Allocate a new packet socket data callback */
#define pkt_callback_alloc(conn) devif_callback_alloc(&conn->list)
#define pkt_callback_free(conn,cb) devif_callback_free(cb, &conn->list)
/****************************************************************************
* Public Type Definitions
****************************************************************************/

View file

@ -88,7 +88,7 @@ uint16_t pkt_callback(FAR struct net_driver_s *dev,
{
/* Perform the callback */
flags = uip_callbackexecute(dev, conn, flags, conn->list);
flags = devif_callback_execute(dev, conn, flags, conn->list);
}
return flags;

View file

@ -118,7 +118,7 @@ void pkt_poll(FAR struct net_driver_s *dev, FAR struct pkt_conn_s *conn)
if (dev->d_sndlen > 0)
{
// uip_pktsend(dev, conn);
// devif_pkt_send(dev, conn);
return;
}
}

View file

@ -124,7 +124,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev,
{
/* Copy the packet data into the device packet buffer and send it */
uip_pktsend(dev, pstate->snd_buffer, pstate->snd_buflen);
devif_pkt_send(dev, pstate->snd_buffer, pstate->snd_buflen);
pstate->snd_sent = pstate->snd_buflen;
}
@ -243,7 +243,7 @@ ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf,
/* Allocate resource to receive a callback */
state.snd_cb = pkt_callbackalloc(conn);
state.snd_cb = pkt_callback_alloc(conn);
if (state.snd_cb)
{
FAR struct net_driver_s *dev;
@ -281,7 +281,7 @@ ssize_t psock_pkt_send(FAR struct socket *psock, FAR const void *buf,
/* Make sure that no further interrupts are processed */
pkt_callbackfree(conn, state.snd_cb);
pkt_callback_free(conn, state.snd_cb);
/* Clear the no-ARP bit in the device flags */

View file

@ -113,7 +113,7 @@ static inline int psock_setup_callbacks(FAR struct socket *psock,
/* Set up the callbacks in the connection */
pstate->tc_cb = tcp_callbackalloc(conn);
pstate->tc_cb = tcp_callback_alloc(conn);
if (pstate->tc_cb)
{
/* Set up the connection "interrupt" handler */
@ -143,7 +143,7 @@ static inline void psock_teardown_callbacks(FAR struct tcp_connect_s *pstate,
/* Make sure that no further interrupts are processed */
tcp_callbackfree(conn, pstate->tc_cb);
tcp_callback_free(conn, pstate->tc_cb);
pstate->tc_cb = NULL;

View file

@ -60,6 +60,7 @@
#include "socket/socket.h"
#include "netdev/netdev.h"
#include "devif/devif.h"
#include "tcp/tcp.h"
#include "pkt/pkt.h"
/****************************************************************************
@ -297,7 +298,7 @@ static inline int netclose_disconnect(FAR struct socket *psock)
#ifdef CONFIG_NET_TCP_WRITE_BUFFERS
if (psock->s_sndcb)
{
tcp_callbackfree(conn, psock->s_sndcb);
tcp_callback_free(conn, psock->s_sndcb);
psock->s_sndcb = NULL;
}
#endif
@ -309,7 +310,7 @@ static inline int netclose_disconnect(FAR struct socket *psock)
/* Check for the case where the host beat us and disconnected first */
if (conn->tcpstateflags == UIP_ESTABLISHED &&
(state.cl_cb = tcp_callbackalloc(conn)) != NULL)
(state.cl_cb = tcp_callback_alloc(conn)) != NULL)
{
/* Set up to receive TCP data event callbacks */
@ -373,7 +374,7 @@ static inline int netclose_disconnect(FAR struct socket *psock)
/* We are now disconnected */
sem_destroy(&state.cl_sem);
tcp_callbackfree(conn, state.cl_cb);
tcp_callback_free(conn, state.cl_cb);
/* Free the connection */

View file

@ -58,6 +58,7 @@
#include <devif/devif.h>
#include "tcp/tcp.h"
#include "socket/socket.h"
/****************************************************************************
@ -214,7 +215,7 @@ static inline int net_pollsetup(FAR struct socket *psock,
/* Allocate a TCP/IP callback structure */
cb = tcp_callbackalloc(conn);
cb = tcp_callback_alloc(conn);
if (!cb)
{
ret = -EBUSY;
@ -366,7 +367,7 @@ static inline int net_pollteardown(FAR struct socket *psock,
/* Release the callback */
flags = net_lock();
tcp_callbackfree(conn, info->cb);
tcp_callback_free(conn, info->cb);
net_unlock(flags);
/* Release the poll/select data slot */

View file

@ -491,7 +491,7 @@ ssize_t net_sendfile(int outfd, struct file *infile, off_t *offset,
/* Allocate resources to receive a callback */
state.snd_datacb = tcp_callbackalloc(conn);
state.snd_datacb = tcp_callback_alloc(conn);
if (state.snd_datacb == NULL)
{
@ -500,7 +500,7 @@ ssize_t net_sendfile(int outfd, struct file *infile, off_t *offset,
goto errout_locked;
}
state.snd_ackcb = tcp_callbackalloc(conn);
state.snd_ackcb = tcp_callback_alloc(conn);
if (state.snd_ackcb == NULL)
{
@ -551,10 +551,10 @@ ssize_t net_sendfile(int outfd, struct file *infile, off_t *offset,
psock->s_flags = _SS_SETSTATE(psock->s_flags, _SF_IDLE);
tcp_callbackfree(conn, state.snd_ackcb);
tcp_callback_free(conn, state.snd_ackcb);
errout_datacb:
tcp_callbackfree(conn, state.snd_datacb);
tcp_callback_free(conn, state.snd_datacb);
errout_locked:

View file

@ -1075,7 +1075,7 @@ static ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Set up the callback in the connection */
state.rf_cb = pkt_callbackalloc(conn);
state.rf_cb = pkt_callback_alloc(conn);
if (state.rf_cb)
{
state.rf_cb->flags = UIP_NEWDATA|UIP_POLL;
@ -1096,7 +1096,7 @@ static ssize_t pkt_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Make sure that no further interrupts are processed */
pkt_callbackfree(conn, state.rf_cb);
pkt_callback_free(conn, state.rf_cb);
ret = recvfrom_result(ret, &state);
}
else
@ -1167,7 +1167,7 @@ static ssize_t udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Set up the callback in the connection */
state.rf_cb = udp_callbackalloc(conn);
state.rf_cb = udp_callback_alloc(conn);
if (state.rf_cb)
{
/* Set up the callback in the connection */
@ -1190,7 +1190,7 @@ static ssize_t udp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Make sure that no further interrupts are processed */
udp_callbackfree(conn, state.rf_cb);
udp_callback_free(conn, state.rf_cb);
ret = recvfrom_result(ret, &state);
}
else
@ -1354,7 +1354,7 @@ static ssize_t tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Set up the callback in the connection */
state.rf_cb = tcp_callbackalloc(conn);
state.rf_cb = tcp_callback_alloc(conn);
if (state.rf_cb)
{
state.rf_cb->flags = UIP_NEWDATA|UIP_POLL|UIP_CLOSE|UIP_ABORT|UIP_TIMEDOUT;
@ -1371,7 +1371,7 @@ static ssize_t tcp_recvfrom(FAR struct socket *psock, FAR void *buf, size_t len,
/* Make sure that no further interrupts are processed */
tcp_callbackfree(conn, state.rf_cb);
tcp_callback_free(conn, state.rf_cb);
ret = recvfrom_result(ret, &state);
}
else

View file

@ -207,7 +207,7 @@ static uint16_t sendto_interrupt(struct net_driver_s *dev, void *conn,
{
/* Copy the user data into d_snddata and send it */
uip_send(dev, pstate->st_buffer, pstate->st_buflen);
devif_send(dev, pstate->st_buffer, pstate->st_buflen);
pstate->st_sndlen = pstate->st_buflen;
}
@ -392,7 +392,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
/* Set up the callback in the connection */
state.st_cb = udp_callbackalloc(conn);
state.st_cb = udp_callback_alloc(conn);
if (state.st_cb)
{
state.st_cb->flags = UIP_POLL;
@ -413,7 +413,7 @@ ssize_t psock_sendto(FAR struct socket *psock, FAR const void *buf,
/* Make sure that no further interrupts are processed */
udp_callbackfree(conn, state.st_cb);
udp_callback_free(conn, state.st_cb);
}
net_unlock(save);

View file

@ -50,6 +50,11 @@
* Pre-processor Definitions
****************************************************************************/
/* Allocate a new TCP data callback */
#define tcp_callback_alloc(conn) devif_callback_alloc(&conn->list)
#define tcp_callback_free(conn,cb) devif_callback_free(cb, &conn->list)
/****************************************************************************
* Public Type Definitions
****************************************************************************/

View file

@ -178,7 +178,7 @@ uint16_t tcp_callback(FAR struct net_driver_s *dev, FAR struct tcp_conn_s *conn,
* dev->d_len should also be cleared).
*/
flags = uip_callbackexecute(dev, conn, flags, conn->list);
flags = devif_callback_execute(dev, conn, flags, conn->list);
/* There may be no new data handler in place at them moment that the new
* incoming data is received. If the new incoming data was not handled, then

View file

@ -338,7 +338,7 @@ void tcp_free(FAR struct tcp_conn_s *conn)
for (cb = conn->list; cb; cb = next)
{
next = cb->flink;
tcp_callbackfree(conn, cb);
tcp_callback_free(conn, cb);
}
/* UIP_ALLOCATED means that that the connection is not in the active list

View file

@ -600,7 +600,7 @@ static uint16_t psock_send_interrupt(FAR struct net_driver_s *dev,
* won't actually happen until the polling cycle completes).
*/
uip_iobsend(dev, WRB_IOB(wrb), sndlen, WRB_SENT(wrb));
devif_iob_send(dev, WRB_IOB(wrb), sndlen, WRB_SENT(wrb));
/* Remember how much data we send out now so that we know
* when everything has been acknowledged. Just increment
@ -755,7 +755,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock, FAR const void *buf,
if (!psock->s_sndcb)
{
psock->s_sndcb = tcp_callbackalloc(conn);
psock->s_sndcb = tcp_callback_alloc(conn);
}
/* Test if the callback has been allocated */

View file

@ -376,7 +376,7 @@ static uint16_t tcpsend_interrupt(FAR struct net_driver_s *dev,
* happen until the polling cycle completes).
*/
uip_send(dev, &pstate->snd_buffer[pstate->snd_sent], sndlen);
devif_send(dev, &pstate->snd_buffer[pstate->snd_sent], sndlen);
/* Check if the destination IP address is in the ARP table. If not,
* then the send won't actually make it out... it will be replaced with
@ -550,7 +550,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock,
/* Allocate resources to receive a callback */
state.snd_cb = tcp_callbackalloc(conn);
state.snd_cb = tcp_callback_alloc(conn);
if (state.snd_cb)
{
/* Get the initial sequence number that will be used */
@ -588,7 +588,7 @@ ssize_t psock_tcp_send(FAR struct socket *psock,
/* Make sure that no further interrupts are processed */
tcp_callbackfree(conn, state.snd_cb);
tcp_callback_free(conn, state.snd_cb);
}
}

View file

@ -50,6 +50,11 @@
* Pre-processor Definitions
****************************************************************************/
/* Allocate a new TCP data callback */
#define udp_callback_alloc(conn) devif_callback_alloc(&conn->list)
#define udp_callback_free(conn,cb) devif_callback_free(cb, &conn->list)
/****************************************************************************
* Public Type Definitions
****************************************************************************/

View file

@ -88,7 +88,7 @@ uint16_t udp_callback(FAR struct net_driver_s *dev,
{
/* Perform the callback */
flags = uip_callbackexecute(dev, conn, flags, conn->list);
flags = devif_callback_execute(dev, conn, flags, conn->list);
}
return flags;