Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c437d88

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking updates from David Miller: 1) ax88796 does 64-bit divides which causes link errors on ARM, fix from Arnd Bergmann. 2) Once an improper offload setting is detected on an SKB we don't rate limit the log message so we can very easily live lock. From Ben Greear. 3) Openvswitch cannot report vport configuration changes reliably because it didn't preallocate the netlink notification message before changing state. From Jesse Gross. 4) The effective UID/GID SCM credentials fix, from Linus. 5) When a user explicitly asks for wireless authentication, cfg80211 isn't told about the AP detachment leaving inconsistent state. Fix from Johannes Berg. 6) Fix self-MAC checks in batman-adv on multi-mesh nodes, from Antonio Quartulli. 7) Revert build_skb() change sin IGB driver, can result in memory corruption. From Alexander Duyck. 8) Fix setting VLANs on virtual functions in IXGBE, from Greg Rose. 9) Fix TSO races in qlcnic driver, from Sritej Velaga. 10) In bnx2x the kernel driver and UNDI firmware can try to program the chip at the same time, resulting in corruption. Add proper synchronization. From Dmitry Kravkov. 11) Fix corruption of status block in firmware ram in bxn2x, from Ariel Elior. 12) Fix load balancing hash regression of bonding driver in forwarding configurations, from Eric Dumazet. 13) Fix TS ECR regression in TCP by calling tcp_replace_ts_recent() in all the right spots, from Eric Dumazet. 14) Fix several bonding bugs having to do with address manintainence, including not removing address when configuration operations encounter errors, missed locking on the address lists, missing refcounting on VLAN objects, etc. All from Nikolay Aleksandrov. 15) Add workarounds for firmware bugs in LTE qmi_wwan devices, wherein the devices fail to add a proper ethernet header while on LTE networks but otherwise properly do so on 2G and 3G ones. From Bjørn Mork. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (38 commits) net: fix incorrect credentials passing net: rate-limit warn-bad-offload splats. net: ax88796: avoid 64 bit arithmetic qlge: Update version to 1.00.00.32. qlge: Fix ethtool autoneg advertising. qlge: Fix receive path to drop error frames net: qmi_wwan: prevent duplicate mac address on link (firmware bug workaround) net: qmi_wwan: fixup destination address (firmware bug workaround) net: qmi_wwan: fixup missing ethernet header (firmware bug workaround) bonding: in bond_mc_swap() bond's mc addr list is walked without lock bonding: disable netpoll on enslave failure bonding: primary_slave & curr_active_slave are not cleaned on enslave failure bonding: vlans don't get deleted on enslave failure bonding: mc addresses don't get deleted on enslave failure pkt_sched: fix error return code in fw_change_attrs() irda: small read past the end of array in debug code tcp: call tcp_replace_ts_recent() from tcp_ack() netfilter: xt_rpfilter: skip locally generated broadcast/multicast, too netfilter: ipset: bitmap:ip,mac: fix listing with timeout bonding: fix l23 and l34 load balancing in forwarding path ...
2 parents f068f5e + 83f1b4b commit c437d88

File tree

41 files changed

+544
-393
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+544
-393
lines changed

drivers/net/bonding/bond_main.c

Lines changed: 51 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -846,8 +846,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active,
846846
if (bond->dev->flags & IFF_ALLMULTI)
847847
dev_set_allmulti(old_active->dev, -1);
848848

849+
netif_addr_lock_bh(bond->dev);
849850
netdev_for_each_mc_addr(ha, bond->dev)
850851
dev_mc_del(old_active->dev, ha->addr);
852+
netif_addr_unlock_bh(bond->dev);
851853
}
852854

853855
if (new_active) {
@@ -858,8 +860,10 @@ static void bond_mc_swap(struct bonding *bond, struct slave *new_active,
858860
if (bond->dev->flags & IFF_ALLMULTI)
859861
dev_set_allmulti(new_active->dev, 1);
860862

863+
netif_addr_lock_bh(bond->dev);
861864
netdev_for_each_mc_addr(ha, bond->dev)
862865
dev_mc_add(new_active->dev, ha->addr);
866+
netif_addr_unlock_bh(bond->dev);
863867
}
864868
}
865869

@@ -1901,9 +1905,26 @@ int bond_enslave(struct net_device *bond_dev, struct net_device *slave_dev)
19011905
bond_destroy_slave_symlinks(bond_dev, slave_dev);
19021906

19031907
err_detach:
1908+
if (!USES_PRIMARY(bond->params.mode)) {
1909+
netif_addr_lock_bh(bond_dev);
1910+
bond_mc_list_flush(bond_dev, slave_dev);
1911+
netif_addr_unlock_bh(bond_dev);
1912+
}
1913+
bond_del_vlans_from_slave(bond, slave_dev);
19041914
write_lock_bh(&bond->lock);
19051915
bond_detach_slave(bond, new_slave);
1916+
if (bond->primary_slave == new_slave)
1917+
bond->primary_slave = NULL;
19061918
write_unlock_bh(&bond->lock);
1919+
if (bond->curr_active_slave == new_slave) {
1920+
read_lock(&bond->lock);
1921+
write_lock_bh(&bond->curr_slave_lock);
1922+
bond_change_active_slave(bond, NULL);
1923+
bond_select_active_slave(bond);
1924+
write_unlock_bh(&bond->curr_slave_lock);
1925+
read_unlock(&bond->lock);
1926+
}
1927+
slave_disable_netpoll(new_slave);
19071928

19081929
err_close:
19091930
slave_dev->priv_flags &= ~IFF_BONDING;
@@ -3296,20 +3317,22 @@ static int bond_xmit_hash_policy_l2(struct sk_buff *skb, int count)
32963317
*/
32973318
static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
32983319
{
3299-
struct ethhdr *data = (struct ethhdr *)skb->data;
3300-
struct iphdr *iph;
3301-
struct ipv6hdr *ipv6h;
3320+
const struct ethhdr *data;
3321+
const struct iphdr *iph;
3322+
const struct ipv6hdr *ipv6h;
33023323
u32 v6hash;
3303-
__be32 *s, *d;
3324+
const __be32 *s, *d;
33043325

33053326
if (skb->protocol == htons(ETH_P_IP) &&
3306-
skb_network_header_len(skb) >= sizeof(*iph)) {
3327+
pskb_network_may_pull(skb, sizeof(*iph))) {
33073328
iph = ip_hdr(skb);
3329+
data = (struct ethhdr *)skb->data;
33083330
return ((ntohl(iph->saddr ^ iph->daddr) & 0xffff) ^
33093331
(data->h_dest[5] ^ data->h_source[5])) % count;
33103332
} else if (skb->protocol == htons(ETH_P_IPV6) &&
3311-
skb_network_header_len(skb) >= sizeof(*ipv6h)) {
3333+
pskb_network_may_pull(skb, sizeof(*ipv6h))) {
33123334
ipv6h = ipv6_hdr(skb);
3335+
data = (struct ethhdr *)skb->data;
33133336
s = &ipv6h->saddr.s6_addr32[0];
33143337
d = &ipv6h->daddr.s6_addr32[0];
33153338
v6hash = (s[1] ^ d[1]) ^ (s[2] ^ d[2]) ^ (s[3] ^ d[3]);
@@ -3328,33 +3351,36 @@ static int bond_xmit_hash_policy_l23(struct sk_buff *skb, int count)
33283351
static int bond_xmit_hash_policy_l34(struct sk_buff *skb, int count)
33293352
{
33303353
u32 layer4_xor = 0;
3331-
struct iphdr *iph;
3332-
struct ipv6hdr *ipv6h;
3333-
__be32 *s, *d;
3334-
__be16 *layer4hdr;
3354+
const struct iphdr *iph;
3355+
const struct ipv6hdr *ipv6h;
3356+
const __be32 *s, *d;
3357+
const __be16 *l4 = NULL;
3358+
__be16 _l4[2];
3359+
int noff = skb_network_offset(skb);
3360+
int poff;
33353361

33363362
if (skb->protocol == htons(ETH_P_IP) &&
3337-
skb_network_header_len(skb) >= sizeof(*iph)) {
3363+
pskb_may_pull(skb, noff + sizeof(*iph))) {
33383364
iph = ip_hdr(skb);
3339-
if (!ip_is_fragment(iph) &&
3340-
(iph->protocol == IPPROTO_TCP ||
3341-
iph->protocol == IPPROTO_UDP) &&
3342-
(skb_headlen(skb) - skb_network_offset(skb) >=
3343-
iph->ihl * sizeof(u32) + sizeof(*layer4hdr) * 2)) {
3344-
layer4hdr = (__be16 *)((u32 *)iph + iph->ihl);
3345-
layer4_xor = ntohs(*layer4hdr ^ *(layer4hdr + 1));
3365+
poff = proto_ports_offset(iph->protocol);
3366+
3367+
if (!ip_is_fragment(iph) && poff >= 0) {
3368+
l4 = skb_header_pointer(skb, noff + (iph->ihl << 2) + poff,
3369+
sizeof(_l4), &_l4);
3370+
if (l4)
3371+
layer4_xor = ntohs(l4[0] ^ l4[1]);
33463372
}
33473373
return (layer4_xor ^
33483374
((ntohl(iph->saddr ^ iph->daddr)) & 0xffff)) % count;
33493375
} else if (skb->protocol == htons(ETH_P_IPV6) &&
3350-
skb_network_header_len(skb) >= sizeof(*ipv6h)) {
3376+
pskb_may_pull(skb, noff + sizeof(*ipv6h))) {
33513377
ipv6h = ipv6_hdr(skb);
3352-
if ((ipv6h->nexthdr == IPPROTO_TCP ||
3353-
ipv6h->nexthdr == IPPROTO_UDP) &&
3354-
(skb_headlen(skb) - skb_network_offset(skb) >=
3355-
sizeof(*ipv6h) + sizeof(*layer4hdr) * 2)) {
3356-
layer4hdr = (__be16 *)(ipv6h + 1);
3357-
layer4_xor = ntohs(*layer4hdr ^ *(layer4hdr + 1));
3378+
poff = proto_ports_offset(ipv6h->nexthdr);
3379+
if (poff >= 0) {
3380+
l4 = skb_header_pointer(skb, noff + sizeof(*ipv6h) + poff,
3381+
sizeof(_l4), &_l4);
3382+
if (l4)
3383+
layer4_xor = ntohs(l4[0] ^ l4[1]);
33583384
}
33593385
s = &ipv6h->saddr.s6_addr32[0];
33603386
d = &ipv6h->daddr.s6_addr32[0];

drivers/net/ethernet/8390/ax88796.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -828,7 +828,7 @@ static int ax_probe(struct platform_device *pdev)
828828
struct ei_device *ei_local;
829829
struct ax_device *ax;
830830
struct resource *irq, *mem, *mem2;
831-
resource_size_t mem_size, mem2_size = 0;
831+
unsigned long mem_size, mem2_size = 0;
832832
int ret = 0;
833833

834834
dev = ax__alloc_ei_netdev(sizeof(struct ax_device));

drivers/net/ethernet/broadcom/bnx2x/bnx2x_cmn.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2614,6 +2614,9 @@ int bnx2x_nic_load(struct bnx2x *bp, int load_mode)
26142614
}
26152615
}
26162616

2617+
/* initialize FW coalescing state machines in RAM */
2618+
bnx2x_update_coalesce(bp);
2619+
26172620
/* setup the leading queue */
26182621
rc = bnx2x_setup_leading(bp);
26192622
if (rc) {
@@ -4580,11 +4583,11 @@ static void storm_memset_hc_disable(struct bnx2x *bp, u8 port,
45804583
u32 enable_flag = disable ? 0 : (1 << HC_INDEX_DATA_HC_ENABLED_SHIFT);
45814584
u32 addr = BAR_CSTRORM_INTMEM +
45824585
CSTORM_STATUS_BLOCK_DATA_FLAGS_OFFSET(fw_sb_id, sb_index);
4583-
u16 flags = REG_RD16(bp, addr);
4586+
u8 flags = REG_RD8(bp, addr);
45844587
/* clear and set */
45854588
flags &= ~HC_INDEX_DATA_HC_ENABLED;
45864589
flags |= enable_flag;
4587-
REG_WR16(bp, addr, flags);
4590+
REG_WR8(bp, addr, flags);
45884591
DP(NETIF_MSG_IFUP,
45894592
"port %x fw_sb_id %d sb_index %d disable %d\n",
45904593
port, fw_sb_id, sb_index, disable);

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9878,6 +9878,10 @@ static int bnx2x_prev_unload_common(struct bnx2x *bp)
98789878
REG_RD(bp, NIG_REG_NIG_INT_STS_CLR_0);
98799879
}
98809880
}
9881+
if (!CHIP_IS_E1x(bp))
9882+
/* block FW from writing to host */
9883+
REG_WR(bp, PGLUE_B_REG_INTERNAL_PFID_ENABLE_MASTER, 0);
9884+
98819885
/* wait until BRB is empty */
98829886
tmp_reg = REG_RD(bp, BRB1_REG_NUM_OF_FULL_BLOCKS);
98839887
while (timer_count) {

drivers/net/ethernet/intel/igb/igb.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -284,18 +284,10 @@ struct igb_q_vector {
284284
enum e1000_ring_flags_t {
285285
IGB_RING_FLAG_RX_SCTP_CSUM,
286286
IGB_RING_FLAG_RX_LB_VLAN_BSWAP,
287-
IGB_RING_FLAG_RX_BUILD_SKB_ENABLED,
288287
IGB_RING_FLAG_TX_CTX_IDX,
289288
IGB_RING_FLAG_TX_DETECT_HANG
290289
};
291290

292-
#define ring_uses_build_skb(ring) \
293-
test_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags)
294-
#define set_ring_build_skb_enabled(ring) \
295-
set_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags)
296-
#define clear_ring_build_skb_enabled(ring) \
297-
clear_bit(IGB_RING_FLAG_RX_BUILD_SKB_ENABLED, &(ring)->flags)
298-
299291
#define IGB_TXD_DCMD (E1000_ADVTXD_DCMD_EOP | E1000_ADVTXD_DCMD_RS)
300292

301293
#define IGB_RX_DESC(R, i) \

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 4 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -3350,20 +3350,6 @@ void igb_configure_rx_ring(struct igb_adapter *adapter,
33503350
wr32(E1000_RXDCTL(reg_idx), rxdctl);
33513351
}
33523352

3353-
static void igb_set_rx_buffer_len(struct igb_adapter *adapter,
3354-
struct igb_ring *rx_ring)
3355-
{
3356-
#define IGB_MAX_BUILD_SKB_SIZE \
3357-
(SKB_WITH_OVERHEAD(IGB_RX_BUFSZ) - \
3358-
(NET_SKB_PAD + NET_IP_ALIGN + IGB_TS_HDR_LEN))
3359-
3360-
/* set build_skb flag */
3361-
if (adapter->max_frame_size <= IGB_MAX_BUILD_SKB_SIZE)
3362-
set_ring_build_skb_enabled(rx_ring);
3363-
else
3364-
clear_ring_build_skb_enabled(rx_ring);
3365-
}
3366-
33673353
/**
33683354
* igb_configure_rx - Configure receive Unit after Reset
33693355
* @adapter: board private structure
@@ -3383,11 +3369,8 @@ static void igb_configure_rx(struct igb_adapter *adapter)
33833369

33843370
/* Setup the HW Rx Head and Tail Descriptor Pointers and
33853371
* the Base and Length of the Rx Descriptor Ring */
3386-
for (i = 0; i < adapter->num_rx_queues; i++) {
3387-
struct igb_ring *rx_ring = adapter->rx_ring[i];
3388-
igb_set_rx_buffer_len(adapter, rx_ring);
3389-
igb_configure_rx_ring(adapter, rx_ring);
3390-
}
3372+
for (i = 0; i < adapter->num_rx_queues; i++)
3373+
igb_configure_rx_ring(adapter, adapter->rx_ring[i]);
33913374
}
33923375

33933376
/**
@@ -6203,78 +6186,6 @@ static bool igb_add_rx_frag(struct igb_ring *rx_ring,
62036186
return igb_can_reuse_rx_page(rx_buffer, page, truesize);
62046187
}
62056188

6206-
static struct sk_buff *igb_build_rx_buffer(struct igb_ring *rx_ring,
6207-
union e1000_adv_rx_desc *rx_desc)
6208-
{
6209-
struct igb_rx_buffer *rx_buffer;
6210-
struct sk_buff *skb;
6211-
struct page *page;
6212-
void *page_addr;
6213-
unsigned int size = le16_to_cpu(rx_desc->wb.upper.length);
6214-
#if (PAGE_SIZE < 8192)
6215-
unsigned int truesize = IGB_RX_BUFSZ;
6216-
#else
6217-
unsigned int truesize = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)) +
6218-
SKB_DATA_ALIGN(NET_SKB_PAD +
6219-
NET_IP_ALIGN +
6220-
size);
6221-
#endif
6222-
6223-
/* If we spanned a buffer we have a huge mess so test for it */
6224-
BUG_ON(unlikely(!igb_test_staterr(rx_desc, E1000_RXD_STAT_EOP)));
6225-
6226-
rx_buffer = &rx_ring->rx_buffer_info[rx_ring->next_to_clean];
6227-
page = rx_buffer->page;
6228-
prefetchw(page);
6229-
6230-
page_addr = page_address(page) + rx_buffer->page_offset;
6231-
6232-
/* prefetch first cache line of first page */
6233-
prefetch(page_addr + NET_SKB_PAD + NET_IP_ALIGN);
6234-
#if L1_CACHE_BYTES < 128
6235-
prefetch(page_addr + L1_CACHE_BYTES + NET_SKB_PAD + NET_IP_ALIGN);
6236-
#endif
6237-
6238-
/* build an skb to around the page buffer */
6239-
skb = build_skb(page_addr, truesize);
6240-
if (unlikely(!skb)) {
6241-
rx_ring->rx_stats.alloc_failed++;
6242-
return NULL;
6243-
}
6244-
6245-
/* we are reusing so sync this buffer for CPU use */
6246-
dma_sync_single_range_for_cpu(rx_ring->dev,
6247-
rx_buffer->dma,
6248-
rx_buffer->page_offset,
6249-
IGB_RX_BUFSZ,
6250-
DMA_FROM_DEVICE);
6251-
6252-
/* update pointers within the skb to store the data */
6253-
skb_reserve(skb, NET_IP_ALIGN + NET_SKB_PAD);
6254-
__skb_put(skb, size);
6255-
6256-
/* pull timestamp out of packet data */
6257-
if (igb_test_staterr(rx_desc, E1000_RXDADV_STAT_TSIP)) {
6258-
igb_ptp_rx_pktstamp(rx_ring->q_vector, skb->data, skb);
6259-
__skb_pull(skb, IGB_TS_HDR_LEN);
6260-
}
6261-
6262-
if (igb_can_reuse_rx_page(rx_buffer, page, truesize)) {
6263-
/* hand second half of page back to the ring */
6264-
igb_reuse_rx_page(rx_ring, rx_buffer);
6265-
} else {
6266-
/* we are not reusing the buffer so unmap it */
6267-
dma_unmap_page(rx_ring->dev, rx_buffer->dma,
6268-
PAGE_SIZE, DMA_FROM_DEVICE);
6269-
}
6270-
6271-
/* clear contents of buffer_info */
6272-
rx_buffer->dma = 0;
6273-
rx_buffer->page = NULL;
6274-
6275-
return skb;
6276-
}
6277-
62786189
static struct sk_buff *igb_fetch_rx_buffer(struct igb_ring *rx_ring,
62796190
union e1000_adv_rx_desc *rx_desc,
62806191
struct sk_buff *skb)
@@ -6690,10 +6601,7 @@ static bool igb_clean_rx_irq(struct igb_q_vector *q_vector, const int budget)
66906601
rmb();
66916602

66926603
/* retrieve a buffer from the ring */
6693-
if (ring_uses_build_skb(rx_ring))
6694-
skb = igb_build_rx_buffer(rx_ring, rx_desc);
6695-
else
6696-
skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb);
6604+
skb = igb_fetch_rx_buffer(rx_ring, rx_desc, skb);
66976605

66986606
/* exit if we failed to retrieve a buffer */
66996607
if (!skb)
@@ -6780,14 +6688,6 @@ static bool igb_alloc_mapped_page(struct igb_ring *rx_ring,
67806688
return true;
67816689
}
67826690

6783-
static inline unsigned int igb_rx_offset(struct igb_ring *rx_ring)
6784-
{
6785-
if (ring_uses_build_skb(rx_ring))
6786-
return NET_SKB_PAD + NET_IP_ALIGN;
6787-
else
6788-
return 0;
6789-
}
6790-
67916691
/**
67926692
* igb_alloc_rx_buffers - Replace used receive buffers; packet split
67936693
* @adapter: address of board private structure
@@ -6814,9 +6714,7 @@ void igb_alloc_rx_buffers(struct igb_ring *rx_ring, u16 cleaned_count)
68146714
* Refresh the desc even if buffer_addrs didn't change
68156715
* because each write-back erases this info.
68166716
*/
6817-
rx_desc->read.pkt_addr = cpu_to_le64(bi->dma +
6818-
bi->page_offset +
6819-
igb_rx_offset(rx_ring));
6717+
rx_desc->read.pkt_addr = cpu_to_le64(bi->dma + bi->page_offset);
68206718

68216719
rx_desc++;
68226720
bi++;

drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1049,6 +1049,12 @@ int ixgbe_ndo_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
10491049
if ((vf >= adapter->num_vfs) || (vlan > 4095) || (qos > 7))
10501050
return -EINVAL;
10511051
if (vlan || qos) {
1052+
if (adapter->vfinfo[vf].pf_vlan)
1053+
err = ixgbe_set_vf_vlan(adapter, false,
1054+
adapter->vfinfo[vf].pf_vlan,
1055+
vf);
1056+
if (err)
1057+
goto out;
10521058
err = ixgbe_set_vf_vlan(adapter, true, vlan, vf);
10531059
if (err)
10541060
goto out;

0 commit comments

Comments
 (0)