Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 277772
b: refs/heads/master
c: 6e3e939
h: refs/heads/master
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Nov 9, 2011
1 parent 0248228 commit 689f20f
Show file tree
Hide file tree
Showing 24 changed files with 124 additions and 4 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4fdbff0770bea059621bc4906fb7c7f5879f3ae1
refs/heads/master: 6e3e939f3b1bf8534b32ad09ff199d88800835a0
3 changes: 3 additions & 0 deletions trunk/arch/alpha/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

/* O_NONBLOCK clashes with the bits used for socket types. Therefore we
* have to define SOCK_NONBLOCK to a different value here.
*/
Expand Down
3 changes: 3 additions & 0 deletions trunk/arch/arm/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#endif /* _ASM_SOCKET_H */
3 changes: 3 additions & 0 deletions trunk/arch/avr32/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#endif /* __ASM_AVR32_SOCKET_H */
3 changes: 3 additions & 0 deletions trunk/arch/cris/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#endif /* _ASM_SOCKET_H */


3 changes: 3 additions & 0 deletions trunk/arch/frv/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,8 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#endif /* _ASM_SOCKET_H */

3 changes: 3 additions & 0 deletions trunk/arch/h8300/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#endif /* _ASM_SOCKET_H */
3 changes: 3 additions & 0 deletions trunk/arch/ia64/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,4 +71,7 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#endif /* _ASM_IA64_SOCKET_H */
3 changes: 3 additions & 0 deletions trunk/arch/m32r/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#endif /* _ASM_M32R_SOCKET_H */
3 changes: 3 additions & 0 deletions trunk/arch/m68k/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#endif /* _ASM_SOCKET_H */
3 changes: 3 additions & 0 deletions trunk/arch/mips/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ To add: #define SO_REUSEPORT 0x0200 /* Allow local address and port reuse. */

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#ifdef __KERNEL__

/** sock_type - Socket types
Expand Down
3 changes: 3 additions & 0 deletions trunk/arch/mn10300/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,7 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#endif /* _ASM_SOCKET_H */
3 changes: 3 additions & 0 deletions trunk/arch/parisc/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@

#define SO_RXQ_OVFL 0x4021

#define SO_WIFI_STATUS 0x4022
#define SCM_WIFI_STATUS SO_WIFI_STATUS

/* O_NONBLOCK clashes with the bits used for socket types. Therefore we
* have to define SOCK_NONBLOCK to a different value here.
*/
Expand Down
3 changes: 3 additions & 0 deletions trunk/arch/powerpc/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,7 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#endif /* _ASM_POWERPC_SOCKET_H */
3 changes: 3 additions & 0 deletions trunk/arch/s390/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,7 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#endif /* _ASM_SOCKET_H */
3 changes: 3 additions & 0 deletions trunk/arch/sparc/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@

#define SO_RXQ_OVFL 0x0024

#define SO_WIFI_STATUS 0x0025
#define SCM_WIFI_STATUS SO_WIFI_STATUS

/* Security levels - as per NRL IPv6 - don't actually do anything */
#define SO_SECURITY_AUTHENTICATION 0x5001
#define SO_SECURITY_ENCRYPTION_TRANSPORT 0x5002
Expand Down
3 changes: 3 additions & 0 deletions trunk/arch/xtensa/include/asm/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,7 @@

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS

#endif /* _XTENSA_SOCKET_H */
3 changes: 3 additions & 0 deletions trunk/include/asm-generic/socket.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,7 @@
#define SO_DOMAIN 39

#define SO_RXQ_OVFL 40

#define SO_WIFI_STATUS 41
#define SCM_WIFI_STATUS SO_WIFI_STATUS
#endif /* __ASM_GENERIC_SOCKET_H */
3 changes: 2 additions & 1 deletion trunk/include/linux/errqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ struct sock_extended_err {
#define SO_EE_ORIGIN_LOCAL 1
#define SO_EE_ORIGIN_ICMP 2
#define SO_EE_ORIGIN_ICMP6 3
#define SO_EE_ORIGIN_TIMESTAMPING 4
#define SO_EE_ORIGIN_TXSTATUS 4
#define SO_EE_ORIGIN_TIMESTAMPING SO_EE_ORIGIN_TXSTATUS

#define SO_EE_OFFENDER(ee) ((struct sockaddr*)((ee)+1))

Expand Down
19 changes: 17 additions & 2 deletions trunk/include/linux/skbuff.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@ enum {

/* device driver supports TX zero-copy buffers */
SKBTX_DEV_ZEROCOPY = 1 << 4,

/* generate wifi status information (where possible) */
SKBTX_WIFI_STATUS = 1 << 5,
};

/*
Expand Down Expand Up @@ -352,6 +355,8 @@ typedef unsigned char *sk_buff_data_t;
* @ooo_okay: allow the mapping of a socket to a queue to be changed
* @l4_rxhash: indicate rxhash is a canonical 4-tuple hash over transport
* ports.
* @wifi_acked_valid: wifi_acked was set
* @wifi_acked: whether frame was acked on wifi or not
* @dma_cookie: a cookie to one of several possible DMA operations
* done by skb DMA functions
* @secmark: security marking
Expand Down Expand Up @@ -445,10 +450,11 @@ struct sk_buff {
#endif
__u8 ooo_okay:1;
__u8 l4_rxhash:1;
__u8 wifi_acked_valid:1;
__u8 wifi_acked:1;
/* 10/12 bit hole (depending on ndisc_nodetype presence) */
kmemcheck_bitfield_end(flags2);

/* 0/13 bit hole */

#ifdef CONFIG_NET_DMA
dma_cookie_t dma_cookie;
#endif
Expand Down Expand Up @@ -2263,6 +2269,15 @@ static inline void skb_tx_timestamp(struct sk_buff *skb)
sw_tx_timestamp(skb);
}

/**
* skb_complete_wifi_ack - deliver skb with wifi status
*
* @skb: the original outgoing packet
* @acked: ack status
*
*/
void skb_complete_wifi_ack(struct sk_buff *skb, bool acked);

extern __sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len);
extern __sum16 __skb_checksum_complete(struct sk_buff *skb);

Expand Down
6 changes: 6 additions & 0 deletions trunk/include/net/sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ enum sock_flags {
SOCK_FASYNC, /* fasync() active */
SOCK_RXQ_OVFL,
SOCK_ZEROCOPY, /* buffers from userspace */
SOCK_WIFI_STATUS, /* push wifi status to userspace */
};

static inline void sock_copy_flags(struct sock *nsk, struct sock *osk)
Expand Down Expand Up @@ -1714,6 +1715,8 @@ static inline int sock_intr_errno(long timeo)

extern void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb);
extern void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb);

static __inline__ void
sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
Expand Down Expand Up @@ -1741,6 +1744,9 @@ sock_recv_timestamp(struct msghdr *msg, struct sock *sk, struct sk_buff *skb)
__sock_recv_timestamp(msg, sk, skb);
else
sk->sk_stamp = kt;

if (sock_flag(sk, SOCK_WIFI_STATUS) && skb->wifi_acked_valid)
__sock_recv_wifi_status(msg, sk, skb);
}

extern void __sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
Expand Down
20 changes: 20 additions & 0 deletions trunk/net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -3168,6 +3168,26 @@ void skb_tstamp_tx(struct sk_buff *orig_skb,
}
EXPORT_SYMBOL_GPL(skb_tstamp_tx);

void skb_complete_wifi_ack(struct sk_buff *skb, bool acked)
{
struct sock *sk = skb->sk;
struct sock_exterr_skb *serr;
int err;

skb->wifi_acked_valid = 1;
skb->wifi_acked = acked;

serr = SKB_EXT_ERR(skb);
memset(serr, 0, sizeof(*serr));
serr->ee.ee_errno = ENOMSG;
serr->ee.ee_origin = SO_EE_ORIGIN_TXSTATUS;

err = sock_queue_err_skb(sk, skb);
if (err)
kfree_skb(skb);
}
EXPORT_SYMBOL_GPL(skb_complete_wifi_ack);


/**
* skb_partial_csum_set - set up and verify partial csum values for packet
Expand Down
9 changes: 9 additions & 0 deletions trunk/net/core/sock.c
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,11 @@ int sock_setsockopt(struct socket *sock, int level, int optname,
case SO_RXQ_OVFL:
sock_valbool_flag(sk, SOCK_RXQ_OVFL, valbool);
break;

case SO_WIFI_STATUS:
sock_valbool_flag(sk, SOCK_WIFI_STATUS, valbool);
break;

default:
ret = -ENOPROTOOPT;
break;
Expand Down Expand Up @@ -961,6 +966,10 @@ int sock_getsockopt(struct socket *sock, int level, int optname,
v.val = !!sock_flag(sk, SOCK_RXQ_OVFL);
break;

case SO_WIFI_STATUS:
v.val = !!sock_flag(sk, SOCK_WIFI_STATUS);
break;

default:
return -ENOPROTOOPT;
}
Expand Down
18 changes: 18 additions & 0 deletions trunk/net/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ int sock_tx_timestamp(struct sock *sk, __u8 *tx_flags)
*tx_flags |= SKBTX_HW_TSTAMP;
if (sock_flag(sk, SOCK_TIMESTAMPING_TX_SOFTWARE))
*tx_flags |= SKBTX_SW_TSTAMP;
if (sock_flag(sk, SOCK_WIFI_STATUS))
*tx_flags |= SKBTX_WIFI_STATUS;
return 0;
}
EXPORT_SYMBOL(sock_tx_timestamp);
Expand Down Expand Up @@ -674,6 +676,22 @@ void __sock_recv_timestamp(struct msghdr *msg, struct sock *sk,
}
EXPORT_SYMBOL_GPL(__sock_recv_timestamp);

void __sock_recv_wifi_status(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb)
{
int ack;

if (!sock_flag(sk, SOCK_WIFI_STATUS))
return;
if (!skb->wifi_acked_valid)
return;

ack = skb->wifi_acked;

put_cmsg(msg, SOL_SOCKET, SCM_WIFI_STATUS, sizeof(ack), &ack);
}
EXPORT_SYMBOL_GPL(__sock_recv_wifi_status);

static inline void sock_recv_drops(struct msghdr *msg, struct sock *sk,
struct sk_buff *skb)
{
Expand Down

0 comments on commit 689f20f

Please sign in to comment.