Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Functions | Variables
eth.c File Reference
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/mm.h>
#include <linux/socket.h>
#include <linux/in.h>
#include <linux/inet.h>
#include <linux/ip.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/skbuff.h>
#include <linux/errno.h>
#include <linux/init.h>
#include <linux/if_ether.h>
#include <net/dst.h>
#include <net/arp.h>
#include <net/sock.h>
#include <net/ipv6.h>
#include <net/ip.h>
#include <net/dsa.h>
#include <asm/uaccess.h>

Go to the source code of this file.


 __setup ("ether=", netdev_boot_setup)
int eth_header (struct sk_buff *skb, struct net_device *dev, unsigned short type, const void *daddr, const void *saddr, unsigned int len)
 EXPORT_SYMBOL (eth_header)
int eth_rebuild_header (struct sk_buff *skb)
 EXPORT_SYMBOL (eth_rebuild_header)
__be16 eth_type_trans (struct sk_buff *skb, struct net_device *dev)
 EXPORT_SYMBOL (eth_type_trans)
int eth_header_parse (const struct sk_buff *skb, unsigned char *haddr)
 EXPORT_SYMBOL (eth_header_parse)
int eth_header_cache (const struct neighbour *neigh, struct hh_cache *hh, __be16 type)
 EXPORT_SYMBOL (eth_header_cache)
void eth_header_cache_update (struct hh_cache *hh, const struct net_device *dev, const unsigned char *haddr)
 EXPORT_SYMBOL (eth_header_cache_update)
int eth_mac_addr (struct net_device *dev, void *p)
 EXPORT_SYMBOL (eth_mac_addr)
int eth_change_mtu (struct net_device *dev, int new_mtu)
 EXPORT_SYMBOL (eth_change_mtu)
int eth_validate_addr (struct net_device *dev)
 EXPORT_SYMBOL (eth_validate_addr)
void ether_setup (struct net_device *dev)
 EXPORT_SYMBOL (ether_setup)
struct net_devicealloc_etherdev_mqs (int sizeof_priv, unsigned int txqs, unsigned int rxqs)
 EXPORT_SYMBOL (alloc_etherdev_mqs)
ssize_t sysfs_format_mac (char *buf, const unsigned char *addr, int len)
 EXPORT_SYMBOL (sysfs_format_mac)


struct header_ops eth_header_ops ____cacheline_aligned

Function Documentation

__setup ( )
struct net_device* alloc_etherdev_mqs ( int  sizeof_priv,
unsigned int  txqs,
unsigned int  rxqs 

alloc_etherdev_mqs - Allocates and sets up an Ethernet device : Size of additional driver-private structure to be allocated for this Ethernet device : The number of TX queues this device has. : The number of RX queues this device has.

Fill in the fields of the device structure with Ethernet-generic values. Basically does everything except registering the device.

Constructs a new net device, complete with a private data area of size (sizeof_priv). A 32-byte (not bit) alignment is enforced for this private data area.

Definition at line 370 of file eth.c.

int eth_change_mtu ( struct net_device dev,
int  new_mtu 

eth_change_mtu - set new MTU size : network device : new Maximum Transfer Unit

Allow changing MTU size. Needs to be overridden for devices supporting jumbo frames.

Definition at line 307 of file eth.c.

int eth_header ( struct sk_buff skb,
struct net_device dev,
unsigned short  type,
const void daddr,
const void saddr,
unsigned int  len 

eth_header - create the Ethernet header : buffer to alter : source device : Ethernet type field : destination address (NULL leave destination address) : source address (NULL use device source address) : packet length (<= skb->len)

Set the protocol type. For a packet of type ETH_P_802_3/2 we put the length in here instead.

Definition at line 78 of file eth.c.

int eth_header_cache ( const struct neighbour neigh,
struct hh_cache hh,
__be16  type 

eth_header_cache - fill cache entry from neighbour : source neighbour : destination cache entry : Ethernet type field

Create an Ethernet header template from the neighbour.

Definition at line 238 of file eth.c.

void eth_header_cache_update ( struct hh_cache hh,
const struct net_device dev,
const unsigned char haddr 

eth_header_cache_update - update cache entry : destination cache entry : network device : new hardware address

Called by Address Resolution module to notify changes in address.

Definition at line 265 of file eth.c.

int eth_header_parse ( const struct sk_buff skb,
unsigned char haddr 

eth_header_parse - extract hardware address from packet : packet to extract header from : destination buffer

Definition at line 222 of file eth.c.

int eth_mac_addr ( struct net_device dev,
void p 

eth_mac_addr - set new Ethernet hardware address : network device : socket address

Change hardware address of device.

This doesn't change hardware matching, so needs to be overridden for most real devices.

Definition at line 284 of file eth.c.

int eth_rebuild_header ( struct sk_buff skb)

eth_rebuild_header- rebuild the Ethernet MAC header. : socket buffer to update

This is called after an ARP or IPV6 ndisc it's resolution on this sk_buff. We now let protocol (ARP) fill in the other fields.

This routine CANNOT use cached dst->neigh! Really, it is used only when dst->neigh is wrong.

Definition at line 125 of file eth.c.

__be16 eth_type_trans ( struct sk_buff skb,
struct net_device dev 

eth_type_trans - determine the packet's protocol ID. : received socket data : receiving network device

The rule here is that we assume 802.3 if the type field is short enough to be a length. This is normal practice and works for any 'now in use' protocol.

Definition at line 157 of file eth.c.

int eth_validate_addr ( struct net_device dev)

Definition at line 316 of file eth.c.

void ether_setup ( struct net_device dev)

ether_setup - setup Ethernet network device : network device

Fill in the fields of the device structure with Ethernet-generic values.

Definition at line 339 of file eth.c.

EXPORT_SYMBOL ( eth_header  )
EXPORT_SYMBOL ( eth_rebuild_header  )
EXPORT_SYMBOL ( eth_type_trans  )
EXPORT_SYMBOL ( eth_header_parse  )
EXPORT_SYMBOL ( eth_header_cache  )
EXPORT_SYMBOL ( eth_header_cache_update  )
EXPORT_SYMBOL ( eth_mac_addr  )
EXPORT_SYMBOL ( eth_change_mtu  )
EXPORT_SYMBOL ( eth_validate_addr  )
EXPORT_SYMBOL ( ether_setup  )
EXPORT_SYMBOL ( alloc_etherdev_mqs  )
EXPORT_SYMBOL ( sysfs_format_mac  )
ssize_t sysfs_format_mac ( char buf,
const unsigned char addr,
int  len 

Definition at line 392 of file eth.c.

Variable Documentation

Initial value:
= {
.create = eth_header,
.parse = eth_header_parse,
.rebuild = eth_rebuild_header,
.cache = eth_header_cache,
.cache_update = eth_header_cache_update,

Definition at line 325 of file eth.c.