mirror of
https://github.com/apache/nuttx.git
synced 2026-06-06 08:36:24 +08:00
Costmetic clean-up
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@2799 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
@@ -222,14 +222,17 @@ FAR struct igmp_group_s *uip_grpalloc(FAR struct uip_driver_s *dev,
|
|||||||
irqstate_t flags;
|
irqstate_t flags;
|
||||||
|
|
||||||
nllvdbg("addr: %08x dev: %p\n", *addr, dev);
|
nllvdbg("addr: %08x dev: %p\n", *addr, dev);
|
||||||
#if CONFIG_PREALLOC_IGMPGROUPS > 0
|
|
||||||
if (up_interrupt_context())
|
if (up_interrupt_context())
|
||||||
{
|
{
|
||||||
|
#if CONFIG_PREALLOC_IGMPGROUPS > 0
|
||||||
grplldbg("Use a pre-allocated group entry\n");
|
grplldbg("Use a pre-allocated group entry\n");
|
||||||
group = uip_grpprealloc();
|
group = uip_grpprealloc();
|
||||||
|
#else
|
||||||
|
grplldbg("Cannot allocate from interrupt handler\n");
|
||||||
|
group = NULL;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
grplldbg("Allocate from the heap\n");
|
grplldbg("Allocate from the heap\n");
|
||||||
group = uip_grpheapalloc();
|
group = uip_grpheapalloc();
|
||||||
|
|||||||
@@ -142,6 +142,11 @@ void uip_igmpinput(struct uip_driver_s *dev)
|
|||||||
|
|
||||||
destipaddr = uip_ip4addr_conv(IGMPBUF->destipaddr);
|
destipaddr = uip_ip4addr_conv(IGMPBUF->destipaddr);
|
||||||
group = uip_grpallocfind(dev, &destipaddr);
|
group = uip_grpallocfind(dev, &destipaddr);
|
||||||
|
if (!group)
|
||||||
|
{
|
||||||
|
nlldbg("Failed to allocate/find group: %08x\n", destipaddr);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Now handle the message based on the IGMP message type */
|
/* Now handle the message based on the IGMP message type */
|
||||||
|
|
||||||
@@ -210,7 +215,7 @@ void uip_igmpinput(struct uip_driver_s *dev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else /* if (group->grpaddr != 0) */
|
else /* if (IGMPBUF->grpaddr != 0) */
|
||||||
{
|
{
|
||||||
nllvdbg("Group-specific multicast queury\n");
|
nllvdbg("Group-specific multicast queury\n");
|
||||||
|
|
||||||
|
|||||||
@@ -151,6 +151,9 @@ int igmp_joingroup(struct uip_driver_s *dev, FAR const struct in_addr *grpaddr)
|
|||||||
uip_addmcastmac(dev, (FAR uip_ipaddr_t *)&grpaddr->s_addr);
|
uip_addmcastmac(dev, (FAR uip_ipaddr_t *)&grpaddr->s_addr);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return EEXIST if the address is already a member of the group */
|
||||||
|
|
||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,6 +173,8 @@ int igmp_leavegroup(struct uip_driver_s *dev, FAR const struct in_addr *grpaddr)
|
|||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return ENOENT if the address is not a member of the group */
|
||||||
|
|
||||||
nvdbg("Return -ENOENT\n");
|
nvdbg("Return -ENOENT\n");
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -162,14 +162,14 @@ void uip_igmpsend(FAR struct uip_driver_s *dev, FAR struct igmp_group_s *group,
|
|||||||
|
|
||||||
/* Set up the IGMP message */
|
/* Set up the IGMP message */
|
||||||
|
|
||||||
IGMPBUF->type = group->msgid;
|
IGMPBUF->type = group->msgid;
|
||||||
IGMPBUF->maxresp = 0;
|
IGMPBUF->maxresp = 0;
|
||||||
uiphdr_ipaddr_copy(IGMPBUF->grpaddr, &group->grpaddr);
|
uiphdr_ipaddr_copy(IGMPBUF->grpaddr, &group->grpaddr);
|
||||||
|
|
||||||
/* Calculate the IGMP checksum. */
|
/* Calculate the IGMP checksum. */
|
||||||
|
|
||||||
IGMPBUF->chksum = 0;
|
IGMPBUF->chksum = 0;
|
||||||
IGMPBUF->chksum = ~uip_igmpchksum(&IGMPBUF->type, UIP_IPIGMPH_LEN);
|
IGMPBUF->chksum = ~uip_igmpchksum(&IGMPBUF->type, UIP_IPIGMPH_LEN);
|
||||||
|
|
||||||
IGMP_STATINCR(uip_stats.igmp.poll_send);
|
IGMP_STATINCR(uip_stats.igmp.poll_send);
|
||||||
IGMP_STATINCR(uip_stats.ip.sent);
|
IGMP_STATINCR(uip_stats.ip.sent);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* net/uip/uip_igmpleave.c
|
* net/uip/uip_igmptimer.c
|
||||||
*
|
*
|
||||||
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
* Copyright (C) 2010 Gregory Nutt. All rights reserved.
|
||||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||||
@@ -170,8 +170,8 @@ int uip_decisec2tick(int decisecs)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
return CLK_TCK * decisecs / 10;
|
return CLK_TCK * decisecs / 10;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
* Name: uip_igmpstartticks and uip_igmpstarttimer
|
* Name: uip_igmpstartticks and uip_igmpstarttimer
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user