Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions
datagram.c File Reference
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <asm/uaccess.h>
#include <linux/mm.h>
#include <linux/interrupt.h>
#include <linux/errno.h>
#include <linux/sched.h>
#include <linux/inet.h>
#include <linux/netdevice.h>
#include <linux/rtnetlink.h>
#include <linux/poll.h>
#include <linux/highmem.h>
#include <linux/spinlock.h>
#include <linux/slab.h>
#include <net/protocol.h>
#include <linux/skbuff.h>
#include <net/checksum.h>
#include <net/sock.h>
#include <net/tcp_states.h>
#include <trace/events/skb.h>

Go to the source code of this file.

Functions

struct sk_buff__skb_recv_datagram (struct sock *sk, unsigned int flags, int *peeked, int *off, int *err)
 
 EXPORT_SYMBOL (__skb_recv_datagram)
 
struct sk_buffskb_recv_datagram (struct sock *sk, unsigned int flags, int noblock, int *err)
 
 EXPORT_SYMBOL (skb_recv_datagram)
 
void skb_free_datagram (struct sock *sk, struct sk_buff *skb)
 
 EXPORT_SYMBOL (skb_free_datagram)
 
void skb_free_datagram_locked (struct sock *sk, struct sk_buff *skb)
 
 EXPORT_SYMBOL (skb_free_datagram_locked)
 
int skb_kill_datagram (struct sock *sk, struct sk_buff *skb, unsigned int flags)
 
 EXPORT_SYMBOL (skb_kill_datagram)
 
int skb_copy_datagram_iovec (const struct sk_buff *skb, int offset, struct iovec *to, int len)
 
 EXPORT_SYMBOL (skb_copy_datagram_iovec)
 
int skb_copy_datagram_const_iovec (const struct sk_buff *skb, int offset, const struct iovec *to, int to_offset, int len)
 
 EXPORT_SYMBOL (skb_copy_datagram_const_iovec)
 
int skb_copy_datagram_from_iovec (struct sk_buff *skb, int offset, const struct iovec *from, int from_offset, int len)
 
 EXPORT_SYMBOL (skb_copy_datagram_from_iovec)
 
__sum16 __skb_checksum_complete_head (struct sk_buff *skb, int len)
 
 EXPORT_SYMBOL (__skb_checksum_complete_head)
 
__sum16 __skb_checksum_complete (struct sk_buff *skb)
 
 EXPORT_SYMBOL (__skb_checksum_complete)
 
int skb_copy_and_csum_datagram_iovec (struct sk_buff *skb, int hlen, struct iovec *iov)
 
 EXPORT_SYMBOL (skb_copy_and_csum_datagram_iovec)
 
unsigned int datagram_poll (struct file *file, struct socket *sock, poll_table *wait)
 
 EXPORT_SYMBOL (datagram_poll)
 

Function Documentation

__sum16 __skb_checksum_complete ( struct sk_buff skb)

Definition at line 668 of file datagram.c.

__sum16 __skb_checksum_complete_head ( struct sk_buff skb,
int  len 
)

Definition at line 654 of file datagram.c.

struct sk_buff* __skb_recv_datagram ( struct sock sk,
unsigned int  flags,
int peeked,
int off,
int err 
)
read

__skb_recv_datagram - Receive a datagram skbuff : socket : MSG_ flags : an offset in bytes to peek skb from. Returns an offset within an skb where data actually starts : returns non-zero if this packet has been seen before : error code returned

Get a datagram skbuff, understands the peeking, nonblocking wakeups and possible races. This replaces identical code in packet, raw and udp, as well as the IPX AX.25 and Appletalk. It also finally fixes the long standing peek and read race for datagram sockets. If you alter this routine remember it must be re-entrant.

This function will lock the socket if a skb is returned, so the caller needs to unlock the socket in that case (usually by calling skb_free_datagram)

  • It does not lock socket since today. This function is
  • free of race conditions. This measure should/can improve
  • significantly datagram socket latencies at high loads,
  • when data copying to user space takes lots of time.
  • (BTW I've just killed the last cli() in IP/IPv6/core/netlink/packet
  • 8) Great win.)
  • –ANK (980729)

The order of the tests when we find no data waiting are specified quite explicitly by POSIX 1003.1g, don't change them without having the standard around please.

Definition at line 161 of file datagram.c.

unsigned int datagram_poll ( struct file file,
struct socket sock,
poll_table wait 
)

Definition at line 741 of file datagram.c.

EXPORT_SYMBOL ( __skb_recv_datagram  )
EXPORT_SYMBOL ( skb_recv_datagram  )
EXPORT_SYMBOL ( skb_free_datagram  )
EXPORT_SYMBOL ( skb_free_datagram_locked  )
EXPORT_SYMBOL ( skb_kill_datagram  )
EXPORT_SYMBOL ( skb_copy_datagram_iovec  )
EXPORT_SYMBOL ( skb_copy_datagram_const_iovec  )
EXPORT_SYMBOL ( skb_copy_datagram_from_iovec  )
EXPORT_SYMBOL ( __skb_checksum_complete_head  )
EXPORT_SYMBOL ( __skb_checksum_complete  )
EXPORT_SYMBOL ( skb_copy_and_csum_datagram_iovec  )
EXPORT_SYMBOL ( datagram_poll  )
int skb_copy_and_csum_datagram_iovec ( struct sk_buff skb,
int  hlen,
struct iovec iov 
)

skb_copy_and_csum_datagram_iovec - Copy and checkum skb to user iovec. : skbuff : hardware length : io vector

Caller must check that skb will fit to this iovec.

Returns: 0 - success. -EINVAL - checksum failure. -EFAULT - fault during copy. Beware, in this case iovec can be modified!

Definition at line 687 of file datagram.c.

int skb_copy_datagram_const_iovec ( const struct sk_buff skb,
int  offset,
const struct iovec to,
int  to_offset,
int  len 
)

skb_copy_datagram_const_iovec - Copy a datagram to an iovec. : buffer to copy : offset in the buffer to start copying from : io vector to copy to : offset in the io vector to start copying to : amount of data to copy from buffer to iovec

Returns 0 or -EFAULT. Note: the iovec is not modified during the copy.

Definition at line 394 of file datagram.c.

int skb_copy_datagram_from_iovec ( struct sk_buff skb,
int  offset,
const struct iovec from,
int  from_offset,
int  len 
)

skb_copy_datagram_from_iovec - Copy a datagram from an iovec. : buffer to copy : offset in the buffer to start copying to : io vector to copy to : offset in the io vector to start copying from : amount of data to copy to buffer from iovec

Returns 0 or -EFAULT. Note: the iovec is not modified during the copy.

Definition at line 483 of file datagram.c.

int skb_copy_datagram_iovec ( const struct sk_buff skb,
int  offset,
struct iovec to,
int  len 
)

skb_copy_datagram_iovec - Copy a datagram to an iovec. : buffer to copy : offset in the buffer to start copying from : io vector to copy to : amount of data to copy from buffer to iovec

Note: the iovec is modified during the copy.

Definition at line 308 of file datagram.c.

void skb_free_datagram ( struct sock sk,
struct sk_buff skb 
)

Definition at line 229 of file datagram.c.

void skb_free_datagram_locked ( struct sock sk,
struct sk_buff skb 
)

Definition at line 236 of file datagram.c.

int skb_kill_datagram ( struct sock sk,
struct sk_buff skb,
unsigned int  flags 
)

skb_kill_datagram - Free a datagram skbuff forcibly : socket : datagram skbuff : MSG_ flags

This function frees a datagram skbuff that was received by skb_recv_datagram. The flags argument must match the one used for skb_recv_datagram.

If the MSG_PEEK flag is set, and the packet is still on the receive queue of the socket, it will be taken off the queue before it is freed.

This function currently only disables BH when acquiring the sk_receive_queue lock. Therefore it must not be used in a context where that lock is acquired in an IRQ context.

It returns 0 if the packet was removed by us.

Definition at line 276 of file datagram.c.

struct sk_buff* skb_recv_datagram ( struct sock sk,
unsigned int  flags,
int  noblock,
int err 
)
read

Definition at line 219 of file datagram.c.