aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/atmdev.h17
-rw-r--r--include/linux/can/platform/flexcan.h20
-rw-r--r--include/linux/etherdevice.h14
-rw-r--r--include/linux/ethtool.h2
-rw-r--r--include/linux/if_macvlan.h2
-rw-r--r--include/linux/ipv6.h2
-rw-r--r--include/linux/ks8842.h4
-rw-r--r--include/linux/mv643xx_eth.h5
-rw-r--r--include/linux/net.h3
-rw-r--r--include/linux/netdevice.h99
-rw-r--r--include/linux/phy.h24
-rw-r--r--include/linux/ptp_classify.h126
-rw-r--r--include/linux/rtnetlink.h1
-rw-r--r--include/linux/skbuff.h55
14 files changed, 321 insertions, 53 deletions
diff --git a/include/linux/atmdev.h b/include/linux/atmdev.h
index 817b23705c91..f6481daf6e52 100644
--- a/include/linux/atmdev.h
+++ b/include/linux/atmdev.h
@@ -431,6 +431,14 @@ struct atm_dev *atm_dev_register(const char *type,const struct atmdev_ops *ops,
431 int number,unsigned long *flags); /* number == -1: pick first available */ 431 int number,unsigned long *flags); /* number == -1: pick first available */
432struct atm_dev *atm_dev_lookup(int number); 432struct atm_dev *atm_dev_lookup(int number);
433void atm_dev_deregister(struct atm_dev *dev); 433void atm_dev_deregister(struct atm_dev *dev);
434
435/* atm_dev_signal_change
436 *
437 * Propagate lower layer signal change in atm_dev->signal to netdevice.
438 * The event will be sent via a notifier call chain.
439 */
440void atm_dev_signal_change(struct atm_dev *dev, char signal);
441
434void vcc_insert_socket(struct sock *sk); 442void vcc_insert_socket(struct sock *sk);
435 443
436 444
@@ -510,6 +518,15 @@ void register_atm_ioctl(struct atm_ioctl *);
510 */ 518 */
511void deregister_atm_ioctl(struct atm_ioctl *); 519void deregister_atm_ioctl(struct atm_ioctl *);
512 520
521
522/* register_atmdevice_notifier - register atm_dev notify events
523 *
524 * Clients like br2684 will register notify events
525 * Currently we notify of signal found/lost
526 */
527int register_atmdevice_notifier(struct notifier_block *nb);
528void unregister_atmdevice_notifier(struct notifier_block *nb);
529
513#endif /* __KERNEL__ */ 530#endif /* __KERNEL__ */
514 531
515#endif 532#endif
diff --git a/include/linux/can/platform/flexcan.h b/include/linux/can/platform/flexcan.h
new file mode 100644
index 000000000000..72b713ab57e9
--- /dev/null
+++ b/include/linux/can/platform/flexcan.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2010 Marc Kleine-Budde <kernel@pengutronix.de>
3 *
4 * This file is released under the GPLv2
5 *
6 */
7
8#ifndef __CAN_PLATFORM_FLEXCAN_H
9#define __CAN_PLATFORM_FLEXCAN_H
10
11/**
12 * struct flexcan_platform_data - flex CAN controller platform data
13 * @transceiver_enable: - called to power on/off the transceiver
14 *
15 */
16struct flexcan_platform_data {
17 void (*transceiver_switch)(int enable);
18};
19
20#endif /* __CAN_PLATFORM_FLEXCAN_H */
diff --git a/include/linux/etherdevice.h b/include/linux/etherdevice.h
index 3d7a6687d247..848480bc2bf9 100644
--- a/include/linux/etherdevice.h
+++ b/include/linux/etherdevice.h
@@ -127,6 +127,20 @@ static inline void random_ether_addr(u8 *addr)
127} 127}
128 128
129/** 129/**
130 * dev_hw_addr_random - Create random MAC and set device flag
131 * @dev: pointer to net_device structure
132 * @addr: Pointer to a six-byte array containing the Ethernet address
133 *
134 * Generate random MAC to be used by a device and set addr_assign_type
135 * so the state can be read by sysfs and be used by udev.
136 */
137static inline void dev_hw_addr_random(struct net_device *dev, u8 *hwaddr)
138{
139 dev->addr_assign_type |= NET_ADDR_RANDOM;
140 random_ether_addr(hwaddr);
141}
142
143/**
130 * compare_ether_addr - Compare two Ethernet addresses 144 * compare_ether_addr - Compare two Ethernet addresses
131 * @addr1: Pointer to a six-byte array containing the Ethernet address 145 * @addr1: Pointer to a six-byte array containing the Ethernet address
132 * @addr2: Pointer other six-byte array containing the Ethernet address 146 * @addr2: Pointer other six-byte array containing the Ethernet address
diff --git a/include/linux/ethtool.h b/include/linux/ethtool.h
index c1be61f3938b..991269e5b152 100644
--- a/include/linux/ethtool.h
+++ b/include/linux/ethtool.h
@@ -379,6 +379,8 @@ struct ethtool_rxnfc {
379 __u32 flow_type; 379 __u32 flow_type;
380 /* The rx flow hash value or the rule DB size */ 380 /* The rx flow hash value or the rule DB size */
381 __u64 data; 381 __u64 data;
382 /* The following fields are not valid and must not be used for
383 * the ETHTOOL_{G,X}RXFH commands. */
382 struct ethtool_rx_flow_spec fs; 384 struct ethtool_rx_flow_spec fs;
383 __u32 rule_cnt; 385 __u32 rule_cnt;
384 __u32 rule_locs[0]; 386 __u32 rule_locs[0];
diff --git a/include/linux/if_macvlan.h b/include/linux/if_macvlan.h
index e24ce6ea1fa3..35280b302290 100644
--- a/include/linux/if_macvlan.h
+++ b/include/linux/if_macvlan.h
@@ -72,6 +72,8 @@ static inline void macvlan_count_rx(const struct macvlan_dev *vlan,
72 } 72 }
73} 73}
74 74
75extern void macvlan_common_setup(struct net_device *dev);
76
75extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev, 77extern int macvlan_common_newlink(struct net *src_net, struct net_device *dev,
76 struct nlattr *tb[], struct nlattr *data[], 78 struct nlattr *tb[], struct nlattr *data[],
77 int (*receive)(struct sk_buff *skb), 79 int (*receive)(struct sk_buff *skb),
diff --git a/include/linux/ipv6.h b/include/linux/ipv6.h
index 940e21595351..ab9e9e89e407 100644
--- a/include/linux/ipv6.h
+++ b/include/linux/ipv6.h
@@ -246,7 +246,7 @@ struct inet6_skb_parm {
246 __u16 srcrt; 246 __u16 srcrt;
247 __u16 dst1; 247 __u16 dst1;
248 __u16 lastopt; 248 __u16 lastopt;
249 __u32 nhoff; 249 __u16 nhoff;
250 __u16 flags; 250 __u16 flags;
251#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE) 251#if defined(CONFIG_IPV6_MIP6) || defined(CONFIG_IPV6_MIP6_MODULE)
252 __u16 dsthao; 252 __u16 dsthao;
diff --git a/include/linux/ks8842.h b/include/linux/ks8842.h
index da0341b8ca0a..14ba4452296e 100644
--- a/include/linux/ks8842.h
+++ b/include/linux/ks8842.h
@@ -25,10 +25,14 @@
25 * struct ks8842_platform_data - Platform data of the KS8842 network driver 25 * struct ks8842_platform_data - Platform data of the KS8842 network driver
26 * @macaddr: The MAC address of the device, set to all 0:s to use the on in 26 * @macaddr: The MAC address of the device, set to all 0:s to use the on in
27 * the chip. 27 * the chip.
28 * @rx_dma_channel: The DMA channel to use for RX, -1 for none.
29 * @tx_dma_channel: The DMA channel to use for TX, -1 for none.
28 * 30 *
29 */ 31 */
30struct ks8842_platform_data { 32struct ks8842_platform_data {
31 u8 macaddr[ETH_ALEN]; 33 u8 macaddr[ETH_ALEN];
34 int rx_dma_channel;
35 int tx_dma_channel;
32}; 36};
33 37
34#endif 38#endif
diff --git a/include/linux/mv643xx_eth.h b/include/linux/mv643xx_eth.h
index cbbbe9bfecad..30b0c4e78f91 100644
--- a/include/linux/mv643xx_eth.h
+++ b/include/linux/mv643xx_eth.h
@@ -19,6 +19,11 @@ struct mv643xx_eth_shared_platform_data {
19 struct mbus_dram_target_info *dram; 19 struct mbus_dram_target_info *dram;
20 struct platform_device *shared_smi; 20 struct platform_device *shared_smi;
21 unsigned int t_clk; 21 unsigned int t_clk;
22 /*
23 * Max packet size for Tx IP/Layer 4 checksum, when set to 0, default
24 * limit of 9KiB will be used.
25 */
26 int tx_csum_limit;
22}; 27};
23 28
24#define MV643XX_ETH_PHY_ADDR_DEFAULT 0 29#define MV643XX_ETH_PHY_ADDR_DEFAULT 0
diff --git a/include/linux/net.h b/include/linux/net.h
index 2b4deeeb8646..dee0b11a8759 100644
--- a/include/linux/net.h
+++ b/include/linux/net.h
@@ -129,10 +129,9 @@ struct socket_wq {
129 * @type: socket type (%SOCK_STREAM, etc) 129 * @type: socket type (%SOCK_STREAM, etc)
130 * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc) 130 * @flags: socket flags (%SOCK_ASYNC_NOSPACE, etc)
131 * @ops: protocol specific socket operations 131 * @ops: protocol specific socket operations
132 * @fasync_list: Asynchronous wake up list
133 * @file: File back pointer for gc 132 * @file: File back pointer for gc
134 * @sk: internal networking protocol agnostic socket representation 133 * @sk: internal networking protocol agnostic socket representation
135 * @wait: wait queue for several uses 134 * @wq: wait queue for several uses
136 */ 135 */
137struct socket { 136struct socket {
138 socket_state state; 137 socket_state state;
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 4d27368674db..1bca6171b1aa 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -54,6 +54,7 @@
54 54
55struct vlan_group; 55struct vlan_group;
56struct netpoll_info; 56struct netpoll_info;
57struct phy_device;
57/* 802.11 specific */ 58/* 802.11 specific */
58struct wireless_dev; 59struct wireless_dev;
59 /* source back-compat hooks */ 60 /* source back-compat hooks */
@@ -65,6 +66,11 @@ struct wireless_dev;
65#define HAVE_FREE_NETDEV /* free_netdev() */ 66#define HAVE_FREE_NETDEV /* free_netdev() */
66#define HAVE_NETDEV_PRIV /* netdev_priv() */ 67#define HAVE_NETDEV_PRIV /* netdev_priv() */
67 68
69/* hardware address assignment types */
70#define NET_ADDR_PERM 0 /* address is permanent (default) */
71#define NET_ADDR_RANDOM 1 /* address is generated randomly */
72#define NET_ADDR_STOLEN 2 /* address is stolen from other device */
73
68/* Backlog congestion levels */ 74/* Backlog congestion levels */
69#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */ 75#define NET_RX_SUCCESS 0 /* keep 'em coming, baby */
70#define NET_RX_DROP 1 /* packet dropped */ 76#define NET_RX_DROP 1 /* packet dropped */
@@ -162,42 +168,32 @@ static inline bool dev_xmit_complete(int rc)
162/* 168/*
163 * Old network device statistics. Fields are native words 169 * Old network device statistics. Fields are native words
164 * (unsigned long) so they can be read and written atomically. 170 * (unsigned long) so they can be read and written atomically.
165 * Each field is padded to 64 bits for compatibility with
166 * rtnl_link_stats64.
167 */ 171 */
168 172
169#if BITS_PER_LONG == 64
170#define NET_DEVICE_STATS_DEFINE(name) unsigned long name
171#elif defined(__LITTLE_ENDIAN)
172#define NET_DEVICE_STATS_DEFINE(name) unsigned long name, pad_ ## name
173#else
174#define NET_DEVICE_STATS_DEFINE(name) unsigned long pad_ ## name, name
175#endif
176
177struct net_device_stats { 173struct net_device_stats {
178 NET_DEVICE_STATS_DEFINE(rx_packets); 174 unsigned long rx_packets;
179 NET_DEVICE_STATS_DEFINE(tx_packets); 175 unsigned long tx_packets;
180 NET_DEVICE_STATS_DEFINE(rx_bytes); 176 unsigned long rx_bytes;
181 NET_DEVICE_STATS_DEFINE(tx_bytes); 177 unsigned long tx_bytes;
182 NET_DEVICE_STATS_DEFINE(rx_errors); 178 unsigned long rx_errors;
183 NET_DEVICE_STATS_DEFINE(tx_errors); 179 unsigned long tx_errors;
184 NET_DEVICE_STATS_DEFINE(rx_dropped); 180 unsigned long rx_dropped;
185 NET_DEVICE_STATS_DEFINE(tx_dropped); 181 unsigned long tx_dropped;
186 NET_DEVICE_STATS_DEFINE(multicast); 182 unsigned long multicast;
187 NET_DEVICE_STATS_DEFINE(collisions); 183 unsigned long collisions;
188 NET_DEVICE_STATS_DEFINE(rx_length_errors); 184 unsigned long rx_length_errors;
189 NET_DEVICE_STATS_DEFINE(rx_over_errors); 185 unsigned long rx_over_errors;
190 NET_DEVICE_STATS_DEFINE(rx_crc_errors); 186 unsigned long rx_crc_errors;
191 NET_DEVICE_STATS_DEFINE(rx_frame_errors); 187 unsigned long rx_frame_errors;
192 NET_DEVICE_STATS_DEFINE(rx_fifo_errors); 188 unsigned long rx_fifo_errors;
193 NET_DEVICE_STATS_DEFINE(rx_missed_errors); 189 unsigned long rx_missed_errors;
194 NET_DEVICE_STATS_DEFINE(tx_aborted_errors); 190 unsigned long tx_aborted_errors;
195 NET_DEVICE_STATS_DEFINE(tx_carrier_errors); 191 unsigned long tx_carrier_errors;
196 NET_DEVICE_STATS_DEFINE(tx_fifo_errors); 192 unsigned long tx_fifo_errors;
197 NET_DEVICE_STATS_DEFINE(tx_heartbeat_errors); 193 unsigned long tx_heartbeat_errors;
198 NET_DEVICE_STATS_DEFINE(tx_window_errors); 194 unsigned long tx_window_errors;
199 NET_DEVICE_STATS_DEFINE(rx_compressed); 195 unsigned long rx_compressed;
200 NET_DEVICE_STATS_DEFINE(tx_compressed); 196 unsigned long tx_compressed;
201}; 197};
202 198
203#endif /* __KERNEL__ */ 199#endif /* __KERNEL__ */
@@ -510,9 +506,9 @@ struct netdev_queue {
510 * please use this field instead of dev->trans_start 506 * please use this field instead of dev->trans_start
511 */ 507 */
512 unsigned long trans_start; 508 unsigned long trans_start;
513 unsigned long tx_bytes; 509 u64 tx_bytes;
514 unsigned long tx_packets; 510 u64 tx_packets;
515 unsigned long tx_dropped; 511 u64 tx_dropped;
516} ____cacheline_aligned_in_smp; 512} ____cacheline_aligned_in_smp;
517 513
518#ifdef CONFIG_RPS 514#ifdef CONFIG_RPS
@@ -666,13 +662,13 @@ struct netdev_rx_queue {
666 * Callback uses when the transmitter has not made any progress 662 * Callback uses when the transmitter has not made any progress
667 * for dev->watchdog ticks. 663 * for dev->watchdog ticks.
668 * 664 *
669 * struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev); 665 * struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
666 * struct rtnl_link_stats64 *storage);
670 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 667 * struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
671 * Called when a user wants to get the network device usage 668 * Called when a user wants to get the network device usage
672 * statistics. Drivers must do one of the following: 669 * statistics. Drivers must do one of the following:
673 * 1. Define @ndo_get_stats64 to update a rtnl_link_stats64 structure 670 * 1. Define @ndo_get_stats64 to fill in a zero-initialised
674 * (which should normally be dev->stats64) and return a ponter to 671 * rtnl_link_stats64 structure passed by the caller.
675 * it. The structure must not be changed asynchronously.
676 * 2. Define @ndo_get_stats to update a net_device_stats structure 672 * 2. Define @ndo_get_stats to update a net_device_stats structure
677 * (which should normally be dev->stats) and return a pointer to 673 * (which should normally be dev->stats) and return a pointer to
678 * it. The structure may be changed asynchronously only if each 674 * it. The structure may be changed asynchronously only if each
@@ -733,7 +729,8 @@ struct net_device_ops {
733 struct neigh_parms *); 729 struct neigh_parms *);
734 void (*ndo_tx_timeout) (struct net_device *dev); 730 void (*ndo_tx_timeout) (struct net_device *dev);
735 731
736 struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev); 732 struct rtnl_link_stats64* (*ndo_get_stats64)(struct net_device *dev,
733 struct rtnl_link_stats64 *storage);
737 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev); 734 struct net_device_stats* (*ndo_get_stats)(struct net_device *dev);
738 735
739 void (*ndo_vlan_rx_register)(struct net_device *dev, 736 void (*ndo_vlan_rx_register)(struct net_device *dev,
@@ -886,10 +883,7 @@ struct net_device {
886 int ifindex; 883 int ifindex;
887 int iflink; 884 int iflink;
888 885
889 union { 886 struct net_device_stats stats;
890 struct rtnl_link_stats64 stats64;
891 struct net_device_stats stats;
892 };
893 887
894#ifdef CONFIG_WIRELESS_EXT 888#ifdef CONFIG_WIRELESS_EXT
895 /* List of functions to handle Wireless Extensions (instead of ioctl). 889 /* List of functions to handle Wireless Extensions (instead of ioctl).
@@ -930,6 +924,7 @@ struct net_device {
930 924
931 /* Interface address info. */ 925 /* Interface address info. */
932 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */ 926 unsigned char perm_addr[MAX_ADDR_LEN]; /* permanent hw address */
927 unsigned char addr_assign_type; /* hw address assignment type */
933 unsigned char addr_len; /* hardware address length */ 928 unsigned char addr_len; /* hardware address length */
934 unsigned short dev_id; /* for shared network cards */ 929 unsigned short dev_id; /* for shared network cards */
935 930
@@ -1077,6 +1072,9 @@ struct net_device {
1077#endif 1072#endif
1078 /* n-tuple filter list attached to this device */ 1073 /* n-tuple filter list attached to this device */
1079 struct ethtool_rx_ntuple_list ethtool_ntuple_list; 1074 struct ethtool_rx_ntuple_list ethtool_ntuple_list;
1075
1076 /* phy device may attach itself for hardware timestamping */
1077 struct phy_device *phydev;
1080}; 1078};
1081#define to_net_dev(d) container_of(d, struct net_device, dev) 1079#define to_net_dev(d) container_of(d, struct net_device, dev)
1082 1080
@@ -1672,6 +1670,9 @@ static inline int netif_is_multiqueue(const struct net_device *dev)
1672 return (dev->num_tx_queues > 1); 1670 return (dev->num_tx_queues > 1);
1673} 1671}
1674 1672
1673extern void netif_set_real_num_tx_queues(struct net_device *dev,
1674 unsigned int txq);
1675
1675/* Use this variant when it is known for sure that it 1676/* Use this variant when it is known for sure that it
1676 * is executing from hardware interrupt context or with hardware interrupts 1677 * is executing from hardware interrupt context or with hardware interrupts
1677 * disabled. 1678 * disabled.
@@ -2139,8 +2140,10 @@ extern void netdev_features_change(struct net_device *dev);
2139/* Load a device via the kmod */ 2140/* Load a device via the kmod */
2140extern void dev_load(struct net *net, const char *name); 2141extern void dev_load(struct net *net, const char *name);
2141extern void dev_mcast_init(void); 2142extern void dev_mcast_init(void);
2142extern const struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev); 2143extern struct rtnl_link_stats64 *dev_get_stats(struct net_device *dev,
2143extern void dev_txq_stats_fold(const struct net_device *dev, struct net_device_stats *stats); 2144 struct rtnl_link_stats64 *storage);
2145extern void dev_txq_stats_fold(const struct net_device *dev,
2146 struct rtnl_link_stats64 *stats);
2144 2147
2145extern int netdev_max_backlog; 2148extern int netdev_max_backlog;
2146extern int netdev_tstamp_prequeue; 2149extern int netdev_tstamp_prequeue;
@@ -2356,7 +2359,7 @@ do { \
2356#endif 2359#endif
2357 2360
2358#if defined(VERBOSE_DEBUG) 2361#if defined(VERBOSE_DEBUG)
2359#define netif_vdbg netdev_dbg 2362#define netif_vdbg netif_dbg
2360#else 2363#else
2361#define netif_vdbg(priv, type, dev, format, args...) \ 2364#define netif_vdbg(priv, type, dev, format, args...) \
2362({ \ 2365({ \
diff --git a/include/linux/phy.h b/include/linux/phy.h
index 987e111f7b11..6b0a782c6224 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -234,6 +234,8 @@ enum phy_state {
234 PHY_RESUMING 234 PHY_RESUMING
235}; 235};
236 236
237struct sk_buff;
238
237/* phy_device: An instance of a PHY 239/* phy_device: An instance of a PHY
238 * 240 *
239 * drv: Pointer to the driver for this PHY instance 241 * drv: Pointer to the driver for this PHY instance
@@ -402,6 +404,26 @@ struct phy_driver {
402 /* Clears up any memory if needed */ 404 /* Clears up any memory if needed */
403 void (*remove)(struct phy_device *phydev); 405 void (*remove)(struct phy_device *phydev);
404 406
407 /* Handles SIOCSHWTSTAMP ioctl for hardware time stamping. */
408 int (*hwtstamp)(struct phy_device *phydev, struct ifreq *ifr);
409
410 /*
411 * Requests a Rx timestamp for 'skb'. If the skb is accepted,
412 * the phy driver promises to deliver it using netif_rx() as
413 * soon as a timestamp becomes available. One of the
414 * PTP_CLASS_ values is passed in 'type'. The function must
415 * return true if the skb is accepted for delivery.
416 */
417 bool (*rxtstamp)(struct phy_device *dev, struct sk_buff *skb, int type);
418
419 /*
420 * Requests a Tx timestamp for 'skb'. The phy driver promises
421 * to deliver it to the socket's error queue as soon as a
422 * timestamp becomes available. One of the PTP_CLASS_ values
423 * is passed in 'type'.
424 */
425 void (*txtstamp)(struct phy_device *dev, struct sk_buff *skb, int type);
426
405 struct device_driver driver; 427 struct device_driver driver;
406}; 428};
407#define to_phy_driver(d) container_of(d, struct phy_driver, driver) 429#define to_phy_driver(d) container_of(d, struct phy_driver, driver)
@@ -498,7 +520,7 @@ void phy_stop_machine(struct phy_device *phydev);
498int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd); 520int phy_ethtool_sset(struct phy_device *phydev, struct ethtool_cmd *cmd);
499int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd); 521int phy_ethtool_gset(struct phy_device *phydev, struct ethtool_cmd *cmd);
500int phy_mii_ioctl(struct phy_device *phydev, 522int phy_mii_ioctl(struct phy_device *phydev,
501 struct mii_ioctl_data *mii_data, int cmd); 523 struct ifreq *ifr, int cmd);
502int phy_start_interrupts(struct phy_device *phydev); 524int phy_start_interrupts(struct phy_device *phydev);
503void phy_print_status(struct phy_device *phydev); 525void phy_print_status(struct phy_device *phydev);
504struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id); 526struct phy_device* phy_device_create(struct mii_bus *bus, int addr, int phy_id);
diff --git a/include/linux/ptp_classify.h b/include/linux/ptp_classify.h
new file mode 100644
index 000000000000..943a85ab0020
--- /dev/null
+++ b/include/linux/ptp_classify.h
@@ -0,0 +1,126 @@
1/*
2 * PTP 1588 support
3 *
4 * This file implements a BPF that recognizes PTP event messages.
5 *
6 * Copyright (C) 2010 OMICRON electronics GmbH
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 */
22
23#ifndef _PTP_CLASSIFY_H_
24#define _PTP_CLASSIFY_H_
25
26#include <linux/if_ether.h>
27#include <linux/if_vlan.h>
28#include <linux/filter.h>
29#ifdef __KERNEL__
30#include <linux/in.h>
31#else
32#include <netinet/in.h>
33#endif
34
35#define PTP_CLASS_NONE 0x00 /* not a PTP event message */
36#define PTP_CLASS_V1 0x01 /* protocol version 1 */
37#define PTP_CLASS_V2 0x02 /* protocol version 2 */
38#define PTP_CLASS_VMASK 0x0f /* max protocol version is 15 */
39#define PTP_CLASS_IPV4 0x10 /* event in an IPV4 UDP packet */
40#define PTP_CLASS_IPV6 0x20 /* event in an IPV6 UDP packet */
41#define PTP_CLASS_L2 0x30 /* event in a L2 packet */
42#define PTP_CLASS_VLAN 0x40 /* event in a VLAN tagged L2 packet */
43#define PTP_CLASS_PMASK 0xf0 /* mask for the packet type field */
44
45#define PTP_CLASS_V1_IPV4 (PTP_CLASS_V1 | PTP_CLASS_IPV4)
46#define PTP_CLASS_V1_IPV6 (PTP_CLASS_V1 | PTP_CLASS_IPV6) /*probably DNE*/
47#define PTP_CLASS_V2_IPV4 (PTP_CLASS_V2 | PTP_CLASS_IPV4)
48#define PTP_CLASS_V2_IPV6 (PTP_CLASS_V2 | PTP_CLASS_IPV6)
49#define PTP_CLASS_V2_L2 (PTP_CLASS_V2 | PTP_CLASS_L2)
50#define PTP_CLASS_V2_VLAN (PTP_CLASS_V2 | PTP_CLASS_VLAN)
51
52#define PTP_EV_PORT 319
53
54#define OFF_ETYPE 12
55#define OFF_IHL 14
56#define OFF_FRAG 20
57#define OFF_PROTO4 23
58#define OFF_NEXT 6
59#define OFF_UDP_DST 2
60
61#define IP6_HLEN 40
62#define UDP_HLEN 8
63
64#define RELOFF_DST4 (ETH_HLEN + OFF_UDP_DST)
65#define OFF_DST6 (ETH_HLEN + IP6_HLEN + OFF_UDP_DST)
66#define OFF_PTP6 (ETH_HLEN + IP6_HLEN + UDP_HLEN)
67
68#define OP_AND (BPF_ALU | BPF_AND | BPF_K)
69#define OP_JEQ (BPF_JMP | BPF_JEQ | BPF_K)
70#define OP_JSET (BPF_JMP | BPF_JSET | BPF_K)
71#define OP_LDB (BPF_LD | BPF_B | BPF_ABS)
72#define OP_LDH (BPF_LD | BPF_H | BPF_ABS)
73#define OP_LDHI (BPF_LD | BPF_H | BPF_IND)
74#define OP_LDX (BPF_LDX | BPF_B | BPF_MSH)
75#define OP_OR (BPF_ALU | BPF_OR | BPF_K)
76#define OP_RETA (BPF_RET | BPF_A)
77#define OP_RETK (BPF_RET | BPF_K)
78
79static inline int ptp_filter_init(struct sock_filter *f, int len)
80{
81 if (OP_LDH == f[0].code)
82 return sk_chk_filter(f, len);
83 else
84 return 0;
85}
86
87#define PTP_FILTER \
88 {OP_LDH, 0, 0, OFF_ETYPE }, /* */ \
89 {OP_JEQ, 0, 12, ETH_P_IP }, /* f goto L20 */ \
90 {OP_LDB, 0, 0, OFF_PROTO4 }, /* */ \
91 {OP_JEQ, 0, 9, IPPROTO_UDP }, /* f goto L10 */ \
92 {OP_LDH, 0, 0, OFF_FRAG }, /* */ \
93 {OP_JSET, 7, 0, 0x1fff }, /* t goto L11 */ \
94 {OP_LDX, 0, 0, OFF_IHL }, /* */ \
95 {OP_LDHI, 0, 0, RELOFF_DST4 }, /* */ \
96 {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L12 */ \
97 {OP_LDHI, 0, 0, ETH_HLEN + UDP_HLEN }, /* */ \
98 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
99 {OP_OR, 0, 0, PTP_CLASS_IPV4 }, /* */ \
100 {OP_RETA, 0, 0, 0 }, /* */ \
101/*L1x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
102/*L20*/ {OP_JEQ, 0, 9, ETH_P_IPV6 }, /* f goto L40 */ \
103 {OP_LDB, 0, 0, ETH_HLEN + OFF_NEXT }, /* */ \
104 {OP_JEQ, 0, 6, IPPROTO_UDP }, /* f goto L30 */ \
105 {OP_LDH, 0, 0, OFF_DST6 }, /* */ \
106 {OP_JEQ, 0, 4, PTP_EV_PORT }, /* f goto L31 */ \
107 {OP_LDH, 0, 0, OFF_PTP6 }, /* */ \
108 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
109 {OP_OR, 0, 0, PTP_CLASS_IPV6 }, /* */ \
110 {OP_RETA, 0, 0, 0 }, /* */ \
111/*L3x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE }, /* */ \
112/*L40*/ {OP_JEQ, 0, 6, ETH_P_8021Q }, /* f goto L50 */ \
113 {OP_LDH, 0, 0, OFF_ETYPE + 4 }, /* */ \
114 {OP_JEQ, 0, 9, ETH_P_1588 }, /* f goto L60 */ \
115 {OP_LDH, 0, 0, ETH_HLEN + VLAN_HLEN }, /* */ \
116 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
117 {OP_OR, 0, 0, PTP_CLASS_VLAN }, /* */ \
118 {OP_RETA, 0, 0, 0 }, /* */ \
119/*L50*/ {OP_JEQ, 0, 4, ETH_P_1588 }, /* f goto L61 */ \
120 {OP_LDH, 0, 0, ETH_HLEN }, /* */ \
121 {OP_AND, 0, 0, PTP_CLASS_VMASK }, /* */ \
122 {OP_OR, 0, 0, PTP_CLASS_L2 }, /* */ \
123 {OP_RETA, 0, 0, 0 }, /* */ \
124/*L6x*/ {OP_RETK, 0, 0, PTP_CLASS_NONE },
125
126#endif
diff --git a/include/linux/rtnetlink.h b/include/linux/rtnetlink.h
index fbc8cb0d48c3..58d44491880f 100644
--- a/include/linux/rtnetlink.h
+++ b/include/linux/rtnetlink.h
@@ -282,6 +282,7 @@ enum rtattr_type_t {
282 RTA_SESSION, /* no longer used */ 282 RTA_SESSION, /* no longer used */
283 RTA_MP_ALGO, /* no longer used */ 283 RTA_MP_ALGO, /* no longer used */
284 RTA_TABLE, 284 RTA_TABLE,
285 RTA_MARK,
285 __RTA_MAX 286 __RTA_MAX
286}; 287};
287 288
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index ac74ee085d74..d89876b806a0 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -202,10 +202,11 @@ struct skb_shared_info {
202 */ 202 */
203 atomic_t dataref; 203 atomic_t dataref;
204 204
205 skb_frag_t frags[MAX_SKB_FRAGS];
206 /* Intermediate layers must ensure that destructor_arg 205 /* Intermediate layers must ensure that destructor_arg
207 * remains valid until skb destructor */ 206 * remains valid until skb destructor */
208 void * destructor_arg; 207 void * destructor_arg;
208 /* must be last field, see pskb_expand_head() */
209 skb_frag_t frags[MAX_SKB_FRAGS];
209}; 210};
210 211
211/* We divide dataref into two halves. The higher 16 bits hold references 212/* We divide dataref into two halves. The higher 16 bits hold references
@@ -1933,6 +1934,36 @@ static inline ktime_t net_invalid_timestamp(void)
1933 return ktime_set(0, 0); 1934 return ktime_set(0, 0);
1934} 1935}
1935 1936
1937extern void skb_timestamping_init(void);
1938
1939#ifdef CONFIG_NETWORK_PHY_TIMESTAMPING
1940
1941extern void skb_clone_tx_timestamp(struct sk_buff *skb);
1942extern bool skb_defer_rx_timestamp(struct sk_buff *skb);
1943
1944#else /* CONFIG_NETWORK_PHY_TIMESTAMPING */
1945
1946static inline void skb_clone_tx_timestamp(struct sk_buff *skb)
1947{
1948}
1949
1950static inline bool skb_defer_rx_timestamp(struct sk_buff *skb)
1951{
1952 return false;
1953}
1954
1955#endif /* !CONFIG_NETWORK_PHY_TIMESTAMPING */
1956
1957/**
1958 * skb_complete_tx_timestamp() - deliver cloned skb with tx timestamps
1959 *
1960 * @skb: clone of the the original outgoing packet
1961 * @hwtstamps: hardware time stamps
1962 *
1963 */
1964void skb_complete_tx_timestamp(struct sk_buff *skb,
1965 struct skb_shared_hwtstamps *hwtstamps);
1966
1936/** 1967/**
1937 * skb_tstamp_tx - queue clone of skb with send time stamps 1968 * skb_tstamp_tx - queue clone of skb with send time stamps
1938 * @orig_skb: the original outgoing packet 1969 * @orig_skb: the original outgoing packet
@@ -1947,6 +1978,28 @@ static inline ktime_t net_invalid_timestamp(void)
1947extern void skb_tstamp_tx(struct sk_buff *orig_skb, 1978extern void skb_tstamp_tx(struct sk_buff *orig_skb,
1948 struct skb_shared_hwtstamps *hwtstamps); 1979 struct skb_shared_hwtstamps *hwtstamps);
1949 1980
1981static inline void sw_tx_timestamp(struct sk_buff *skb)
1982{
1983 union skb_shared_tx *shtx = skb_tx(skb);
1984 if (shtx->software && !shtx->in_progress)
1985 skb_tstamp_tx(skb, NULL);
1986}
1987
1988/**
1989 * skb_tx_timestamp() - Driver hook for transmit timestamping
1990 *
1991 * Ethernet MAC Drivers should call this function in their hard_xmit()
1992 * function as soon as possible after giving the sk_buff to the MAC
1993 * hardware, but before freeing the sk_buff.
1994 *
1995 * @skb: A socket buffer.
1996 */
1997static inline void skb_tx_timestamp(struct sk_buff *skb)
1998{
1999 skb_clone_tx_timestamp(skb);
2000 sw_tx_timestamp(skb);
2001}
2002
1950extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len); 2003extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
1951extern __sum16 __skb_checksum_complete(struct sk_buff *skb); 2004extern __sum16 __skb_checksum_complete(struct sk_buff *skb);
1952 2005