pthread.h: Fix rwlock initializer
This commit is contained in:
parent
3f51180cca
commit
35ca733108
@ -539,7 +539,7 @@ CONFIG_NET_6LOWPAN_MAXADDRCONTEXT=1
|
|||||||
CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_0_0=0xaa
|
CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_0_0=0xaa
|
||||||
CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_0_1=0xaa
|
CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_0_1=0xaa
|
||||||
# CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREINIT_1 is not set
|
# CONFIG_NET_6LOWPAN_MAXADDRCONTEXT_PREINIT_1 is not set
|
||||||
CONFIG_NET_6LOWPAN_RIMEADDR_SIZE=2
|
# CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED is not set
|
||||||
CONFIG_NET_6LOWPAN_MAXAGE=20
|
CONFIG_NET_6LOWPAN_MAXAGE=20
|
||||||
CONFIG_NET_6LOWPAN_MAX_MACTRANSMITS=4
|
CONFIG_NET_6LOWPAN_MAX_MACTRANSMITS=4
|
||||||
CONFIG_NET_6LOWPAN_MAXPAYLOAD=102
|
CONFIG_NET_6LOWPAN_MAXPAYLOAD=102
|
||||||
|
@ -63,6 +63,17 @@
|
|||||||
* Pre-processor Definitions
|
* Pre-processor Definitions
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
|
/* By default, a 2-byte Rime address is used for the IEEE802.15.4 MAC
|
||||||
|
* device's link layer address. If CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
|
* is selected, then an 8-byte Rime address will be used.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
|
# define NET_6LOWPAN_RIMEADDR_SIZE 8
|
||||||
|
#else
|
||||||
|
# define NET_6LOWPAN_RIMEADDR_SIZE 2
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Frame format definitions *************************************************/
|
/* Frame format definitions *************************************************/
|
||||||
/* Fragment header.
|
/* Fragment header.
|
||||||
*
|
*
|
||||||
@ -374,7 +385,7 @@
|
|||||||
|
|
||||||
struct rimeaddr_s
|
struct rimeaddr_s
|
||||||
{
|
{
|
||||||
uint8_t u8[CONFIG_NET_6LOWPAN_RIMEADDR_SIZE];
|
uint8_t u8[NET_6LOWPAN_RIMEADDR_SIZE];
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The device structure for IEEE802.15.4 MAC network device differs from the
|
/* The device structure for IEEE802.15.4 MAC network device differs from the
|
||||||
|
@ -352,7 +352,7 @@ typedef int pthread_rwlockattr_t;
|
|||||||
|
|
||||||
#define PTHREAD_RWLOCK_INITIALIZER {PTHREAD_MUTEX_INITIALIZER, \
|
#define PTHREAD_RWLOCK_INITIALIZER {PTHREAD_MUTEX_INITIALIZER, \
|
||||||
PTHREAD_COND_INITIALIZER, \
|
PTHREAD_COND_INITIALIZER, \
|
||||||
0, 0}
|
0, 0, false}
|
||||||
|
|
||||||
#ifdef CONFIG_PTHREAD_CLEANUP
|
#ifdef CONFIG_PTHREAD_CLEANUP
|
||||||
/* This type describes the pthread cleanup callback (non-standard) */
|
/* This type describes the pthread cleanup callback (non-standard) */
|
||||||
|
@ -739,7 +739,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
|
|
||||||
req->ifr_hwaddr.sa_family = AF_INETX;
|
req->ifr_hwaddr.sa_family = AF_INETX;
|
||||||
memcpy(req->ifr_hwaddr.sa_data, ieee->i_nodeaddr.u8,
|
memcpy(req->ifr_hwaddr.sa_data, ieee->i_nodeaddr.u8,
|
||||||
CONFIG_NET_6LOWPAN_RIMEADDR_SIZE);
|
NET_6LOWPAN_RIMEADDR_SIZE);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -782,7 +782,7 @@ static int netdev_ifrioctl(FAR struct socket *psock, int cmd,
|
|||||||
|
|
||||||
req->ifr_hwaddr.sa_family = AF_INETX;
|
req->ifr_hwaddr.sa_family = AF_INETX;
|
||||||
memcpy(ieee->i_nodeaddr.u8, req->ifr_hwaddr.sa_data,
|
memcpy(ieee->i_nodeaddr.u8, req->ifr_hwaddr.sa_data,
|
||||||
CONFIG_NET_6LOWPAN_RIMEADDR_SIZE);
|
NET_6LOWPAN_RIMEADDR_SIZE);
|
||||||
ret = OK;
|
ret = OK;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -151,12 +151,7 @@ static int netprocfs_linklayer(FAR struct netprocfs_file_s *netfile)
|
|||||||
{
|
{
|
||||||
ieee = (FAR struct ieee802154_driver_s *)dev;
|
ieee = (FAR struct ieee802154_driver_s *)dev;
|
||||||
|
|
||||||
#if CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 2
|
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
len += snprintf(&netfile->line[len], NET_LINELEN - len,
|
|
||||||
"%s\tLink encap:6loWPAN HWaddr %02x:%02x",
|
|
||||||
dev->d_ifname,
|
|
||||||
ieee->i_nodeaddr.u8[0], ieee->i_nodeaddr.u8[1]);
|
|
||||||
#else /* CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 8 */
|
|
||||||
len += snprintf(&netfile->line[len], NET_LINELEN - len,
|
len += snprintf(&netfile->line[len], NET_LINELEN - len,
|
||||||
"%s\tLink encap:6loWPAN HWaddr "
|
"%s\tLink encap:6loWPAN HWaddr "
|
||||||
"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
|
"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x",
|
||||||
@ -165,6 +160,11 @@ static int netprocfs_linklayer(FAR struct netprocfs_file_s *netfile)
|
|||||||
ieee->i_nodeaddr.u8[2], ieee->i_nodeaddr.u8[3],
|
ieee->i_nodeaddr.u8[2], ieee->i_nodeaddr.u8[3],
|
||||||
ieee->i_nodeaddr.u8[4], ieee->i_nodeaddr.u8[5],
|
ieee->i_nodeaddr.u8[4], ieee->i_nodeaddr.u8[5],
|
||||||
ieee->i_nodeaddr.u8[6], ieee->i_nodeaddr.u8[7]);
|
ieee->i_nodeaddr.u8[6], ieee->i_nodeaddr.u8[7]);
|
||||||
|
#else
|
||||||
|
len += snprintf(&netfile->line[len], NET_LINELEN - len,
|
||||||
|
"%s\tLink encap:6loWPAN HWaddr %02x:%02x",
|
||||||
|
dev->d_ifname,
|
||||||
|
ieee->i_nodeaddr.u8[0], ieee->i_nodeaddr.u8[1]);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -215,22 +215,22 @@ static int netprocfs_linklayer(FAR struct netprocfs_file_s *netfile)
|
|||||||
#elif defined(CONFIG_NET_6LOWPAN)
|
#elif defined(CONFIG_NET_6LOWPAN)
|
||||||
ieee = (FAR struct ieee802154_driver_s *)dev;
|
ieee = (FAR struct ieee802154_driver_s *)dev;
|
||||||
|
|
||||||
#if CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 2
|
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
len += snprintf(&netfile->line[len], NET_LINELEN - len,
|
|
||||||
"%s\tLink encap:6loWPAN HWaddr %02x:%02x at %s",
|
|
||||||
dev->d_ifname,
|
|
||||||
ieee->i_nodeaddr.u8[0], ieee->i_nodeaddr.u8[1],
|
|
||||||
status);
|
|
||||||
#else /* CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 8 */
|
|
||||||
len += snprintf(&netfile->line[len], NET_LINELEN - len,
|
len += snprintf(&netfile->line[len], NET_LINELEN - len,
|
||||||
"%s\tLink encap:6loWPAN HWaddr "
|
"%s\tLink encap:6loWPAN HWaddr "
|
||||||
"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x at %s",
|
"%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x at %s\n",
|
||||||
dev->d_ifname,
|
dev->d_ifname,
|
||||||
ieee->i_nodeaddr.u8[0], ieee->i_nodeaddr.u8[1],
|
ieee->i_nodeaddr.u8[0], ieee->i_nodeaddr.u8[1],
|
||||||
ieee->i_nodeaddr.u8[2], ieee->i_nodeaddr.u8[3],
|
ieee->i_nodeaddr.u8[2], ieee->i_nodeaddr.u8[3],
|
||||||
ieee->i_nodeaddr.u8[4], ieee->i_nodeaddr.u8[5],
|
ieee->i_nodeaddr.u8[4], ieee->i_nodeaddr.u8[5],
|
||||||
ieee->i_nodeaddr.u8[6], ieee->i_nodeaddr.u8[7],
|
ieee->i_nodeaddr.u8[6], ieee->i_nodeaddr.u8[7],
|
||||||
status);
|
status);
|
||||||
|
#else
|
||||||
|
len += snprintf(&netfile->line[len], NET_LINELEN - len,
|
||||||
|
"%s\tLink encap:6loWPAN HWaddr %02x:%02x at %s\n",
|
||||||
|
dev->d_ifname,
|
||||||
|
ieee->i_nodeaddr.u8[0], ieee->i_nodeaddr.u8[1],
|
||||||
|
status);
|
||||||
#endif
|
#endif
|
||||||
#elif defined(CONFIG_NET_LOOPBACK)
|
#elif defined(CONFIG_NET_LOOPBACK)
|
||||||
len += snprintf(&netfile->line[len], NET_LINELEN - len,
|
len += snprintf(&netfile->line[len], NET_LINELEN - len,
|
||||||
@ -443,7 +443,7 @@ static int netprocfs_txstatistics_header(FAR struct netprocfs_file_s *netfile)
|
|||||||
DEBUGASSERT(netfile != NULL);
|
DEBUGASSERT(netfile != NULL);
|
||||||
|
|
||||||
return snprintf(netfile->line, NET_LINELEN, "\tTX: %-8s %-8s %-8s %-8s\n",
|
return snprintf(netfile->line, NET_LINELEN, "\tTX: %-8s %-8s %-8s %-8s\n",
|
||||||
"Queued", "Sent", "Erorts", "Timeouts");
|
"Queued", "Sent", "Errors", "Timeouts");
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_NETDEV_STATISTICS */
|
#endif /* CONFIG_NETDEV_STATISTICS */
|
||||||
|
|
||||||
|
@ -133,12 +133,13 @@ config NET_6LOWPAN_MAXADDRCONTEXT_PREFIX_2_1
|
|||||||
endif # NET_6LOWPAN_MAXADDRCONTEXT_PREINIT_0
|
endif # NET_6LOWPAN_MAXADDRCONTEXT_PREINIT_0
|
||||||
endif # NET_6LOWPAN_COMPRESSION_HC06
|
endif # NET_6LOWPAN_COMPRESSION_HC06
|
||||||
|
|
||||||
config NET_6LOWPAN_RIMEADDR_SIZE
|
config NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
int "Rime address size"
|
int "Extended Rime address"
|
||||||
default 2
|
default n
|
||||||
range 2 8
|
|
||||||
---help---
|
---help---
|
||||||
Only the values 2 and 8 are supported
|
By default, a 2-byte Rime address is used for the IEEE802.15.4 MAC
|
||||||
|
device's link layer address. If this option is selected, then an
|
||||||
|
8-byte Rime address will be used.
|
||||||
|
|
||||||
config NET_6LOWPAN_MAXAGE
|
config NET_6LOWPAN_MAXAGE
|
||||||
int "Packet reassembly timeout"
|
int "Packet reassembly timeout"
|
||||||
|
@ -125,11 +125,7 @@ static inline uint8_t sixlowpan_addrlen(uint8_t addrmode)
|
|||||||
|
|
||||||
static bool sixlowpan_addrnull(FAR uint8_t *addr)
|
static bool sixlowpan_addrnull(FAR uint8_t *addr)
|
||||||
{
|
{
|
||||||
#if CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 2
|
int i = NET_6LOWPAN_RIMEADDR_SIZE;
|
||||||
int i = 2;
|
|
||||||
#else
|
|
||||||
int i = 8;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
while (i-- > 0)
|
while (i-- > 0)
|
||||||
{
|
{
|
||||||
@ -354,10 +350,10 @@ static void sixlowpan_setup_params(FAR struct ieee802154_driver_s *ieee,
|
|||||||
|
|
||||||
/* Use short address mode if so configured */
|
/* Use short address mode if so configured */
|
||||||
|
|
||||||
#if CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 2
|
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
params->fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
|
|
||||||
#else
|
|
||||||
params->fcf.dest_addr_mode = FRAME802154_LONGADDRMODE;
|
params->fcf.dest_addr_mode = FRAME802154_LONGADDRMODE;
|
||||||
|
#else
|
||||||
|
params->fcf.dest_addr_mode = FRAME802154_SHORTADDRMODE;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,14 +539,14 @@ int sixlowpan_framecreate(FAR struct ieee802154_driver_s *ieee,
|
|||||||
|
|
||||||
wlinfo("Frame type: %02x hdrlen: %d\n",
|
wlinfo("Frame type: %02x hdrlen: %d\n",
|
||||||
params.fcf.frame_type, hdrlen);
|
params.fcf.frame_type, hdrlen);
|
||||||
#if CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 2
|
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
wlinfo("Dest address: %02x:%02x\n",
|
|
||||||
params.dest_addr[0], params.dest_addr[1]);
|
|
||||||
#else
|
|
||||||
wlinfo("Dest address: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
|
wlinfo("Dest address: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||||
params.dest_addr[0], params.dest_addr[1], params.dest_addr[2],
|
params.dest_addr[0], params.dest_addr[1], params.dest_addr[2],
|
||||||
params.dest_addr[3], params.dest_addr[4], params.dest_addr[5],
|
params.dest_addr[3], params.dest_addr[4], params.dest_addr[5],
|
||||||
params.dest_addr[6], params.dest_addr[7]);
|
params.dest_addr[6], params.dest_addr[7]);
|
||||||
|
#else
|
||||||
|
wlinfo("Dest address: %02x:%02x\n",
|
||||||
|
params.dest_addr[0], params.dest_addr[1]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return hdrlen;
|
return hdrlen;
|
||||||
|
@ -74,13 +74,13 @@
|
|||||||
/* Rime addres macros */
|
/* Rime addres macros */
|
||||||
/* Copy a Rime address */
|
/* Copy a Rime address */
|
||||||
|
|
||||||
#define rimeaddr_copy(dest,src) \
|
#define rimeaddr_copy(dest,src) \
|
||||||
memcpy(dest, src, CONFIG_NET_6LOWPAN_RIMEADDR_SIZE)
|
memcpy(dest, src, NET_6LOWPAN_RIMEADDR_SIZE)
|
||||||
|
|
||||||
/* Compare two Rime addresses */
|
/* Compare two Rime addresses */
|
||||||
|
|
||||||
#define rimeaddr_cmp(addr1,addr2) \
|
#define rimeaddr_cmp(addr1,addr2) \
|
||||||
(memcmp(addr1, addr2, CONFIG_NET_6LOWPAN_RIMEADDR_SIZE) == 0)
|
(memcmp(addr1, addr2, NET_6LOWPAN_RIMEADDR_SIZE) == 0)
|
||||||
|
|
||||||
/* Pointers in the Rime buffer */
|
/* Pointers in the Rime buffer */
|
||||||
|
|
||||||
|
@ -88,14 +88,14 @@ void sixlowpan_ipfromrime(FAR const struct rimeaddr_s *rime,
|
|||||||
memset(ipaddr, 0, sizeof(net_ipv6addr_t));
|
memset(ipaddr, 0, sizeof(net_ipv6addr_t));
|
||||||
ipaddr[0] = HTONS(0xfe80);
|
ipaddr[0] = HTONS(0xfe80);
|
||||||
|
|
||||||
#if CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 2
|
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
|
memcpy(&ipaddr[4], rime, NET_6LOWPAN_RIMEADDR_SIZE);
|
||||||
|
ipaddr[4] ^= HTONS(0x0200);
|
||||||
|
#else
|
||||||
ipaddr[5] = HTONS(0x00ff);
|
ipaddr[5] = HTONS(0x00ff);
|
||||||
ipaddr[6] = HTONS(0xfe00);
|
ipaddr[6] = HTONS(0xfe00);
|
||||||
memcpy(&ipaddr[7], rime, CONFIG_NET_6LOWPAN_RIMEADDR_SIZE);
|
memcpy(&ipaddr[7], rime, NET_6LOWPAN_RIMEADDR_SIZE);
|
||||||
ipaddr[7] ^= HTONS(0x0200);
|
ipaddr[7] ^= HTONS(0x0200);
|
||||||
#else
|
|
||||||
memcpy(&ipaddr[4], rime, CONFIG_NET_6LOWPAN_RIMEADDR_SIZE);
|
|
||||||
ipaddr[4] ^= HTONS(0x0200);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,10 +119,10 @@ void sixlowpan_rimefromip(const net_ipv6addr_t ipaddr,
|
|||||||
|
|
||||||
DEBUGASSERT(ipaddr[0] == HTONS(0xfe80));
|
DEBUGASSERT(ipaddr[0] == HTONS(0xfe80));
|
||||||
|
|
||||||
#if CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 2
|
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
memcpy(rime, &ipaddr[7], CONFIG_NET_6LOWPAN_RIMEADDR_SIZE);
|
memcpy(rime, &ipaddr[4], NET_6LOWPAN_RIMEADDR_SIZE);
|
||||||
#else
|
#else
|
||||||
memcpy(rime, &ipaddr[4], CONFIG_NET_6LOWPAN_RIMEADDR_SIZE);
|
memcpy(rime, &ipaddr[7], NET_6LOWPAN_RIMEADDR_SIZE);
|
||||||
#endif
|
#endif
|
||||||
rime->u8[0] ^= 0x02;
|
rime->u8[0] ^= 0x02;
|
||||||
}
|
}
|
||||||
@ -145,14 +145,14 @@ bool sixlowpan_ismacbased(const net_ipv6addr_t ipaddr,
|
|||||||
{
|
{
|
||||||
FAR const uint8_t *rimeptr = rime->u8;
|
FAR const uint8_t *rimeptr = rime->u8;
|
||||||
|
|
||||||
#if CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 2
|
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
return (ipaddr[5] == HTONS(0x00ff) && ipaddr[6] == HTONS(0xfe00) &&
|
|
||||||
ipaddr[7] == htons((GETINT16(rimeptr, 0) ^ 0x0200)));
|
|
||||||
#else /* CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 8 */
|
|
||||||
return (ipaddr[4] == htons((GETINT16(rimeptr, 0) ^ 0x0200)) &&
|
return (ipaddr[4] == htons((GETINT16(rimeptr, 0) ^ 0x0200)) &&
|
||||||
ipaddr[5] == GETINT16(rimeptr, 2) &&
|
ipaddr[5] == GETINT16(rimeptr, 2) &&
|
||||||
ipaddr[6] == GETINT16(rimeptr, 4) &&
|
ipaddr[6] == GETINT16(rimeptr, 4) &&
|
||||||
ipaddr[7] == GETINT16(rimeptr, 6));
|
ipaddr[7] == GETINT16(rimeptr, 6));
|
||||||
|
#else
|
||||||
|
return (ipaddr[5] == HTONS(0x00ff) && ipaddr[6] == HTONS(0xfe00) &&
|
||||||
|
ipaddr[7] == htons((GETINT16(rimeptr, 0) ^ 0x0200)));
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -195,57 +195,68 @@ static int lo_txpoll(FAR struct net_driver_s *dev)
|
|||||||
|
|
||||||
while (head != NULL)
|
while (head != NULL)
|
||||||
{
|
{
|
||||||
/* Remove the IOB from the queue */
|
/* Increment statistics */
|
||||||
|
|
||||||
iob = head;
|
NETDEV_RXPACKETS(&priv->lo_ieee.i_dev);
|
||||||
head = iob->io_flink;
|
|
||||||
iob->io_flink = NULL;
|
|
||||||
|
|
||||||
/* Is the queue now empty? */
|
/* Remove the IOB from the queue */
|
||||||
|
|
||||||
if (head == NULL)
|
iob = head;
|
||||||
{
|
head = iob->io_flink;
|
||||||
tail = NULL;
|
iob->io_flink = NULL;
|
||||||
}
|
|
||||||
|
|
||||||
/* Return the next frame to the network */
|
/* Is the queue now empty? */
|
||||||
|
|
||||||
iob->io_flink = NULL;
|
if (head == NULL)
|
||||||
priv->lo_ieee.i_framelist = iob;
|
{
|
||||||
|
tail = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
ninfo("Send frame %p to the network. Length=%u\n", iob, iob->io_len);
|
/* Return the next frame to the network */
|
||||||
ret = sixlowpan_input(&priv->lo_ieee);
|
|
||||||
if (ret < 0)
|
|
||||||
{
|
|
||||||
nerr("ERROR: sixlowpan_input returned %d\n", ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* What if the network responds with more frames to send? */
|
iob->io_flink = NULL;
|
||||||
|
priv->lo_ieee.i_framelist = iob;
|
||||||
|
|
||||||
if (priv->lo_ieee.i_framelist != NULL)
|
ninfo("Send frame %p to the network. Length=%u\n", iob, iob->io_len);
|
||||||
{
|
ret = sixlowpan_input(&priv->lo_ieee);
|
||||||
/* Append the new list to the tail of the queue */
|
|
||||||
|
|
||||||
iob = priv->lo_ieee.i_framelist;
|
/* Increment statistics */
|
||||||
priv->lo_ieee.i_framelist = NULL;
|
|
||||||
|
|
||||||
if (tail == NULL)
|
NETDEV_TXPACKETS(&priv->lo_ieee.i_dev);
|
||||||
{
|
|
||||||
head = iob;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tail->io_flink = iob;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Find the new tail of the IOB queue */
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
nerr("ERROR: sixlowpan_input returned %d\n", ret);
|
||||||
|
NETDEV_TXERRORS(&priv->lo_ieee.i_dev);
|
||||||
|
NETDEV_ERRORS(&priv->lo_ieee.i_dev);
|
||||||
|
}
|
||||||
|
|
||||||
for (tail = iob, iob = iob->io_flink;
|
/* What if the network responds with more frames to send? */
|
||||||
iob != NULL;
|
|
||||||
tail = iob, iob = iob->io_flink);
|
|
||||||
}
|
|
||||||
|
|
||||||
priv->lo_txdone = true;
|
if (priv->lo_ieee.i_framelist != NULL)
|
||||||
|
{
|
||||||
|
/* Append the new list to the tail of the queue */
|
||||||
|
|
||||||
|
iob = priv->lo_ieee.i_framelist;
|
||||||
|
priv->lo_ieee.i_framelist = NULL;
|
||||||
|
|
||||||
|
if (tail == NULL)
|
||||||
|
{
|
||||||
|
head = iob;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tail->io_flink = iob;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find the new tail of the IOB queue */
|
||||||
|
|
||||||
|
for (tail = iob, iob = iob->io_flink;
|
||||||
|
iob != NULL;
|
||||||
|
tail = iob, iob = iob->io_flink);
|
||||||
|
}
|
||||||
|
|
||||||
|
priv->lo_txdone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
@ -352,17 +363,17 @@ static int lo_ifup(FAR struct net_driver_s *dev)
|
|||||||
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
|
dev->d_ipv6addr[3], dev->d_ipv6addr[4], dev->d_ipv6addr[5],
|
||||||
dev->d_ipv6addr[6], dev->d_ipv6addr[7]);
|
dev->d_ipv6addr[6], dev->d_ipv6addr[7]);
|
||||||
|
|
||||||
#if CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 2
|
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
ninfo(" Node: %02x:%02x PANID=%04x\n",
|
|
||||||
priv->lo_ieee.i_nodeaddr.u8[0], priv->lo_ieee.i_nodeaddr.u8[1],
|
|
||||||
priv->lo_ieee.i_panid);
|
|
||||||
#else /* CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 8 */
|
|
||||||
ninfo(" Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x PANID=%04x\n",
|
ninfo(" Node: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x PANID=%04x\n",
|
||||||
priv->lo_ieee.i_nodeaddr.u8[0], priv->lo_ieee.i_nodeaddr.u8[1],
|
priv->lo_ieee.i_nodeaddr.u8[0], priv->lo_ieee.i_nodeaddr.u8[1],
|
||||||
priv->lo_ieee.i_nodeaddr.u8[2], priv->lo_ieee.i_nodeaddr.u8[3],
|
priv->lo_ieee.i_nodeaddr.u8[2], priv->lo_ieee.i_nodeaddr.u8[3],
|
||||||
priv->lo_ieee.i_nodeaddr.u8[4], priv->lo_ieee.i_nodeaddr.u8[5],
|
priv->lo_ieee.i_nodeaddr.u8[4], priv->lo_ieee.i_nodeaddr.u8[5],
|
||||||
priv->lo_ieee.i_nodeaddr.u8[6], priv->lo_ieee.i_nodeaddr.u8[7],
|
priv->lo_ieee.i_nodeaddr.u8[6], priv->lo_ieee.i_nodeaddr.u8[7],
|
||||||
priv->lo_ieee.i_panid);
|
priv->lo_ieee.i_panid);
|
||||||
|
#else
|
||||||
|
ninfo(" Node: %02x:%02x PANID=%04x\n",
|
||||||
|
priv->lo_ieee.i_nodeaddr.u8[0], priv->lo_ieee.i_nodeaddr.u8[1],
|
||||||
|
priv->lo_ieee.i_panid);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Set and activate a timer process */
|
/* Set and activate a timer process */
|
||||||
@ -508,12 +519,12 @@ static int lo_txavail(FAR struct net_driver_s *dev)
|
|||||||
#if defined(CONFIG_NET_IGMP) || defined(CONFIG_NET_ICMPv6)
|
#if defined(CONFIG_NET_IGMP) || defined(CONFIG_NET_ICMPv6)
|
||||||
static int lo_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
static int lo_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||||
{
|
{
|
||||||
#if CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 2
|
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
ninfo("MAC: %02x:%02x\n",
|
|
||||||
mac[0], mac[1]);
|
|
||||||
#else /* CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 8 */
|
|
||||||
ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
|
ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], mac[6], mac[7]);
|
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], mac[6], mac[7]);
|
||||||
|
#else
|
||||||
|
ninfo("MAC: %02x:%02x\n",
|
||||||
|
mac[0], mac[1]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* There is no multicast support in the loopback driver */
|
/* There is no multicast support in the loopback driver */
|
||||||
@ -543,12 +554,12 @@ static int lo_addmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
|||||||
#ifdef CONFIG_NET_IGMP
|
#ifdef CONFIG_NET_IGMP
|
||||||
static int lo_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
static int lo_rmmac(FAR struct net_driver_s *dev, FAR const uint8_t *mac)
|
||||||
{
|
{
|
||||||
#if CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 2
|
#ifdef CONFIG_NET_6LOWPAN_RIMEADDR_EXTENDED
|
||||||
ninfo("MAC: %02x:%02x\n",
|
|
||||||
mac[0], mac[1]);
|
|
||||||
#else /* CONFIG_NET_6LOWPAN_RIMEADDR_SIZE == 8 */
|
|
||||||
ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
|
ninfo("MAC: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
|
||||||
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], mac[6], mac[7]);
|
mac[0], mac[1], mac[2], mac[3], mac[4], mac[5], mac[6], mac[7]);
|
||||||
|
#else
|
||||||
|
ninfo("MAC: %02x:%02x\n",
|
||||||
|
mac[0], mac[1]);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* There is no multicast support in the loopback driver */
|
/* There is no multicast support in the loopback driver */
|
||||||
|
Loading…
Reference in New Issue
Block a user