Skip to content

Commit 19e1219

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Fix route leak in xfrm_bundle_create(). 2) In mac80211, validate user rate mask before configuring it. From Johannes Berg. 3) Properly enforce memory limits in fair queueing code, from Toke Hoiland-Jorgensen. 4) Fix lockdep splat in inet_csk_route_req(), from Eric Dumazet. 5) Fix TSO header allocation and management in mvpp2 driver, from Yan Markman. 6) Don't take socket lock in BH handler in strparser code, from Tom Herbert. 7) Don't show sockets from other namespaces in AF_UNIX code, from Andrei Vagin. 8) Fix double free in error path of tap_open(), from Girish Moodalbail. 9) Fix TX map failure path in igb and ixgbe, from Jean-Philippe Brucker and Alexander Duyck. 10) Fix DCB mode programming in stmmac driver, from Jose Abreu. 11) Fix err_count handling in various tunnels (ipip, ip6_gre). From Xin Long. 12) Properly align SKB head before building SKB in tuntap, from Jason Wang. 13) Avoid matching qdiscs with a zero handle during lookups, from Cong Wang. 14) Fix various endianness bugs in sctp, from Xin Long. 15) Fix tc filter callback races and add selftests which trigger the problem, from Cong Wang. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (73 commits) selftests: Introduce a new test case to tc testsuite selftests: Introduce a new script to generate tc batch file net_sched: fix call_rcu() race on act_sample module removal net_sched: add rtnl assertion to tcf_exts_destroy() net_sched: use tcf_queue_work() in tcindex filter net_sched: use tcf_queue_work() in rsvp filter net_sched: use tcf_queue_work() in route filter net_sched: use tcf_queue_work() in u32 filter net_sched: use tcf_queue_work() in matchall filter net_sched: use tcf_queue_work() in fw filter net_sched: use tcf_queue_work() in flower filter net_sched: use tcf_queue_work() in flow filter net_sched: use tcf_queue_work() in cgroup filter net_sched: use tcf_queue_work() in bpf filter net_sched: use tcf_queue_work() in basic filter net_sched: introduce a workqueue for RCU callbacks of tc filter sctp: fix some type cast warnings introduced since very beginning sctp: fix a type cast warnings that causes a_rwnd gets the wrong value sctp: fix some type cast warnings introduced by transport rhashtable sctp: fix some type cast warnings introduced by stream reconf ...
2 parents 25a5d23 + 6c325f4 commit 19e1219

Some content is hidden

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

78 files changed

+1021
-361
lines changed

drivers/net/can/sun4i_can.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ static int sun4i_can_start(struct net_device *dev)
342342

343343
/* enter the selected mode */
344344
mod_reg_val = readl(priv->base + SUN4I_REG_MSEL_ADDR);
345-
if (priv->can.ctrlmode & CAN_CTRLMODE_PRESUME_ACK)
345+
if (priv->can.ctrlmode & CAN_CTRLMODE_LOOPBACK)
346346
mod_reg_val |= SUN4I_MSEL_LOOPBACK_MODE;
347347
else if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
348348
mod_reg_val |= SUN4I_MSEL_LISTEN_ONLY_MODE;
@@ -811,7 +811,6 @@ static int sun4ican_probe(struct platform_device *pdev)
811811
priv->can.ctrlmode_supported = CAN_CTRLMODE_BERR_REPORTING |
812812
CAN_CTRLMODE_LISTENONLY |
813813
CAN_CTRLMODE_LOOPBACK |
814-
CAN_CTRLMODE_PRESUME_ACK |
815814
CAN_CTRLMODE_3_SAMPLES;
816815
priv->base = addr;
817816
priv->clk = clk;

drivers/net/can/usb/kvaser_usb.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ static inline bool kvaser_is_usbcan(const struct usb_device_id *id)
137137
#define CMD_RESET_ERROR_COUNTER 49
138138
#define CMD_TX_ACKNOWLEDGE 50
139139
#define CMD_CAN_ERROR_EVENT 51
140+
#define CMD_FLUSH_QUEUE_REPLY 68
140141

141142
#define CMD_LEAF_USB_THROTTLE 77
142143
#define CMD_LEAF_LOG_MESSAGE 106
@@ -1301,6 +1302,11 @@ static void kvaser_usb_handle_message(const struct kvaser_usb *dev,
13011302
goto warn;
13021303
break;
13031304

1305+
case CMD_FLUSH_QUEUE_REPLY:
1306+
if (dev->family != KVASER_LEAF)
1307+
goto warn;
1308+
break;
1309+
13041310
default:
13051311
warn: dev_warn(dev->udev->dev.parent,
13061312
"Unhandled message (%d)\n", msg->id);
@@ -1609,7 +1615,8 @@ static int kvaser_usb_close(struct net_device *netdev)
16091615
if (err)
16101616
netdev_warn(netdev, "Cannot flush queue, error %d\n", err);
16111617

1612-
if (kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, priv->channel))
1618+
err = kvaser_usb_send_simple_msg(dev, CMD_RESET_CHIP, priv->channel);
1619+
if (err)
16131620
netdev_warn(netdev, "Cannot reset card, error %d\n", err);
16141621

16151622
err = kvaser_usb_stop_chip(priv);

drivers/net/ethernet/intel/e1000/e1000_ethtool.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1824,11 +1824,12 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
18241824
{
18251825
struct e1000_adapter *adapter = netdev_priv(netdev);
18261826
int i;
1827-
char *p = NULL;
18281827
const struct e1000_stats *stat = e1000_gstrings_stats;
18291828

18301829
e1000_update_stats(adapter);
1831-
for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++) {
1830+
for (i = 0; i < E1000_GLOBAL_STATS_LEN; i++, stat++) {
1831+
char *p;
1832+
18321833
switch (stat->type) {
18331834
case NETDEV_STATS:
18341835
p = (char *)netdev + stat->stat_offset;
@@ -1839,15 +1840,13 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
18391840
default:
18401841
WARN_ONCE(1, "Invalid E1000 stat type: %u index %d\n",
18411842
stat->type, i);
1842-
break;
1843+
continue;
18431844
}
18441845

18451846
if (stat->sizeof_stat == sizeof(u64))
18461847
data[i] = *(u64 *)p;
18471848
else
18481849
data[i] = *(u32 *)p;
1849-
1850-
stat++;
18511850
}
18521851
/* BUG_ON(i != E1000_STATS_LEN); */
18531852
}

drivers/net/ethernet/intel/e1000/e1000_main.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -520,8 +520,6 @@ void e1000_down(struct e1000_adapter *adapter)
520520
struct net_device *netdev = adapter->netdev;
521521
u32 rctl, tctl;
522522

523-
netif_carrier_off(netdev);
524-
525523
/* disable receives in the hardware */
526524
rctl = er32(RCTL);
527525
ew32(RCTL, rctl & ~E1000_RCTL_EN);
@@ -537,6 +535,15 @@ void e1000_down(struct e1000_adapter *adapter)
537535
E1000_WRITE_FLUSH();
538536
msleep(10);
539537

538+
/* Set the carrier off after transmits have been disabled in the
539+
* hardware, to avoid race conditions with e1000_watchdog() (which
540+
* may be running concurrently to us, checking for the carrier
541+
* bit to decide whether it should enable transmits again). Such
542+
* a race condition would result into transmission being disabled
543+
* in the hardware until the next IFF_DOWN+IFF_UP cycle.
544+
*/
545+
netif_carrier_off(netdev);
546+
540547
napi_disable(&adapter->napi);
541548

542549
e1000_irq_disable(adapter);

drivers/net/ethernet/intel/i40e/i40e_txrx.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2102,6 +2102,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
21022102

21032103
if (unlikely(i40e_rx_is_programming_status(qword))) {
21042104
i40e_clean_programming_status(rx_ring, rx_desc, qword);
2105+
cleaned_count++;
21052106
continue;
21062107
}
21072108
size = (qword & I40E_RXD_QW1_LENGTH_PBUF_MASK) >>
@@ -2269,7 +2270,7 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi,
22692270
goto enable_int;
22702271
}
22712272

2272-
if (ITR_IS_DYNAMIC(tx_itr_setting)) {
2273+
if (ITR_IS_DYNAMIC(rx_itr_setting)) {
22732274
rx = i40e_set_new_dynamic_itr(&q_vector->rx);
22742275
rxval = i40e_buildreg_itr(I40E_RX_ITR, q_vector->rx.itr);
22752276
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5326,7 +5326,7 @@ static int igb_tx_map(struct igb_ring *tx_ring,
53265326
DMA_TO_DEVICE);
53275327
dma_unmap_len_set(tx_buffer, len, 0);
53285328

5329-
if (i--)
5329+
if (i-- == 0)
53305330
i += tx_ring->count;
53315331
tx_buffer = &tx_ring->tx_buffer_info[i];
53325332
}

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

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8020,29 +8020,23 @@ static int ixgbe_tx_map(struct ixgbe_ring *tx_ring,
80208020
return 0;
80218021
dma_error:
80228022
dev_err(tx_ring->dev, "TX DMA map failed\n");
8023-
tx_buffer = &tx_ring->tx_buffer_info[i];
80248023

80258024
/* clear dma mappings for failed tx_buffer_info map */
8026-
while (tx_buffer != first) {
8025+
for (;;) {
8026+
tx_buffer = &tx_ring->tx_buffer_info[i];
80278027
if (dma_unmap_len(tx_buffer, len))
80288028
dma_unmap_page(tx_ring->dev,
80298029
dma_unmap_addr(tx_buffer, dma),
80308030
dma_unmap_len(tx_buffer, len),
80318031
DMA_TO_DEVICE);
80328032
dma_unmap_len_set(tx_buffer, len, 0);
8033-
8034-
if (i--)
8033+
if (tx_buffer == first)
8034+
break;
8035+
if (i == 0)
80358036
i += tx_ring->count;
8036-
tx_buffer = &tx_ring->tx_buffer_info[i];
8037+
i--;
80378038
}
80388039

8039-
if (dma_unmap_len(tx_buffer, len))
8040-
dma_unmap_single(tx_ring->dev,
8041-
dma_unmap_addr(tx_buffer, dma),
8042-
dma_unmap_len(tx_buffer, len),
8043-
DMA_TO_DEVICE);
8044-
dma_unmap_len_set(tx_buffer, len, 0);
8045-
80468040
dev_kfree_skb_any(first->skb);
80478041
first->skb = NULL;
80488042

drivers/net/ethernet/marvell/mvpp2.c

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1167,6 +1167,11 @@ struct mvpp2_bm_pool {
11671167
u32 port_map;
11681168
};
11691169

1170+
#define IS_TSO_HEADER(txq_pcpu, addr) \
1171+
((addr) >= (txq_pcpu)->tso_headers_dma && \
1172+
(addr) < (txq_pcpu)->tso_headers_dma + \
1173+
(txq_pcpu)->size * TSO_HEADER_SIZE)
1174+
11701175
/* Queue modes */
11711176
#define MVPP2_QDIST_SINGLE_MODE 0
11721177
#define MVPP2_QDIST_MULTI_MODE 1
@@ -1534,7 +1539,7 @@ static bool mvpp2_prs_tcam_data_cmp(struct mvpp2_prs_entry *pe, int offs,
15341539
int off = MVPP2_PRS_TCAM_DATA_BYTE(offs);
15351540
u16 tcam_data;
15361541

1537-
tcam_data = (8 << pe->tcam.byte[off + 1]) | pe->tcam.byte[off];
1542+
tcam_data = (pe->tcam.byte[off + 1] << 8) | pe->tcam.byte[off];
15381543
if (tcam_data != data)
15391544
return false;
15401545
return true;
@@ -2609,8 +2614,8 @@ static void mvpp2_prs_mac_init(struct mvpp2 *priv)
26092614
/* place holders only - no ports */
26102615
mvpp2_prs_mac_drop_all_set(priv, 0, false);
26112616
mvpp2_prs_mac_promisc_set(priv, 0, false);
2612-
mvpp2_prs_mac_multi_set(priv, MVPP2_PE_MAC_MC_ALL, 0, false);
2613-
mvpp2_prs_mac_multi_set(priv, MVPP2_PE_MAC_MC_IP6, 0, false);
2617+
mvpp2_prs_mac_multi_set(priv, 0, MVPP2_PE_MAC_MC_ALL, false);
2618+
mvpp2_prs_mac_multi_set(priv, 0, MVPP2_PE_MAC_MC_IP6, false);
26142619
}
26152620

26162621
/* Set default entries for various types of dsa packets */
@@ -3391,7 +3396,7 @@ mvpp2_prs_mac_da_range_find(struct mvpp2 *priv, int pmap, const u8 *da,
33913396
struct mvpp2_prs_entry *pe;
33923397
int tid;
33933398

3394-
pe = kzalloc(sizeof(*pe), GFP_KERNEL);
3399+
pe = kzalloc(sizeof(*pe), GFP_ATOMIC);
33953400
if (!pe)
33963401
return NULL;
33973402
mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_MAC);
@@ -3453,7 +3458,7 @@ static int mvpp2_prs_mac_da_accept(struct mvpp2 *priv, int port,
34533458
if (tid < 0)
34543459
return tid;
34553460

3456-
pe = kzalloc(sizeof(*pe), GFP_KERNEL);
3461+
pe = kzalloc(sizeof(*pe), GFP_ATOMIC);
34573462
if (!pe)
34583463
return -ENOMEM;
34593464
mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_MAC);
@@ -5321,8 +5326,9 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port,
53215326
struct mvpp2_txq_pcpu_buf *tx_buf =
53225327
txq_pcpu->buffs + txq_pcpu->txq_get_index;
53235328

5324-
dma_unmap_single(port->dev->dev.parent, tx_buf->dma,
5325-
tx_buf->size, DMA_TO_DEVICE);
5329+
if (!IS_TSO_HEADER(txq_pcpu, tx_buf->dma))
5330+
dma_unmap_single(port->dev->dev.parent, tx_buf->dma,
5331+
tx_buf->size, DMA_TO_DEVICE);
53265332
if (tx_buf->skb)
53275333
dev_kfree_skb_any(tx_buf->skb);
53285334

@@ -5609,7 +5615,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
56095615

56105616
txq_pcpu->tso_headers =
56115617
dma_alloc_coherent(port->dev->dev.parent,
5612-
MVPP2_AGGR_TXQ_SIZE * TSO_HEADER_SIZE,
5618+
txq_pcpu->size * TSO_HEADER_SIZE,
56135619
&txq_pcpu->tso_headers_dma,
56145620
GFP_KERNEL);
56155621
if (!txq_pcpu->tso_headers)
@@ -5623,7 +5629,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
56235629
kfree(txq_pcpu->buffs);
56245630

56255631
dma_free_coherent(port->dev->dev.parent,
5626-
MVPP2_AGGR_TXQ_SIZE * MVPP2_DESC_ALIGNED_SIZE,
5632+
txq_pcpu->size * TSO_HEADER_SIZE,
56275633
txq_pcpu->tso_headers,
56285634
txq_pcpu->tso_headers_dma);
56295635
}
@@ -5647,7 +5653,7 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port,
56475653
kfree(txq_pcpu->buffs);
56485654

56495655
dma_free_coherent(port->dev->dev.parent,
5650-
MVPP2_AGGR_TXQ_SIZE * MVPP2_DESC_ALIGNED_SIZE,
5656+
txq_pcpu->size * TSO_HEADER_SIZE,
56515657
txq_pcpu->tso_headers,
56525658
txq_pcpu->tso_headers_dma);
56535659
}
@@ -6212,12 +6218,15 @@ static inline void
62126218
tx_desc_unmap_put(struct mvpp2_port *port, struct mvpp2_tx_queue *txq,
62136219
struct mvpp2_tx_desc *desc)
62146220
{
6221+
struct mvpp2_txq_pcpu *txq_pcpu = this_cpu_ptr(txq->pcpu);
6222+
62156223
dma_addr_t buf_dma_addr =
62166224
mvpp2_txdesc_dma_addr_get(port, desc);
62176225
size_t buf_sz =
62186226
mvpp2_txdesc_size_get(port, desc);
6219-
dma_unmap_single(port->dev->dev.parent, buf_dma_addr,
6220-
buf_sz, DMA_TO_DEVICE);
6227+
if (!IS_TSO_HEADER(txq_pcpu, buf_dma_addr))
6228+
dma_unmap_single(port->dev->dev.parent, buf_dma_addr,
6229+
buf_sz, DMA_TO_DEVICE);
62216230
mvpp2_txq_desc_put(txq);
62226231
}
62236232

@@ -6490,7 +6499,7 @@ static int mvpp2_tx(struct sk_buff *skb, struct net_device *dev)
64906499
}
64916500

64926501
/* Finalize TX processing */
6493-
if (txq_pcpu->count >= txq->done_pkts_coal)
6502+
if (!port->has_tx_irqs && txq_pcpu->count >= txq->done_pkts_coal)
64946503
mvpp2_txq_done(port, txq, txq_pcpu);
64956504

64966505
/* Set the timer in case not all frags were processed */

0 commit comments

Comments
 (0)