From d7c90ae71bc95fedbf8444f46fa20566efb62bf0 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Fri, 18 Aug 2017 07:08:02 -0600 Subject: [PATCH] Update and move ieee802154.h socket header file. Fix some comments in net/pkt. --- include/{net => netpacket}/ieee802154.h | 9 ++++---- include/nuttx/net/pkt.h | 28 ++++++++++++++++++++---- net/pkt/pkt.h | 29 +++++++++++++++---------- net/pkt/pkt_input.c | 4 ++-- 4 files changed, 47 insertions(+), 23 deletions(-) rename include/{net => netpacket}/ieee802154.h (94%) diff --git a/include/net/ieee802154.h b/include/netpacket/ieee802154.h similarity index 94% rename from include/net/ieee802154.h rename to include/netpacket/ieee802154.h index 6ec18ced71..620f8aff81 100644 --- a/include/net/ieee802154.h +++ b/include/netpacket/ieee802154.h @@ -33,8 +33,8 @@ * ****************************************************************************/ -#ifndef __INCLUDE_NET_IEEE802154_H -#define __INCLUDE_NET_IEEE802154_H +#ifndef __INCLUDE_NETPACKET_IEEE802154_H +#define __INCLUDE_NETPACKET_IEEE802154_H /**************************************************************************** * Included Files @@ -85,13 +85,12 @@ struct ieee802154_addr_s * bind() - Associates local address with socket * connect() - Associates a remote address with the socket (for send()) * sendto() - Send to specified remote address - * recvfrom()- Receive from specified remote address. + * recvfrom()- Receive from indicated remote address. */ struct sockaddr_ieee802154_s { sa_family_t sa_family; /* AF_IEEE802154 */ - uint8_t sa_msdu_handle; /* Data carried with MSDU */ struct ieee802154_addr_s sa_addr; /* Radio address */ }; @@ -99,4 +98,4 @@ struct sockaddr_ieee802154_s * Public Function Prototypes ****************************************************************************/ -#endif /* __INCLUDE_NET_IEEE802154_H */ +#endif /* __INCLUDE_NETPACKET_IEEE802154_H */ diff --git a/include/nuttx/net/pkt.h b/include/nuttx/net/pkt.h index 2c3515eb0b..03e4a0d22a 100644 --- a/include/nuttx/net/pkt.h +++ b/include/nuttx/net/pkt.h @@ -59,10 +59,30 @@ /**************************************************************************** * Public Function Prototypes ****************************************************************************/ -/* This function provides the interface between Ethernet device drivers and - * packet socket logic. All frames that are received should be provided to - * pkt_input() prior to other routing. - */ + +/**************************************************************************** + * Name: pkt_input + * + * Description: + * Handle incoming packet input + * + * This function provides the interface between Ethernet device drivers and + * packet socket logic. All frames that are received should be provided to + * pkt_input() prior to other routing. + * + * Parameters: + * dev - The device driver structure containing the received packet + * + * Return: + * OK The packet has been processed and can be deleted + * ERROR There is a matching connection, but could not dispatch the packet + * yet. Useful when a packet arrives before a recv call is in + * place. + * + * Assumptions: + * Called from the network diver with the network locked. + * + ****************************************************************************/ struct net_driver_s; /* Forward reference */ int pkt_input(FAR struct net_driver_s *dev); diff --git a/net/pkt/pkt.h b/net/pkt/pkt.h index 61dee0929a..5a930a3290 100644 --- a/net/pkt/pkt.h +++ b/net/pkt/pkt.h @@ -115,7 +115,7 @@ struct socket; /* Forward reference */ void pkt_initialize(void); /**************************************************************************** - * Name: pkt_palloc() + * Name: pkt_alloc() * * Description: * Allocate a new, uninitialized packet socket connection structure. This @@ -144,11 +144,11 @@ void pkt_free(FAR struct pkt_conn_s *conn); * connection to be used with the provided Ethernet header * * Assumptions: - * This function is called from UIP logic at interrupt level + * This function is called from network logic at with the network locked. * ****************************************************************************/ -struct pkt_conn_s *pkt_active(FAR struct eth_hdr_s *buf); +FAR struct pkt_conn_s *pkt_active(FAR struct eth_hdr_s *buf); /**************************************************************************** * Name: pkt_nextconn() @@ -157,12 +157,11 @@ struct pkt_conn_s *pkt_active(FAR struct eth_hdr_s *buf); * Traverse the list of allocated packet connections * * Assumptions: - * This function is called from UIP logic at interrupt level (or with - * interrupts disabled). + * This function is called from network logic at with the network locked. * ****************************************************************************/ -struct pkt_conn_s *pkt_nextconn(FAR struct pkt_conn_s *conn); +FAR struct pkt_conn_s *pkt_nextconn(FAR struct pkt_conn_s *conn); /**************************************************************************** * Name: pkt_callback @@ -174,7 +173,7 @@ struct pkt_conn_s *pkt_nextconn(FAR struct pkt_conn_s *conn); * OK if packet has been processed, otherwise ERROR. * * Assumptions: - * This function is called at the interrupt level with interrupts disabled. + * This function is called from network logic at with the network locked. * ****************************************************************************/ @@ -187,16 +186,21 @@ uint16_t pkt_callback(FAR struct net_driver_s *dev, * Description: * Handle incoming packet input * + * This function provides the interface between Ethernet device drivers and + * packet socket logic. All frames that are received should be provided to + * pkt_input() prior to other routing. + * * Parameters: * dev - The device driver structure containing the received packet * * Return: - * OK The packet has been processed and can be deleted - * ERROR Hold the packet and try again later. There is a listening socket - * but no recv in place to catch the packet yet. + * OK The packet has been processed and can be deleted + * ERROR There is a matching connection, but could not dispatch the packet + * yet. Useful when a packet arrives before a recv call is in + * place. * * Assumptions: - * Called from the interrupt level or with interrupts disabled. + * Called from the network diver with the network locked. * ****************************************************************************/ @@ -267,7 +271,8 @@ FAR struct net_driver_s *pkt_find_device(FAR struct pkt_conn_s *conn); * None * * Assumptions: - * Called from the interrupt level or with interrupts disabled. + * Called from the network device interface (devif) with the network + * locked. * ****************************************************************************/ diff --git a/net/pkt/pkt_input.c b/net/pkt/pkt_input.c index 5deaa3c617..1c69e0b559 100644 --- a/net/pkt/pkt_input.c +++ b/net/pkt/pkt_input.c @@ -76,8 +76,8 @@ * Return: * OK The packet has been processed and can be deleted * ERROR There is a matching connection, but could not dispatch the packet - * yet. Currently useful for UDP when a packet arrives before a recv - * call is in place. + * yet. Useful when a packet arrives before a recv call is in + * place. * * Assumptions: * Called from the interrupt level or with interrupts disabled.