aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorBen Greear <greearb@candelatech.com>2012-02-11 10:39:30 -0500
committerJeff Kirsher <jeffrey.t.kirsher@intel.com>2012-02-24 04:37:35 -0500
commit3bdc0eba0b8b47797f4a76e377dd8360f317450f (patch)
treeda6bd907f599402bc8db0a2484997fd4d3e06f7b /include
parent0184039a4b6727d6efd545919c773ef141090ae7 (diff)
net: Add framework to allow sending packets with customized CRC.
This is useful for testing RX handling of frames with bad CRCs. Requires driver support to actually put the packet on the wire properly. Signed-off-by: Ben Greear <greearb@candelatech.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'include')
-rw-r--r--include/asm-generic/socket.h4
-rw-r--r--include/linux/if.h2
-rw-r--r--include/linux/netdevice.h8
-rw-r--r--include/linux/skbuff.h4
-rw-r--r--include/net/sock.h4
5 files changed, 20 insertions, 2 deletions
diff --git a/include/asm-generic/socket.h b/include/asm-generic/socket.h
index d9aaac0c36d4..b1bea03274d5 100644
--- a/include/asm-generic/socket.h
+++ b/include/asm-generic/socket.h
@@ -68,4 +68,8 @@
68#define SO_WIFI_STATUS 41 68#define SO_WIFI_STATUS 41
69#define SCM_WIFI_STATUS SO_WIFI_STATUS 69#define SCM_WIFI_STATUS SO_WIFI_STATUS
70#define SO_PEEK_OFF 42 70#define SO_PEEK_OFF 42
71
72/* Instruct lower device to use last 4-bytes of skb data as FCS */
73#define SO_NOFCS 43
74
71#endif /* __ASM_GENERIC_SOCKET_H */ 75#endif /* __ASM_GENERIC_SOCKET_H */
diff --git a/include/linux/if.h b/include/linux/if.h
index 06b6ef60c821..f995c663c493 100644
--- a/include/linux/if.h
+++ b/include/linux/if.h
@@ -80,6 +80,8 @@
80 * skbs on transmit */ 80 * skbs on transmit */
81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */ 81#define IFF_UNICAST_FLT 0x20000 /* Supports unicast filtering */
82#define IFF_TEAM_PORT 0x40000 /* device used as team port */ 82#define IFF_TEAM_PORT 0x40000 /* device used as team port */
83#define IFF_SUPP_NOFCS 0x80000 /* device supports sending custom FCS */
84
83 85
84#define IF_GET_IFACE 0x0001 /* for querying only */ 86#define IF_GET_IFACE 0x0001 /* for querying only */
85#define IF_GET_PROTO 0x0002 87#define IF_GET_PROTO 0x0002
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 0eac07c95255..f1b7d037c2c5 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1082,7 +1082,8 @@ struct net_device {
1082 const struct header_ops *header_ops; 1082 const struct header_ops *header_ops;
1083 1083
1084 unsigned int flags; /* interface flags (a la BSD) */ 1084 unsigned int flags; /* interface flags (a la BSD) */
1085 unsigned int priv_flags; /* Like 'flags' but invisible to userspace. */ 1085 unsigned int priv_flags; /* Like 'flags' but invisible to userspace.
1086 * See if.h for definitions. */
1086 unsigned short gflags; 1087 unsigned short gflags;
1087 unsigned short padded; /* How much padding added by alloc_netdev() */ 1088 unsigned short padded; /* How much padding added by alloc_netdev() */
1088 1089
@@ -2650,6 +2651,11 @@ static inline int netif_is_bond_slave(struct net_device *dev)
2650 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING; 2651 return dev->flags & IFF_SLAVE && dev->priv_flags & IFF_BONDING;
2651} 2652}
2652 2653
2654static inline bool netif_supports_nofcs(struct net_device *dev)
2655{
2656 return dev->priv_flags & IFF_SUPP_NOFCS;
2657}
2658
2653extern struct pernet_operations __net_initdata loopback_net_ops; 2659extern struct pernet_operations __net_initdata loopback_net_ops;
2654 2660
2655/* Logging, debugging and troubleshooting/diagnostic helpers. */ 2661/* Logging, debugging and troubleshooting/diagnostic helpers. */
diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h
index c11a44ea1bf4..06a4c0fd7bef 100644
--- a/include/linux/skbuff.h
+++ b/include/linux/skbuff.h
@@ -361,6 +361,7 @@ typedef unsigned char *sk_buff_data_t;
361 * ports. 361 * ports.
362 * @wifi_acked_valid: wifi_acked was set 362 * @wifi_acked_valid: wifi_acked was set
363 * @wifi_acked: whether frame was acked on wifi or not 363 * @wifi_acked: whether frame was acked on wifi or not
364 * @no_fcs: Request NIC to treat last 4 bytes as Ethernet FCS
364 * @dma_cookie: a cookie to one of several possible DMA operations 365 * @dma_cookie: a cookie to one of several possible DMA operations
365 * done by skb DMA functions 366 * done by skb DMA functions
366 * @secmark: security marking 367 * @secmark: security marking
@@ -459,7 +460,8 @@ struct sk_buff {
459 __u8 l4_rxhash:1; 460 __u8 l4_rxhash:1;
460 __u8 wifi_acked_valid:1; 461 __u8 wifi_acked_valid:1;
461 __u8 wifi_acked:1; 462 __u8 wifi_acked:1;
462 /* 10/12 bit hole (depending on ndisc_nodetype presence) */ 463 __u8 no_fcs:1;
464 /* 9/11 bit hole (depending on ndisc_nodetype presence) */
463 kmemcheck_bitfield_end(flags2); 465 kmemcheck_bitfield_end(flags2);
464 466
465#ifdef CONFIG_NET_DMA 467#ifdef CONFIG_NET_DMA
diff --git a/include/net/sock.h b/include/net/sock.h
index 9c0553b9e451..ba761e7de252 100644
--- a/include/net/sock.h
+++ b/include/net/sock.h
@@ -615,6 +615,10 @@ enum sock_flags {
615 SOCK_RXQ_OVFL, 615 SOCK_RXQ_OVFL,
616 SOCK_ZEROCOPY, /* buffers from userspace */ 616 SOCK_ZEROCOPY, /* buffers from userspace */
617 SOCK_WIFI_STATUS, /* push wifi status to userspace */ 617 SOCK_WIFI_STATUS, /* push wifi status to userspace */
618 SOCK_NOFCS, /* Tell NIC not to do the Ethernet FCS.
619 * Will use last 4 bytes of packet sent from
620 * user-space instead.
621 */
618}; 622};
619 623
620static inline void sock_copy_flags(struct sock *nsk, struct sock *osk) 624static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)