Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net

Pull networking fixes from David Miller:
 "This fixes the most immediate fallout from yesterday's networking
  merge:

   1) sock_tx_timestamp() must not clear the passed in tx_flags, but
      rather add to them.  Fix from Eric Dumazet.

   2) The hyperv driver sendbuf region increase needs to be decreased
      slightly to handle older backends.  From KY Srinivasan.

   3) Fix RCU lockdep splats in netlink diag after recent hashing
      changes, from Thomas Graf.

   4) The new IPV6_FLOWLABEL was given a socket option number that
      overlapped with an existing IP6 tables one, breaking ip6_tables.
      Fixed by Pablo Neira Ayuso"

* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net:
  netlink: hold nl_sock_hash_lock during diag dump
  tcp: md5: check md5 signature without socket lock
  net: fix USB network driver config option.
  net: reallocate new socket option number for IPV6_AUTOFLOWLABEL
  vmxnet3: fix decimal printf format specifiers prefixed with 0x
  net-timestamp: cumulative tcp timestamping fixes
  hyperv: Adjust the size of sendbuf region to support ws2008r2
  cxgb4: Fix for SR-IOV VF initialization
  net-timestamp: sock_tx_timestamp() fix
This commit is contained in:
Linus Torvalds 2014-08-06 21:06:02 -07:00
commit 6456a0438b
15 changed files with 86 additions and 44 deletions

View File

@ -6527,11 +6527,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
/* We control everything through one PF */
func = SOURCEPF_GET(readl(adapter->regs + PL_WHOAMI));
if ((pdev->device == 0xa000 && func != 0) ||
func != ent->driver_data) {
if (func != ent->driver_data) {
pci_save_state(pdev); /* to restore SR-IOV later */
err = 0;
goto out_unmap_bar0;
goto sriov;
}
adapter->pdev = pdev;
@ -6697,6 +6695,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
if (is_offload(adapter))
attach_ulds(adapter);
sriov:
#ifdef CONFIG_PCI_IOV
if (func < ARRAY_SIZE(num_vf) && num_vf[func] > 0)
if (pci_enable_sriov(pdev, num_vf[func]) == 0)

View File

@ -585,7 +585,7 @@ struct nvsp_message {
#define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*16) /* 16MB */
#define NETVSC_RECEIVE_BUFFER_SIZE_LEGACY (1024*1024*15) /* 15MB */
#define NETVSC_SEND_BUFFER_SIZE (1024 * 1024 * 16) /* 16MB */
#define NETVSC_SEND_BUFFER_SIZE (1024 * 1024 * 15) /* 15MB */
#define NETVSC_INVALID_INDEX -1

View File

@ -5,8 +5,8 @@ comment "Host-side USB support is needed for USB Network Adapter support"
depends on !USB && NET
menuconfig USB_NET_DRIVERS
bool "USB Network Adapters"
default y
tristate "USB Network Adapters"
default USB if USB
depends on USB && NET
if USB_NET_DRIVERS

View File

@ -766,7 +766,7 @@ vmxnet3_map_pkt(struct sk_buff *skb, struct vmxnet3_tx_ctx *ctx,
gdesc->dword[3] = 0;
netdev_dbg(adapter->netdev,
"txd[%u]: 0x%llu %u %u\n",
"txd[%u]: 0x%llx %u %u\n",
tq->tx_ring.next2fill, le64_to_cpu(gdesc->txd.addr),
le32_to_cpu(gdesc->dword[2]), gdesc->dword[3]);
vmxnet3_cmd_ring_adv_next2fill(&tq->tx_ring);

View File

@ -189,6 +189,7 @@ config USB_NET_RNDIS_WLAN
tristate "Wireless RNDIS USB support"
depends on USB
depends on CFG80211
select USB_NET_DRIVERS
select USB_USBNET
select USB_NET_CDCETHER
select USB_NET_RNDIS_HOST

View File

@ -2199,9 +2199,11 @@ static inline void sock_recv_ts_and_drops(struct msghdr *msg, struct sock *sk,
/**
* sock_tx_timestamp - checks whether the outgoing packet is to be time stamped
* @sk: socket sending this packet
* @tx_flags: filled with instructions for time stamping
* @tx_flags: completed with instructions for time stamping
*
* Note : callers should take care of initial *tx_flags value (usually 0)
*/
void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags);
void sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags);
/**
* sk_eat_skb - Release a skb if it is no longer needed

View File

@ -233,7 +233,6 @@ struct in6_flowlabel_req {
#if 0 /* not yet */
#define IPV6_USE_MIN_MTU 63
#endif
#define IPV6_AUTOFLOWLABEL 64
/*
* Netfilter (1)
@ -262,6 +261,7 @@ struct in6_flowlabel_req {
* IP6T_SO_ORIGINAL_DST 80
*/
#define IPV6_AUTOFLOWLABEL 70
/* RFC5014: Source address selection */
#define IPV6_ADDR_PREFERENCES 72

View File

@ -426,14 +426,16 @@ void tcp_init_sock(struct sock *sk)
}
EXPORT_SYMBOL(tcp_init_sock);
void tcp_tx_timestamp(struct sock *sk, struct sk_buff *skb)
static void tcp_tx_timestamp(struct sock *sk, struct sk_buff *skb)
{
if (sk->sk_tsflags) {
struct skb_shared_info *shinfo = skb_shinfo(skb);
sock_tx_timestamp(sk, &shinfo->tx_flags);
if (shinfo->tx_flags & SKBTX_ANY_SW_TSTAMP)
if (shinfo->tx_flags & SKBTX_ANY_TSTAMP)
shinfo->tskey = TCP_SKB_CB(skb)->seq + skb->len - 1;
}
}
/*
* Wait for a TCP event.

View File

@ -1167,7 +1167,8 @@ clear_hash_noput:
}
EXPORT_SYMBOL(tcp_v4_md5_hash_skb);
static bool tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
static bool __tcp_v4_inbound_md5_hash(struct sock *sk,
const struct sk_buff *skb)
{
/*
* This gets called for each TCP segment that arrives
@ -1220,6 +1221,17 @@ static bool tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
return false;
}
static bool tcp_v4_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
{
bool ret;
rcu_read_lock();
ret = __tcp_v4_inbound_md5_hash(sk, skb);
rcu_read_unlock();
return ret;
}
#endif
static void tcp_v4_init_req(struct request_sock *req, struct sock *sk,
@ -1432,16 +1444,6 @@ static struct sock *tcp_v4_hnd_req(struct sock *sk, struct sk_buff *skb)
int tcp_v4_do_rcv(struct sock *sk, struct sk_buff *skb)
{
struct sock *rsk;
#ifdef CONFIG_TCP_MD5SIG
/*
* We really want to reject the packet as early as possible
* if:
* o We're expecting an MD5'd packet and this is no MD5 tcp option
* o There is an MD5 option and we're not expecting one
*/
if (tcp_v4_inbound_md5_hash(sk, skb))
goto discard;
#endif
if (sk->sk_state == TCP_ESTABLISHED) { /* Fast path */
struct dst_entry *dst = sk->sk_rx_dst;
@ -1644,6 +1646,18 @@ process:
if (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))
goto discard_and_relse;
#ifdef CONFIG_TCP_MD5SIG
/*
* We really want to reject the packet as early as possible
* if:
* o We're expecting an MD5'd packet and this is no MD5 tcp option
* o There is an MD5 option and we're not expecting one
*/
if (tcp_v4_inbound_md5_hash(sk, skb))
goto discard_and_relse;
#endif
nf_reset(skb);
if (sk_filter(sk, skb))

View File

@ -14,12 +14,12 @@
#include <net/tcp.h>
#include <net/protocol.h>
void tcp_gso_tstamp(struct sk_buff *skb, unsigned int ts_seq, unsigned int seq,
unsigned int mss)
static void tcp_gso_tstamp(struct sk_buff *skb, unsigned int ts_seq,
unsigned int seq, unsigned int mss)
{
while (skb) {
if (ts_seq < (__u64) seq + mss) {
skb_shinfo(skb)->tx_flags = SKBTX_SW_TSTAMP;
if (before(ts_seq, seq + mss)) {
skb_shinfo(skb)->tx_flags |= SKBTX_SW_TSTAMP;
skb_shinfo(skb)->tskey = ts_seq;
return;
}

View File

@ -667,7 +667,8 @@ clear_hash_noput:
return 1;
}
static int tcp_v6_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
static int __tcp_v6_inbound_md5_hash(struct sock *sk,
const struct sk_buff *skb)
{
const __u8 *hash_location = NULL;
struct tcp_md5sig_key *hash_expected;
@ -707,6 +708,18 @@ static int tcp_v6_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
}
return 0;
}
static int tcp_v6_inbound_md5_hash(struct sock *sk, const struct sk_buff *skb)
{
int ret;
rcu_read_lock();
ret = __tcp_v6_inbound_md5_hash(sk, skb);
rcu_read_unlock();
return ret;
}
#endif
static void tcp_v6_init_req(struct request_sock *req, struct sock *sk,
@ -1247,11 +1260,6 @@ static int tcp_v6_do_rcv(struct sock *sk, struct sk_buff *skb)
if (skb->protocol == htons(ETH_P_IP))
return tcp_v4_do_rcv(sk, skb);
#ifdef CONFIG_TCP_MD5SIG
if (tcp_v6_inbound_md5_hash(sk, skb))
goto discard;
#endif
if (sk_filter(sk, skb))
goto discard;
@ -1424,6 +1432,11 @@ process:
if (!xfrm6_policy_check(sk, XFRM_POLICY_IN, skb))
goto discard_and_relse;
#ifdef CONFIG_TCP_MD5SIG
if (tcp_v6_inbound_md5_hash(sk, skb))
goto discard_and_relse;
#endif
if (sk_filter(sk, skb))
goto discard_and_relse;

View File

@ -104,6 +104,7 @@ static atomic_t nl_table_users = ATOMIC_INIT(0);
/* Protects netlink socket hash table mutations */
DEFINE_MUTEX(nl_sk_hash_lock);
EXPORT_SYMBOL_GPL(nl_sk_hash_lock);
static int lockdep_nl_sk_hash_is_held(void)
{

View File

@ -73,5 +73,6 @@ struct netlink_table {
extern struct netlink_table *nl_table;
extern rwlock_t nl_table_lock;
extern struct mutex nl_sk_hash_lock;
#endif

View File

@ -170,6 +170,7 @@ static int netlink_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
req = nlmsg_data(cb->nlh);
mutex_lock(&nl_sk_hash_lock);
read_lock(&nl_table_lock);
if (req->sdiag_protocol == NDIAG_PROTO_ALL) {
@ -183,6 +184,7 @@ static int netlink_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
} else {
if (req->sdiag_protocol >= MAX_LINKS) {
read_unlock(&nl_table_lock);
mutex_unlock(&nl_sk_hash_lock);
return -ENOENT;
}
@ -190,6 +192,7 @@ static int netlink_diag_dump(struct sk_buff *skb, struct netlink_callback *cb)
}
read_unlock(&nl_table_lock);
mutex_unlock(&nl_sk_hash_lock);
return skb->len;
}

View File

@ -610,20 +610,26 @@ void sock_release(struct socket *sock)
}
EXPORT_SYMBOL(sock_release);
void sock_tx_timestamp(struct sock *sk, __u8 *tx_flags)
void sock_tx_timestamp(const struct sock *sk, __u8 *tx_flags)
{
*tx_flags = 0;
u8 flags = *tx_flags;
if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_HARDWARE)
*tx_flags |= SKBTX_HW_TSTAMP;
flags |= SKBTX_HW_TSTAMP;
if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_SOFTWARE)
*tx_flags |= SKBTX_SW_TSTAMP;
flags |= SKBTX_SW_TSTAMP;
if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_SCHED)
*tx_flags |= SKBTX_SCHED_TSTAMP;
flags |= SKBTX_SCHED_TSTAMP;
if (sk->sk_tsflags & SOF_TIMESTAMPING_TX_ACK)
*tx_flags |= SKBTX_ACK_TSTAMP;
flags |= SKBTX_ACK_TSTAMP;
if (sock_flag(sk, SOCK_WIFI_STATUS))
*tx_flags |= SKBTX_WIFI_STATUS;
flags |= SKBTX_WIFI_STATUS;
*tx_flags = flags;
}
EXPORT_SYMBOL(sock_tx_timestamp);