aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-10-29 11:11:49 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-10-29 11:11:49 -0400
commit19e12196da601f7b80b5639adbcecf60fae13389 (patch)
treefdf8c4acac3e7b126c13ef57dbb66f87ff53e441 /drivers
parent25a5d23b47994cdb451dcd2bc8ac310a1492f71b (diff)
parent6c325f4eca9ee9eb32cf58768e6e4ebcabaa8d6e (diff)
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 ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/can/sun4i_can.c3
-rw-r--r--drivers/net/can/usb/kvaser_usb.c9
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_ethtool.c9
-rw-r--r--drivers/net/ethernet/intel/e1000/e1000_main.c11
-rw-r--r--drivers/net/ethernet/intel/i40e/i40e_txrx.c3
-rw-r--r--drivers/net/ethernet/intel/igb/igb_main.c2
-rw-r--r--drivers/net/ethernet/intel/ixgbe/ixgbe_main.c18
-rw-r--r--drivers/net/ethernet/marvell/mvpp2.c35
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/dev.c70
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c113
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/en_tc.c89
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/health.c5
-rw-r--r--drivers/net/ethernet/mellanox/mlx5/core/port.c21
-rw-r--r--drivers/net/ethernet/netronome/nfp/flower/action.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c2
-rw-r--r--drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c7
-rw-r--r--drivers/net/ipvlan/ipvtap.c4
-rw-r--r--drivers/net/macvtap.c4
-rw-r--r--drivers/net/tap.c23
-rw-r--r--drivers/net/tun.c3
-rw-r--r--drivers/net/usb/cdc_ether.c14
-rw-r--r--drivers/net/usb/r8152.c2
22 files changed, 299 insertions, 150 deletions
diff --git a/drivers/net/can/sun4i_can.c b/drivers/net/can/sun4i_can.c
index 68ef0a4cd821..b0c80859f746 100644
--- a/drivers/net/can/sun4i_can.c
+++ b/drivers/net/can/sun4i_can.c
@@ -342,7 +342,7 @@ static int sun4i_can_start(struct net_device *dev)
342 342
343 /* enter the selected mode */ 343 /* enter the selected mode */
344 mod_reg_val = readl(priv->base + SUN4I_REG_MSEL_ADDR); 344 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)
346 mod_reg_val |= SUN4I_MSEL_LOOPBACK_MODE; 346 mod_reg_val |= SUN4I_MSEL_LOOPBACK_MODE;
347 else if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY) 347 else if (priv->can.ctrlmode & CAN_CTRLMODE_LISTENONLY)
348 mod_reg_val |= SUN4I_MSEL_LISTEN_ONLY_MODE; 348 mod_reg_val |= SUN4I_MSEL_LISTEN_ONLY_MODE;
@@ -811,7 +811,6 @@ static int sun4ican_probe(struct platform_device *pdev)
811 priv->can.ctrlmode_supported = CAN_CTRLMODE_BERR_REPORTING | 811 priv->can.ctrlmode_supported = CAN_CTRLMODE_BERR_REPORTING |
812 CAN_CTRLMODE_LISTENONLY | 812 CAN_CTRLMODE_LISTENONLY |
813 CAN_CTRLMODE_LOOPBACK | 813 CAN_CTRLMODE_LOOPBACK |
814 CAN_CTRLMODE_PRESUME_ACK |
815 CAN_CTRLMODE_3_SAMPLES; 814 CAN_CTRLMODE_3_SAMPLES;
816 priv->base = addr; 815 priv->base = addr;
817 priv->clk = clk; 816 priv->clk = clk;
diff --git a/drivers/net/can/usb/kvaser_usb.c b/drivers/net/can/usb/kvaser_usb.c
index 18cc529fb807..9b18d96ef526 100644
--- a/drivers/net/can/usb/kvaser_usb.c
+++ b/drivers/net/can/usb/kvaser_usb.c
@@ -137,6 +137,7 @@ static inline bool kvaser_is_usbcan(const struct usb_device_id *id)
137#define CMD_RESET_ERROR_COUNTER 49 137#define CMD_RESET_ERROR_COUNTER 49
138#define CMD_TX_ACKNOWLEDGE 50 138#define CMD_TX_ACKNOWLEDGE 50
139#define CMD_CAN_ERROR_EVENT 51 139#define CMD_CAN_ERROR_EVENT 51
140#define CMD_FLUSH_QUEUE_REPLY 68
140 141
141#define CMD_LEAF_USB_THROTTLE 77 142#define CMD_LEAF_USB_THROTTLE 77
142#define CMD_LEAF_LOG_MESSAGE 106 143#define CMD_LEAF_LOG_MESSAGE 106
@@ -1301,6 +1302,11 @@ static void kvaser_usb_handle_message(const struct kvaser_usb *dev,
1301 goto warn; 1302 goto warn;
1302 break; 1303 break;
1303 1304
1305 case CMD_FLUSH_QUEUE_REPLY:
1306 if (dev->family != KVASER_LEAF)
1307 goto warn;
1308 break;
1309
1304 default: 1310 default:
1305warn: dev_warn(dev->udev->dev.parent, 1311warn: dev_warn(dev->udev->dev.parent,
1306 "Unhandled message (%d)\n", msg->id); 1312 "Unhandled message (%d)\n", msg->id);
@@ -1609,7 +1615,8 @@ static int kvaser_usb_close(struct net_device *netdev)
1609 if (err) 1615 if (err)
1610 netdev_warn(netdev, "Cannot flush queue, error %d\n", err); 1616 netdev_warn(netdev, "Cannot flush queue, error %d\n", err);
1611 1617
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)
1613 netdev_warn(netdev, "Cannot reset card, error %d\n", err); 1620 netdev_warn(netdev, "Cannot reset card, error %d\n", err);
1614 1621
1615 err = kvaser_usb_stop_chip(priv); 1622 err = kvaser_usb_stop_chip(priv);
diff --git a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
index ec8aa4562cc9..3b3983a1ffbb 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_ethtool.c
@@ -1824,11 +1824,12 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
1824{ 1824{
1825 struct e1000_adapter *adapter = netdev_priv(netdev); 1825 struct e1000_adapter *adapter = netdev_priv(netdev);
1826 int i; 1826 int i;
1827 char *p = NULL;
1828 const struct e1000_stats *stat = e1000_gstrings_stats; 1827 const struct e1000_stats *stat = e1000_gstrings_stats;
1829 1828
1830 e1000_update_stats(adapter); 1829 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
1832 switch (stat->type) { 1833 switch (stat->type) {
1833 case NETDEV_STATS: 1834 case NETDEV_STATS:
1834 p = (char *)netdev + stat->stat_offset; 1835 p = (char *)netdev + stat->stat_offset;
@@ -1839,15 +1840,13 @@ static void e1000_get_ethtool_stats(struct net_device *netdev,
1839 default: 1840 default:
1840 WARN_ONCE(1, "Invalid E1000 stat type: %u index %d\n", 1841 WARN_ONCE(1, "Invalid E1000 stat type: %u index %d\n",
1841 stat->type, i); 1842 stat->type, i);
1842 break; 1843 continue;
1843 } 1844 }
1844 1845
1845 if (stat->sizeof_stat == sizeof(u64)) 1846 if (stat->sizeof_stat == sizeof(u64))
1846 data[i] = *(u64 *)p; 1847 data[i] = *(u64 *)p;
1847 else 1848 else
1848 data[i] = *(u32 *)p; 1849 data[i] = *(u32 *)p;
1849
1850 stat++;
1851 } 1850 }
1852/* BUG_ON(i != E1000_STATS_LEN); */ 1851/* BUG_ON(i != E1000_STATS_LEN); */
1853} 1852}
diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
index 98375e1e1185..1982f7917a8d 100644
--- a/drivers/net/ethernet/intel/e1000/e1000_main.c
+++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
@@ -520,8 +520,6 @@ void e1000_down(struct e1000_adapter *adapter)
520 struct net_device *netdev = adapter->netdev; 520 struct net_device *netdev = adapter->netdev;
521 u32 rctl, tctl; 521 u32 rctl, tctl;
522 522
523 netif_carrier_off(netdev);
524
525 /* disable receives in the hardware */ 523 /* disable receives in the hardware */
526 rctl = er32(RCTL); 524 rctl = er32(RCTL);
527 ew32(RCTL, rctl & ~E1000_RCTL_EN); 525 ew32(RCTL, rctl & ~E1000_RCTL_EN);
@@ -537,6 +535,15 @@ void e1000_down(struct e1000_adapter *adapter)
537 E1000_WRITE_FLUSH(); 535 E1000_WRITE_FLUSH();
538 msleep(10); 536 msleep(10);
539 537
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
540 napi_disable(&adapter->napi); 547 napi_disable(&adapter->napi);
541 548
542 e1000_irq_disable(adapter); 549 e1000_irq_disable(adapter);
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index 2756131495f0..120c68f78951 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -2102,6 +2102,7 @@ static int i40e_clean_rx_irq(struct i40e_ring *rx_ring, int budget)
2102 2102
2103 if (unlikely(i40e_rx_is_programming_status(qword))) { 2103 if (unlikely(i40e_rx_is_programming_status(qword))) {
2104 i40e_clean_programming_status(rx_ring, rx_desc, qword); 2104 i40e_clean_programming_status(rx_ring, rx_desc, qword);
2105 cleaned_count++;
2105 continue; 2106 continue;
2106 } 2107 }
2107 size = (qword & I40E_RXD_QW1_LENGTH_PBUF_MASK) >> 2108 size = (qword & I40E_RXD_QW1_LENGTH_PBUF_MASK) >>
@@ -2269,7 +2270,7 @@ static inline void i40e_update_enable_itr(struct i40e_vsi *vsi,
2269 goto enable_int; 2270 goto enable_int;
2270 } 2271 }
2271 2272
2272 if (ITR_IS_DYNAMIC(tx_itr_setting)) { 2273 if (ITR_IS_DYNAMIC(rx_itr_setting)) {
2273 rx = i40e_set_new_dynamic_itr(&q_vector->rx); 2274 rx = i40e_set_new_dynamic_itr(&q_vector->rx);
2274 rxval = i40e_buildreg_itr(I40E_RX_ITR, q_vector->rx.itr); 2275 rxval = i40e_buildreg_itr(I40E_RX_ITR, q_vector->rx.itr);
2275 } 2276 }
diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index fd4a46b03cc8..ea69af267d63 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -5326,7 +5326,7 @@ dma_error:
5326 DMA_TO_DEVICE); 5326 DMA_TO_DEVICE);
5327 dma_unmap_len_set(tx_buffer, len, 0); 5327 dma_unmap_len_set(tx_buffer, len, 0);
5328 5328
5329 if (i--) 5329 if (i-- == 0)
5330 i += tx_ring->count; 5330 i += tx_ring->count;
5331 tx_buffer = &tx_ring->tx_buffer_info[i]; 5331 tx_buffer = &tx_ring->tx_buffer_info[i];
5332 } 5332 }
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
index 4d76afd13868..6d5f31e94358 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_main.c
@@ -8020,29 +8020,23 @@ static int ixgbe_tx_map(struct ixgbe_ring *tx_ring,
8020 return 0; 8020 return 0;
8021dma_error: 8021dma_error:
8022 dev_err(tx_ring->dev, "TX DMA map failed\n"); 8022 dev_err(tx_ring->dev, "TX DMA map failed\n");
8023 tx_buffer = &tx_ring->tx_buffer_info[i];
8024 8023
8025 /* clear dma mappings for failed tx_buffer_info map */ 8024 /* 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];
8027 if (dma_unmap_len(tx_buffer, len)) 8027 if (dma_unmap_len(tx_buffer, len))
8028 dma_unmap_page(tx_ring->dev, 8028 dma_unmap_page(tx_ring->dev,
8029 dma_unmap_addr(tx_buffer, dma), 8029 dma_unmap_addr(tx_buffer, dma),
8030 dma_unmap_len(tx_buffer, len), 8030 dma_unmap_len(tx_buffer, len),
8031 DMA_TO_DEVICE); 8031 DMA_TO_DEVICE);
8032 dma_unmap_len_set(tx_buffer, len, 0); 8032 dma_unmap_len_set(tx_buffer, len, 0);
8033 8033 if (tx_buffer == first)
8034 if (i--) 8034 break;
8035 if (i == 0)
8035 i += tx_ring->count; 8036 i += tx_ring->count;
8036 tx_buffer = &tx_ring->tx_buffer_info[i]; 8037 i--;
8037 } 8038 }
8038 8039
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
8046 dev_kfree_skb_any(first->skb); 8040 dev_kfree_skb_any(first->skb);
8047 first->skb = NULL; 8041 first->skb = NULL;
8048 8042
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 9c86cb7cb988..a37af5813f33 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -1167,6 +1167,11 @@ struct mvpp2_bm_pool {
1167 u32 port_map; 1167 u32 port_map;
1168}; 1168};
1169 1169
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
1170/* Queue modes */ 1175/* Queue modes */
1171#define MVPP2_QDIST_SINGLE_MODE 0 1176#define MVPP2_QDIST_SINGLE_MODE 0
1172#define MVPP2_QDIST_MULTI_MODE 1 1177#define MVPP2_QDIST_MULTI_MODE 1
@@ -1534,7 +1539,7 @@ static bool mvpp2_prs_tcam_data_cmp(struct mvpp2_prs_entry *pe, int offs,
1534 int off = MVPP2_PRS_TCAM_DATA_BYTE(offs); 1539 int off = MVPP2_PRS_TCAM_DATA_BYTE(offs);
1535 u16 tcam_data; 1540 u16 tcam_data;
1536 1541
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];
1538 if (tcam_data != data) 1543 if (tcam_data != data)
1539 return false; 1544 return false;
1540 return true; 1545 return true;
@@ -2609,8 +2614,8 @@ static void mvpp2_prs_mac_init(struct mvpp2 *priv)
2609 /* place holders only - no ports */ 2614 /* place holders only - no ports */
2610 mvpp2_prs_mac_drop_all_set(priv, 0, false); 2615 mvpp2_prs_mac_drop_all_set(priv, 0, false);
2611 mvpp2_prs_mac_promisc_set(priv, 0, false); 2616 mvpp2_prs_mac_promisc_set(priv, 0, false);
2612 mvpp2_prs_mac_multi_set(priv, MVPP2_PE_MAC_MC_ALL, 0, false); 2617 mvpp2_prs_mac_multi_set(priv, 0, MVPP2_PE_MAC_MC_ALL, false);
2613 mvpp2_prs_mac_multi_set(priv, MVPP2_PE_MAC_MC_IP6, 0, false); 2618 mvpp2_prs_mac_multi_set(priv, 0, MVPP2_PE_MAC_MC_IP6, false);
2614} 2619}
2615 2620
2616/* Set default entries for various types of dsa packets */ 2621/* 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,
3391 struct mvpp2_prs_entry *pe; 3396 struct mvpp2_prs_entry *pe;
3392 int tid; 3397 int tid;
3393 3398
3394 pe = kzalloc(sizeof(*pe), GFP_KERNEL); 3399 pe = kzalloc(sizeof(*pe), GFP_ATOMIC);
3395 if (!pe) 3400 if (!pe)
3396 return NULL; 3401 return NULL;
3397 mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_MAC); 3402 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,
3453 if (tid < 0) 3458 if (tid < 0)
3454 return tid; 3459 return tid;
3455 3460
3456 pe = kzalloc(sizeof(*pe), GFP_KERNEL); 3461 pe = kzalloc(sizeof(*pe), GFP_ATOMIC);
3457 if (!pe) 3462 if (!pe)
3458 return -ENOMEM; 3463 return -ENOMEM;
3459 mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_MAC); 3464 mvpp2_prs_tcam_lu_set(pe, MVPP2_PRS_LU_MAC);
@@ -5321,8 +5326,9 @@ static void mvpp2_txq_bufs_free(struct mvpp2_port *port,
5321 struct mvpp2_txq_pcpu_buf *tx_buf = 5326 struct mvpp2_txq_pcpu_buf *tx_buf =
5322 txq_pcpu->buffs + txq_pcpu->txq_get_index; 5327 txq_pcpu->buffs + txq_pcpu->txq_get_index;
5323 5328
5324 dma_unmap_single(port->dev->dev.parent, tx_buf->dma, 5329 if (!IS_TSO_HEADER(txq_pcpu, tx_buf->dma))
5325 tx_buf->size, DMA_TO_DEVICE); 5330 dma_unmap_single(port->dev->dev.parent, tx_buf->dma,
5331 tx_buf->size, DMA_TO_DEVICE);
5326 if (tx_buf->skb) 5332 if (tx_buf->skb)
5327 dev_kfree_skb_any(tx_buf->skb); 5333 dev_kfree_skb_any(tx_buf->skb);
5328 5334
@@ -5609,7 +5615,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
5609 5615
5610 txq_pcpu->tso_headers = 5616 txq_pcpu->tso_headers =
5611 dma_alloc_coherent(port->dev->dev.parent, 5617 dma_alloc_coherent(port->dev->dev.parent,
5612 MVPP2_AGGR_TXQ_SIZE * TSO_HEADER_SIZE, 5618 txq_pcpu->size * TSO_HEADER_SIZE,
5613 &txq_pcpu->tso_headers_dma, 5619 &txq_pcpu->tso_headers_dma,
5614 GFP_KERNEL); 5620 GFP_KERNEL);
5615 if (!txq_pcpu->tso_headers) 5621 if (!txq_pcpu->tso_headers)
@@ -5623,7 +5629,7 @@ cleanup:
5623 kfree(txq_pcpu->buffs); 5629 kfree(txq_pcpu->buffs);
5624 5630
5625 dma_free_coherent(port->dev->dev.parent, 5631 dma_free_coherent(port->dev->dev.parent,
5626 MVPP2_AGGR_TXQ_SIZE * MVPP2_DESC_ALIGNED_SIZE, 5632 txq_pcpu->size * TSO_HEADER_SIZE,
5627 txq_pcpu->tso_headers, 5633 txq_pcpu->tso_headers,
5628 txq_pcpu->tso_headers_dma); 5634 txq_pcpu->tso_headers_dma);
5629 } 5635 }
@@ -5647,7 +5653,7 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port,
5647 kfree(txq_pcpu->buffs); 5653 kfree(txq_pcpu->buffs);
5648 5654
5649 dma_free_coherent(port->dev->dev.parent, 5655 dma_free_coherent(port->dev->dev.parent,
5650 MVPP2_AGGR_TXQ_SIZE * MVPP2_DESC_ALIGNED_SIZE, 5656 txq_pcpu->size * TSO_HEADER_SIZE,
5651 txq_pcpu->tso_headers, 5657 txq_pcpu->tso_headers,
5652 txq_pcpu->tso_headers_dma); 5658 txq_pcpu->tso_headers_dma);
5653 } 5659 }
@@ -6212,12 +6218,15 @@ static inline void
6212tx_desc_unmap_put(struct mvpp2_port *port, struct mvpp2_tx_queue *txq, 6218tx_desc_unmap_put(struct mvpp2_port *port, struct mvpp2_tx_queue *txq,
6213 struct mvpp2_tx_desc *desc) 6219 struct mvpp2_tx_desc *desc)
6214{ 6220{
6221 struct mvpp2_txq_pcpu *txq_pcpu = this_cpu_ptr(txq->pcpu);
6222
6215 dma_addr_t buf_dma_addr = 6223 dma_addr_t buf_dma_addr =
6216 mvpp2_txdesc_dma_addr_get(port, desc); 6224 mvpp2_txdesc_dma_addr_get(port, desc);
6217 size_t buf_sz = 6225 size_t buf_sz =
6218 mvpp2_txdesc_size_get(port, desc); 6226 mvpp2_txdesc_size_get(port, desc);
6219 dma_unmap_single(port->dev->dev.parent, buf_dma_addr, 6227 if (!IS_TSO_HEADER(txq_pcpu, buf_dma_addr))
6220 buf_sz, DMA_TO_DEVICE); 6228 dma_unmap_single(port->dev->dev.parent, buf_dma_addr,
6229 buf_sz, DMA_TO_DEVICE);
6221 mvpp2_txq_desc_put(txq); 6230 mvpp2_txq_desc_put(txq);
6222} 6231}
6223 6232
@@ -6490,7 +6499,7 @@ out:
6490 } 6499 }
6491 6500
6492 /* Finalize TX processing */ 6501 /* 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)
6494 mvpp2_txq_done(port, txq, txq_pcpu); 6503 mvpp2_txq_done(port, txq, txq_pcpu);
6495 6504
6496 /* Set the timer in case not all frags were processed */ 6505 /* Set the timer in case not all frags were processed */
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/dev.c b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
index ff60cf7342ca..fc281712869b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/dev.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/dev.c
@@ -77,35 +77,41 @@ static void add_delayed_event(struct mlx5_priv *priv,
77 list_add_tail(&delayed_event->list, &priv->waiting_events_list); 77 list_add_tail(&delayed_event->list, &priv->waiting_events_list);
78} 78}
79 79
80static void fire_delayed_event_locked(struct mlx5_device_context *dev_ctx, 80static void delayed_event_release(struct mlx5_device_context *dev_ctx,
81 struct mlx5_core_dev *dev, 81 struct mlx5_priv *priv)
82 struct mlx5_priv *priv)
83{ 82{
83 struct mlx5_core_dev *dev = container_of(priv, struct mlx5_core_dev, priv);
84 struct mlx5_delayed_event *de; 84 struct mlx5_delayed_event *de;
85 struct mlx5_delayed_event *n; 85 struct mlx5_delayed_event *n;
86 struct list_head temp;
86 87
87 /* stop delaying events */ 88 INIT_LIST_HEAD(&temp);
88 priv->is_accum_events = false; 89
90 spin_lock_irq(&priv->ctx_lock);
89 91
90 /* fire all accumulated events before new event comes */ 92 priv->is_accum_events = false;
91 list_for_each_entry_safe(de, n, &priv->waiting_events_list, list) { 93 list_splice_init(&priv->waiting_events_list, &temp);
94 if (!dev_ctx->context)
95 goto out;
96 list_for_each_entry_safe(de, n, &priv->waiting_events_list, list)
92 dev_ctx->intf->event(dev, dev_ctx->context, de->event, de->param); 97 dev_ctx->intf->event(dev, dev_ctx->context, de->event, de->param);
98
99out:
100 spin_unlock_irq(&priv->ctx_lock);
101
102 list_for_each_entry_safe(de, n, &temp, list) {
93 list_del(&de->list); 103 list_del(&de->list);
94 kfree(de); 104 kfree(de);
95 } 105 }
96} 106}
97 107
98static void cleanup_delayed_evets(struct mlx5_priv *priv) 108/* accumulating events that can come after mlx5_ib calls to
109 * ib_register_device, till adding that interface to the events list.
110 */
111static void delayed_event_start(struct mlx5_priv *priv)
99{ 112{
100 struct mlx5_delayed_event *de;
101 struct mlx5_delayed_event *n;
102
103 spin_lock_irq(&priv->ctx_lock); 113 spin_lock_irq(&priv->ctx_lock);
104 priv->is_accum_events = false; 114 priv->is_accum_events = true;
105 list_for_each_entry_safe(de, n, &priv->waiting_events_list, list) {
106 list_del(&de->list);
107 kfree(de);
108 }
109 spin_unlock_irq(&priv->ctx_lock); 115 spin_unlock_irq(&priv->ctx_lock);
110} 116}
111 117
@@ -122,11 +128,8 @@ void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv)
122 return; 128 return;
123 129
124 dev_ctx->intf = intf; 130 dev_ctx->intf = intf;
125 /* accumulating events that can come after mlx5_ib calls to
126 * ib_register_device, till adding that interface to the events list.
127 */
128 131
129 priv->is_accum_events = true; 132 delayed_event_start(priv);
130 133
131 dev_ctx->context = intf->add(dev); 134 dev_ctx->context = intf->add(dev);
132 set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state); 135 set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state);
@@ -137,8 +140,6 @@ void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv)
137 spin_lock_irq(&priv->ctx_lock); 140 spin_lock_irq(&priv->ctx_lock);
138 list_add_tail(&dev_ctx->list, &priv->ctx_list); 141 list_add_tail(&dev_ctx->list, &priv->ctx_list);
139 142
140 fire_delayed_event_locked(dev_ctx, dev, priv);
141
142#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING 143#ifdef CONFIG_INFINIBAND_ON_DEMAND_PAGING
143 if (dev_ctx->intf->pfault) { 144 if (dev_ctx->intf->pfault) {
144 if (priv->pfault) { 145 if (priv->pfault) {
@@ -150,11 +151,12 @@ void mlx5_add_device(struct mlx5_interface *intf, struct mlx5_priv *priv)
150 } 151 }
151#endif 152#endif
152 spin_unlock_irq(&priv->ctx_lock); 153 spin_unlock_irq(&priv->ctx_lock);
153 } else {
154 kfree(dev_ctx);
155 /* delete all accumulated events */
156 cleanup_delayed_evets(priv);
157 } 154 }
155
156 delayed_event_release(dev_ctx, priv);
157
158 if (!dev_ctx->context)
159 kfree(dev_ctx);
158} 160}
159 161
160static struct mlx5_device_context *mlx5_get_device(struct mlx5_interface *intf, 162static struct mlx5_device_context *mlx5_get_device(struct mlx5_interface *intf,
@@ -205,17 +207,21 @@ static void mlx5_attach_interface(struct mlx5_interface *intf, struct mlx5_priv
205 if (!dev_ctx) 207 if (!dev_ctx)
206 return; 208 return;
207 209
210 delayed_event_start(priv);
208 if (intf->attach) { 211 if (intf->attach) {
209 if (test_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state)) 212 if (test_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state))
210 return; 213 goto out;
211 intf->attach(dev, dev_ctx->context); 214 intf->attach(dev, dev_ctx->context);
212 set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state); 215 set_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state);
213 } else { 216 } else {
214 if (test_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state)) 217 if (test_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state))
215 return; 218 goto out;
216 dev_ctx->context = intf->add(dev); 219 dev_ctx->context = intf->add(dev);
217 set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state); 220 set_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state);
218 } 221 }
222
223out:
224 delayed_event_release(dev_ctx, priv);
219} 225}
220 226
221void mlx5_attach_device(struct mlx5_core_dev *dev) 227void mlx5_attach_device(struct mlx5_core_dev *dev)
@@ -414,8 +420,14 @@ void mlx5_core_event(struct mlx5_core_dev *dev, enum mlx5_dev_event event,
414 if (priv->is_accum_events) 420 if (priv->is_accum_events)
415 add_delayed_event(priv, dev, event, param); 421 add_delayed_event(priv, dev, event, param);
416 422
423 /* After mlx5_detach_device, the dev_ctx->intf is still set and dev_ctx is
424 * still in priv->ctx_list. In this case, only notify the dev_ctx if its
425 * ADDED or ATTACHED bit are set.
426 */
417 list_for_each_entry(dev_ctx, &priv->ctx_list, list) 427 list_for_each_entry(dev_ctx, &priv->ctx_list, list)
418 if (dev_ctx->intf->event) 428 if (dev_ctx->intf->event &&
429 (test_bit(MLX5_INTERFACE_ADDED, &dev_ctx->state) ||
430 test_bit(MLX5_INTERFACE_ATTACHED, &dev_ctx->state)))
419 dev_ctx->intf->event(dev, dev_ctx->context, event, param); 431 dev_ctx->intf->event(dev, dev_ctx->context, event, param);
420 432
421 spin_unlock_irqrestore(&priv->ctx_lock, flags); 433 spin_unlock_irqrestore(&priv->ctx_lock, flags);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
index c1d384fca4dc..51c4cc00a186 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_dcbnl.c
@@ -41,6 +41,11 @@
41#define MLX5E_CEE_STATE_UP 1 41#define MLX5E_CEE_STATE_UP 1
42#define MLX5E_CEE_STATE_DOWN 0 42#define MLX5E_CEE_STATE_DOWN 0
43 43
44enum {
45 MLX5E_VENDOR_TC_GROUP_NUM = 7,
46 MLX5E_LOWEST_PRIO_GROUP = 0,
47};
48
44/* If dcbx mode is non-host set the dcbx mode to host. 49/* If dcbx mode is non-host set the dcbx mode to host.
45 */ 50 */
46static int mlx5e_dcbnl_set_dcbx_mode(struct mlx5e_priv *priv, 51static int mlx5e_dcbnl_set_dcbx_mode(struct mlx5e_priv *priv,
@@ -85,6 +90,9 @@ static int mlx5e_dcbnl_ieee_getets(struct net_device *netdev,
85{ 90{
86 struct mlx5e_priv *priv = netdev_priv(netdev); 91 struct mlx5e_priv *priv = netdev_priv(netdev);
87 struct mlx5_core_dev *mdev = priv->mdev; 92 struct mlx5_core_dev *mdev = priv->mdev;
93 u8 tc_group[IEEE_8021QAZ_MAX_TCS];
94 bool is_tc_group_6_exist = false;
95 bool is_zero_bw_ets_tc = false;
88 int err = 0; 96 int err = 0;
89 int i; 97 int i;
90 98
@@ -96,37 +104,64 @@ static int mlx5e_dcbnl_ieee_getets(struct net_device *netdev,
96 err = mlx5_query_port_prio_tc(mdev, i, &ets->prio_tc[i]); 104 err = mlx5_query_port_prio_tc(mdev, i, &ets->prio_tc[i]);
97 if (err) 105 if (err)
98 return err; 106 return err;
99 }
100 107
101 for (i = 0; i < ets->ets_cap; i++) { 108 err = mlx5_query_port_tc_group(mdev, i, &tc_group[i]);
109 if (err)
110 return err;
111
102 err = mlx5_query_port_tc_bw_alloc(mdev, i, &ets->tc_tx_bw[i]); 112 err = mlx5_query_port_tc_bw_alloc(mdev, i, &ets->tc_tx_bw[i]);
103 if (err) 113 if (err)
104 return err; 114 return err;
115
116 if (ets->tc_tx_bw[i] < MLX5E_MAX_BW_ALLOC &&
117 tc_group[i] == (MLX5E_LOWEST_PRIO_GROUP + 1))
118 is_zero_bw_ets_tc = true;
119
120 if (tc_group[i] == (MLX5E_VENDOR_TC_GROUP_NUM - 1))
121 is_tc_group_6_exist = true;
122 }
123
124 /* Report 0% ets tc if exits*/
125 if (is_zero_bw_ets_tc) {
126 for (i = 0; i < ets->ets_cap; i++)
127 if (tc_group[i] == MLX5E_LOWEST_PRIO_GROUP)
128 ets->tc_tx_bw[i] = 0;
129 }
130
131 /* Update tc_tsa based on fw setting*/
132 for (i = 0; i < ets->ets_cap; i++) {
105 if (ets->tc_tx_bw[i] < MLX5E_MAX_BW_ALLOC) 133 if (ets->tc_tx_bw[i] < MLX5E_MAX_BW_ALLOC)
106 priv->dcbx.tc_tsa[i] = IEEE_8021QAZ_TSA_ETS; 134 priv->dcbx.tc_tsa[i] = IEEE_8021QAZ_TSA_ETS;
135 else if (tc_group[i] == MLX5E_VENDOR_TC_GROUP_NUM &&
136 !is_tc_group_6_exist)
137 priv->dcbx.tc_tsa[i] = IEEE_8021QAZ_TSA_VENDOR;
107 } 138 }
108
109 memcpy(ets->tc_tsa, priv->dcbx.tc_tsa, sizeof(ets->tc_tsa)); 139 memcpy(ets->tc_tsa, priv->dcbx.tc_tsa, sizeof(ets->tc_tsa));
110 140
111 return err; 141 return err;
112} 142}
113 143
114enum {
115 MLX5E_VENDOR_TC_GROUP_NUM = 7,
116 MLX5E_ETS_TC_GROUP_NUM = 0,
117};
118
119static void mlx5e_build_tc_group(struct ieee_ets *ets, u8 *tc_group, int max_tc) 144static void mlx5e_build_tc_group(struct ieee_ets *ets, u8 *tc_group, int max_tc)
120{ 145{
121 bool any_tc_mapped_to_ets = false; 146 bool any_tc_mapped_to_ets = false;
147 bool ets_zero_bw = false;
122 int strict_group; 148 int strict_group;
123 int i; 149 int i;
124 150
125 for (i = 0; i <= max_tc; i++) 151 for (i = 0; i <= max_tc; i++) {
126 if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) 152 if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) {
127 any_tc_mapped_to_ets = true; 153 any_tc_mapped_to_ets = true;
154 if (!ets->tc_tx_bw[i])
155 ets_zero_bw = true;
156 }
157 }
128 158
129 strict_group = any_tc_mapped_to_ets ? 1 : 0; 159 /* strict group has higher priority than ets group */
160 strict_group = MLX5E_LOWEST_PRIO_GROUP;
161 if (any_tc_mapped_to_ets)
162 strict_group++;
163 if (ets_zero_bw)
164 strict_group++;
130 165
131 for (i = 0; i <= max_tc; i++) { 166 for (i = 0; i <= max_tc; i++) {
132 switch (ets->tc_tsa[i]) { 167 switch (ets->tc_tsa[i]) {
@@ -137,7 +172,9 @@ static void mlx5e_build_tc_group(struct ieee_ets *ets, u8 *tc_group, int max_tc)
137 tc_group[i] = strict_group++; 172 tc_group[i] = strict_group++;
138 break; 173 break;
139 case IEEE_8021QAZ_TSA_ETS: 174 case IEEE_8021QAZ_TSA_ETS:
140 tc_group[i] = MLX5E_ETS_TC_GROUP_NUM; 175 tc_group[i] = MLX5E_LOWEST_PRIO_GROUP;
176 if (ets->tc_tx_bw[i] && ets_zero_bw)
177 tc_group[i] = MLX5E_LOWEST_PRIO_GROUP + 1;
141 break; 178 break;
142 } 179 }
143 } 180 }
@@ -146,9 +183,23 @@ static void mlx5e_build_tc_group(struct ieee_ets *ets, u8 *tc_group, int max_tc)
146static void mlx5e_build_tc_tx_bw(struct ieee_ets *ets, u8 *tc_tx_bw, 183static void mlx5e_build_tc_tx_bw(struct ieee_ets *ets, u8 *tc_tx_bw,
147 u8 *tc_group, int max_tc) 184 u8 *tc_group, int max_tc)
148{ 185{
186 int bw_for_ets_zero_bw_tc = 0;
187 int last_ets_zero_bw_tc = -1;
188 int num_ets_zero_bw = 0;
149 int i; 189 int i;
150 190
151 for (i = 0; i <= max_tc; i++) { 191 for (i = 0; i <= max_tc; i++) {
192 if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS &&
193 !ets->tc_tx_bw[i]) {
194 num_ets_zero_bw++;
195 last_ets_zero_bw_tc = i;
196 }
197 }
198
199 if (num_ets_zero_bw)
200 bw_for_ets_zero_bw_tc = MLX5E_MAX_BW_ALLOC / num_ets_zero_bw;
201
202 for (i = 0; i <= max_tc; i++) {
152 switch (ets->tc_tsa[i]) { 203 switch (ets->tc_tsa[i]) {
153 case IEEE_8021QAZ_TSA_VENDOR: 204 case IEEE_8021QAZ_TSA_VENDOR:
154 tc_tx_bw[i] = MLX5E_MAX_BW_ALLOC; 205 tc_tx_bw[i] = MLX5E_MAX_BW_ALLOC;
@@ -157,12 +208,26 @@ static void mlx5e_build_tc_tx_bw(struct ieee_ets *ets, u8 *tc_tx_bw,
157 tc_tx_bw[i] = MLX5E_MAX_BW_ALLOC; 208 tc_tx_bw[i] = MLX5E_MAX_BW_ALLOC;
158 break; 209 break;
159 case IEEE_8021QAZ_TSA_ETS: 210 case IEEE_8021QAZ_TSA_ETS:
160 tc_tx_bw[i] = ets->tc_tx_bw[i]; 211 tc_tx_bw[i] = ets->tc_tx_bw[i] ?
212 ets->tc_tx_bw[i] :
213 bw_for_ets_zero_bw_tc;
161 break; 214 break;
162 } 215 }
163 } 216 }
217
218 /* Make sure the total bw for ets zero bw group is 100% */
219 if (last_ets_zero_bw_tc != -1)
220 tc_tx_bw[last_ets_zero_bw_tc] +=
221 MLX5E_MAX_BW_ALLOC % num_ets_zero_bw;
164} 222}
165 223
224/* If there are ETS BW 0,
225 * Set ETS group # to 1 for all ETS non zero BW tcs. Their sum must be 100%.
226 * Set group #0 to all the ETS BW 0 tcs and
227 * equally splits the 100% BW between them
228 * Report both group #0 and #1 as ETS type.
229 * All the tcs in group #0 will be reported with 0% BW.
230 */
166int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets) 231int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets)
167{ 232{
168 struct mlx5_core_dev *mdev = priv->mdev; 233 struct mlx5_core_dev *mdev = priv->mdev;
@@ -188,7 +253,6 @@ int mlx5e_dcbnl_ieee_setets_core(struct mlx5e_priv *priv, struct ieee_ets *ets)
188 return err; 253 return err;
189 254
190 memcpy(priv->dcbx.tc_tsa, ets->tc_tsa, sizeof(ets->tc_tsa)); 255 memcpy(priv->dcbx.tc_tsa, ets->tc_tsa, sizeof(ets->tc_tsa));
191
192 return err; 256 return err;
193} 257}
194 258
@@ -209,17 +273,9 @@ static int mlx5e_dbcnl_validate_ets(struct net_device *netdev,
209 } 273 }
210 274
211 /* Validate Bandwidth Sum */ 275 /* Validate Bandwidth Sum */
212 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++) { 276 for (i = 0; i < IEEE_8021QAZ_MAX_TCS; i++)
213 if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS) { 277 if (ets->tc_tsa[i] == IEEE_8021QAZ_TSA_ETS)
214 if (!ets->tc_tx_bw[i]) {
215 netdev_err(netdev,
216 "Failed to validate ETS: BW 0 is illegal\n");
217 return -EINVAL;
218 }
219
220 bw_sum += ets->tc_tx_bw[i]; 278 bw_sum += ets->tc_tx_bw[i];
221 }
222 }
223 279
224 if (bw_sum != 0 && bw_sum != 100) { 280 if (bw_sum != 0 && bw_sum != 100) {
225 netdev_err(netdev, 281 netdev_err(netdev,
@@ -533,8 +589,7 @@ static void mlx5e_dcbnl_getpgtccfgtx(struct net_device *netdev,
533static void mlx5e_dcbnl_getpgbwgcfgtx(struct net_device *netdev, 589static void mlx5e_dcbnl_getpgbwgcfgtx(struct net_device *netdev,
534 int pgid, u8 *bw_pct) 590 int pgid, u8 *bw_pct)
535{ 591{
536 struct mlx5e_priv *priv = netdev_priv(netdev); 592 struct ieee_ets ets;
537 struct mlx5_core_dev *mdev = priv->mdev;
538 593
539 if (pgid >= CEE_DCBX_MAX_PGS) { 594 if (pgid >= CEE_DCBX_MAX_PGS) {
540 netdev_err(netdev, 595 netdev_err(netdev,
@@ -542,8 +597,8 @@ static void mlx5e_dcbnl_getpgbwgcfgtx(struct net_device *netdev,
542 return; 597 return;
543 } 598 }
544 599
545 if (mlx5_query_port_tc_bw_alloc(mdev, pgid, bw_pct)) 600 mlx5e_dcbnl_ieee_getets(netdev, &ets);
546 *bw_pct = 0; 601 *bw_pct = ets.tc_tx_bw[pgid];
547} 602}
548 603
549static void mlx5e_dcbnl_setpfccfg(struct net_device *netdev, 604static void mlx5e_dcbnl_setpfccfg(struct net_device *netdev,
@@ -739,8 +794,6 @@ static void mlx5e_ets_init(struct mlx5e_priv *priv)
739 ets.prio_tc[i] = i; 794 ets.prio_tc[i] = i;
740 } 795 }
741 796
742 memcpy(priv->dcbx.tc_tsa, ets.tc_tsa, sizeof(ets.tc_tsa));
743
744 /* tclass[prio=0]=1, tclass[prio=1]=0, tclass[prio=i]=i (for i>1) */ 797 /* tclass[prio=0]=1, tclass[prio=1]=0, tclass[prio=i]=i (for i>1) */
745 ets.prio_tc[0] = 1; 798 ets.prio_tc[0] = 1;
746 ets.prio_tc[1] = 0; 799 ets.prio_tc[1] = 0;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 1aa2028ed995..9ba1f72060aa 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -78,9 +78,11 @@ struct mlx5e_tc_flow {
78}; 78};
79 79
80struct mlx5e_tc_flow_parse_attr { 80struct mlx5e_tc_flow_parse_attr {
81 struct ip_tunnel_info tun_info;
81 struct mlx5_flow_spec spec; 82 struct mlx5_flow_spec spec;
82 int num_mod_hdr_actions; 83 int num_mod_hdr_actions;
83 void *mod_hdr_actions; 84 void *mod_hdr_actions;
85 int mirred_ifindex;
84}; 86};
85 87
86enum { 88enum {
@@ -322,6 +324,12 @@ static void mlx5e_tc_del_nic_flow(struct mlx5e_priv *priv,
322static void mlx5e_detach_encap(struct mlx5e_priv *priv, 324static void mlx5e_detach_encap(struct mlx5e_priv *priv,
323 struct mlx5e_tc_flow *flow); 325 struct mlx5e_tc_flow *flow);
324 326
327static int mlx5e_attach_encap(struct mlx5e_priv *priv,
328 struct ip_tunnel_info *tun_info,
329 struct net_device *mirred_dev,
330 struct net_device **encap_dev,
331 struct mlx5e_tc_flow *flow);
332
325static struct mlx5_flow_handle * 333static struct mlx5_flow_handle *
326mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv, 334mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
327 struct mlx5e_tc_flow_parse_attr *parse_attr, 335 struct mlx5e_tc_flow_parse_attr *parse_attr,
@@ -329,9 +337,27 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
329{ 337{
330 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch; 338 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
331 struct mlx5_esw_flow_attr *attr = flow->esw_attr; 339 struct mlx5_esw_flow_attr *attr = flow->esw_attr;
332 struct mlx5_flow_handle *rule; 340 struct net_device *out_dev, *encap_dev = NULL;
341 struct mlx5_flow_handle *rule = NULL;
342 struct mlx5e_rep_priv *rpriv;
343 struct mlx5e_priv *out_priv;
333 int err; 344 int err;
334 345
346 if (attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP) {
347 out_dev = __dev_get_by_index(dev_net(priv->netdev),
348 attr->parse_attr->mirred_ifindex);
349 err = mlx5e_attach_encap(priv, &parse_attr->tun_info,
350 out_dev, &encap_dev, flow);
351 if (err) {
352 rule = ERR_PTR(err);
353 if (err != -EAGAIN)
354 goto err_attach_encap;
355 }
356 out_priv = netdev_priv(encap_dev);
357 rpriv = out_priv->ppriv;
358 attr->out_rep = rpriv->rep;
359 }
360
335 err = mlx5_eswitch_add_vlan_action(esw, attr); 361 err = mlx5_eswitch_add_vlan_action(esw, attr);
336 if (err) { 362 if (err) {
337 rule = ERR_PTR(err); 363 rule = ERR_PTR(err);
@@ -347,10 +373,14 @@ mlx5e_tc_add_fdb_flow(struct mlx5e_priv *priv,
347 } 373 }
348 } 374 }
349 375
350 rule = mlx5_eswitch_add_offloaded_rule(esw, &parse_attr->spec, attr); 376 /* we get here if (1) there's no error (rule being null) or when
351 if (IS_ERR(rule)) 377 * (2) there's an encap action and we're on -EAGAIN (no valid neigh)
352 goto err_add_rule; 378 */
353 379 if (rule != ERR_PTR(-EAGAIN)) {
380 rule = mlx5_eswitch_add_offloaded_rule(esw, &parse_attr->spec, attr);
381 if (IS_ERR(rule))
382 goto err_add_rule;
383 }
354 return rule; 384 return rule;
355 385
356err_add_rule: 386err_add_rule:
@@ -361,6 +391,7 @@ err_mod_hdr:
361err_add_vlan: 391err_add_vlan:
362 if (attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP) 392 if (attr->action & MLX5_FLOW_CONTEXT_ACTION_ENCAP)
363 mlx5e_detach_encap(priv, flow); 393 mlx5e_detach_encap(priv, flow);
394err_attach_encap:
364 return rule; 395 return rule;
365} 396}
366 397
@@ -389,6 +420,8 @@ static void mlx5e_tc_del_fdb_flow(struct mlx5e_priv *priv,
389void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv, 420void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,
390 struct mlx5e_encap_entry *e) 421 struct mlx5e_encap_entry *e)
391{ 422{
423 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
424 struct mlx5_esw_flow_attr *esw_attr;
392 struct mlx5e_tc_flow *flow; 425 struct mlx5e_tc_flow *flow;
393 int err; 426 int err;
394 427
@@ -404,10 +437,9 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,
404 mlx5e_rep_queue_neigh_stats_work(priv); 437 mlx5e_rep_queue_neigh_stats_work(priv);
405 438
406 list_for_each_entry(flow, &e->flows, encap) { 439 list_for_each_entry(flow, &e->flows, encap) {
407 flow->esw_attr->encap_id = e->encap_id; 440 esw_attr = flow->esw_attr;
408 flow->rule = mlx5e_tc_add_fdb_flow(priv, 441 esw_attr->encap_id = e->encap_id;
409 flow->esw_attr->parse_attr, 442 flow->rule = mlx5_eswitch_add_offloaded_rule(esw, &esw_attr->parse_attr->spec, esw_attr);
410 flow);
411 if (IS_ERR(flow->rule)) { 443 if (IS_ERR(flow->rule)) {
412 err = PTR_ERR(flow->rule); 444 err = PTR_ERR(flow->rule);
413 mlx5_core_warn(priv->mdev, "Failed to update cached encapsulation flow, %d\n", 445 mlx5_core_warn(priv->mdev, "Failed to update cached encapsulation flow, %d\n",
@@ -421,15 +453,13 @@ void mlx5e_tc_encap_flows_add(struct mlx5e_priv *priv,
421void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv, 453void mlx5e_tc_encap_flows_del(struct mlx5e_priv *priv,
422 struct mlx5e_encap_entry *e) 454 struct mlx5e_encap_entry *e)
423{ 455{
456 struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
424 struct mlx5e_tc_flow *flow; 457 struct mlx5e_tc_flow *flow;
425 struct mlx5_fc *counter;
426 458
427 list_for_each_entry(flow, &e->flows, encap) { 459 list_for_each_entry(flow, &e->flows, encap) {
428 if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) { 460 if (flow->flags & MLX5E_TC_FLOW_OFFLOADED) {
429 flow->flags &= ~MLX5E_TC_FLOW_OFFLOADED; 461 flow->flags &= ~MLX5E_TC_FLOW_OFFLOADED;
430 counter = mlx5_flow_rule_counter(flow->rule); 462 mlx5_eswitch_del_offloaded_rule(esw, flow->rule, flow->esw_attr);
431 mlx5_del_flow_rules(flow->rule);
432 mlx5_fc_destroy(priv->mdev, counter);
433 } 463 }
434 } 464 }
435 465
@@ -1942,7 +1972,7 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
1942 1972
1943 if (is_tcf_mirred_egress_redirect(a)) { 1973 if (is_tcf_mirred_egress_redirect(a)) {
1944 int ifindex = tcf_mirred_ifindex(a); 1974 int ifindex = tcf_mirred_ifindex(a);
1945 struct net_device *out_dev, *encap_dev = NULL; 1975 struct net_device *out_dev;
1946 struct mlx5e_priv *out_priv; 1976 struct mlx5e_priv *out_priv;
1947 1977
1948 out_dev = __dev_get_by_index(dev_net(priv->netdev), ifindex); 1978 out_dev = __dev_get_by_index(dev_net(priv->netdev), ifindex);
@@ -1955,17 +1985,13 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
1955 rpriv = out_priv->ppriv; 1985 rpriv = out_priv->ppriv;
1956 attr->out_rep = rpriv->rep; 1986 attr->out_rep = rpriv->rep;
1957 } else if (encap) { 1987 } else if (encap) {
1958 err = mlx5e_attach_encap(priv, info, 1988 parse_attr->mirred_ifindex = ifindex;
1959 out_dev, &encap_dev, flow); 1989 parse_attr->tun_info = *info;
1960 if (err && err != -EAGAIN) 1990 attr->parse_attr = parse_attr;
1961 return err;
1962 attr->action |= MLX5_FLOW_CONTEXT_ACTION_ENCAP | 1991 attr->action |= MLX5_FLOW_CONTEXT_ACTION_ENCAP |
1963 MLX5_FLOW_CONTEXT_ACTION_FWD_DEST | 1992 MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
1964 MLX5_FLOW_CONTEXT_ACTION_COUNT; 1993 MLX5_FLOW_CONTEXT_ACTION_COUNT;
1965 out_priv = netdev_priv(encap_dev); 1994 /* attr->out_rep is resolved when we handle encap */
1966 rpriv = out_priv->ppriv;
1967 attr->out_rep = rpriv->rep;
1968 attr->parse_attr = parse_attr;
1969 } else { 1995 } else {
1970 pr_err("devices %s %s not on same switch HW, can't offload forwarding\n", 1996 pr_err("devices %s %s not on same switch HW, can't offload forwarding\n",
1971 priv->netdev->name, out_dev->name); 1997 priv->netdev->name, out_dev->name);
@@ -2047,7 +2073,7 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv,
2047 if (flow->flags & MLX5E_TC_FLOW_ESWITCH) { 2073 if (flow->flags & MLX5E_TC_FLOW_ESWITCH) {
2048 err = parse_tc_fdb_actions(priv, f->exts, parse_attr, flow); 2074 err = parse_tc_fdb_actions(priv, f->exts, parse_attr, flow);
2049 if (err < 0) 2075 if (err < 0)
2050 goto err_handle_encap_flow; 2076 goto err_free;
2051 flow->rule = mlx5e_tc_add_fdb_flow(priv, parse_attr, flow); 2077 flow->rule = mlx5e_tc_add_fdb_flow(priv, parse_attr, flow);
2052 } else { 2078 } else {
2053 err = parse_tc_nic_actions(priv, f->exts, parse_attr, flow); 2079 err = parse_tc_nic_actions(priv, f->exts, parse_attr, flow);
@@ -2058,10 +2084,13 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv,
2058 2084
2059 if (IS_ERR(flow->rule)) { 2085 if (IS_ERR(flow->rule)) {
2060 err = PTR_ERR(flow->rule); 2086 err = PTR_ERR(flow->rule);
2061 goto err_free; 2087 if (err != -EAGAIN)
2088 goto err_free;
2062 } 2089 }
2063 2090
2064 flow->flags |= MLX5E_TC_FLOW_OFFLOADED; 2091 if (err != -EAGAIN)
2092 flow->flags |= MLX5E_TC_FLOW_OFFLOADED;
2093
2065 err = rhashtable_insert_fast(&tc->ht, &flow->node, 2094 err = rhashtable_insert_fast(&tc->ht, &flow->node,
2066 tc->ht_params); 2095 tc->ht_params);
2067 if (err) 2096 if (err)
@@ -2075,16 +2104,6 @@ int mlx5e_configure_flower(struct mlx5e_priv *priv,
2075err_del_rule: 2104err_del_rule:
2076 mlx5e_tc_del_flow(priv, flow); 2105 mlx5e_tc_del_flow(priv, flow);
2077 2106
2078err_handle_encap_flow:
2079 if (err == -EAGAIN) {
2080 err = rhashtable_insert_fast(&tc->ht, &flow->node,
2081 tc->ht_params);
2082 if (err)
2083 mlx5e_tc_del_flow(priv, flow);
2084 else
2085 return 0;
2086 }
2087
2088err_free: 2107err_free:
2089 kvfree(parse_attr); 2108 kvfree(parse_attr);
2090 kfree(flow); 2109 kfree(flow);
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/health.c b/drivers/net/ethernet/mellanox/mlx5/core/health.c
index 8aea0a065e56..db86e1506c8b 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/health.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/health.c
@@ -356,10 +356,11 @@ void mlx5_drain_health_wq(struct mlx5_core_dev *dev)
356void mlx5_drain_health_recovery(struct mlx5_core_dev *dev) 356void mlx5_drain_health_recovery(struct mlx5_core_dev *dev)
357{ 357{
358 struct mlx5_core_health *health = &dev->priv.health; 358 struct mlx5_core_health *health = &dev->priv.health;
359 unsigned long flags;
359 360
360 spin_lock(&health->wq_lock); 361 spin_lock_irqsave(&health->wq_lock, flags);
361 set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags); 362 set_bit(MLX5_DROP_NEW_RECOVERY_WORK, &health->flags);
362 spin_unlock(&health->wq_lock); 363 spin_unlock_irqrestore(&health->wq_lock, flags);
363 cancel_delayed_work_sync(&dev->priv.health.recover_work); 364 cancel_delayed_work_sync(&dev->priv.health.recover_work);
364} 365}
365 366
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/port.c b/drivers/net/ethernet/mellanox/mlx5/core/port.c
index 1975d4388d4f..e07061f565d6 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/port.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/port.c
@@ -677,6 +677,27 @@ int mlx5_set_port_tc_group(struct mlx5_core_dev *mdev, u8 *tc_group)
677} 677}
678EXPORT_SYMBOL_GPL(mlx5_set_port_tc_group); 678EXPORT_SYMBOL_GPL(mlx5_set_port_tc_group);
679 679
680int mlx5_query_port_tc_group(struct mlx5_core_dev *mdev,
681 u8 tc, u8 *tc_group)
682{
683 u32 out[MLX5_ST_SZ_DW(qetc_reg)];
684 void *ets_tcn_conf;
685 int err;
686
687 err = mlx5_query_port_qetcr_reg(mdev, out, sizeof(out));
688 if (err)
689 return err;
690
691 ets_tcn_conf = MLX5_ADDR_OF(qetc_reg, out,
692 tc_configuration[tc]);
693
694 *tc_group = MLX5_GET(ets_tcn_config_reg, ets_tcn_conf,
695 group);
696
697 return 0;
698}
699EXPORT_SYMBOL_GPL(mlx5_query_port_tc_group);
700
680int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *tc_bw) 701int mlx5_set_port_tc_bw_alloc(struct mlx5_core_dev *mdev, u8 *tc_bw)
681{ 702{
682 u32 in[MLX5_ST_SZ_DW(qetc_reg)] = {0}; 703 u32 in[MLX5_ST_SZ_DW(qetc_reg)] = {0};
diff --git a/drivers/net/ethernet/netronome/nfp/flower/action.c b/drivers/net/ethernet/netronome/nfp/flower/action.c
index db9750695dc7..8ea9320014ee 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/action.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/action.c
@@ -110,6 +110,8 @@ nfp_fl_output(struct nfp_fl_output *output, const struct tc_action *action,
110 */ 110 */
111 if (!switchdev_port_same_parent_id(in_dev, out_dev)) 111 if (!switchdev_port_same_parent_id(in_dev, out_dev))
112 return -EOPNOTSUPP; 112 return -EOPNOTSUPP;
113 if (!nfp_netdev_is_nfp_repr(out_dev))
114 return -EOPNOTSUPP;
113 115
114 output->port = cpu_to_be32(nfp_repr_get_port_id(out_dev)); 116 output->port = cpu_to_be32(nfp_repr_get_port_id(out_dev));
115 if (!output->port) 117 if (!output->port)
diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
index 5efef8001edf..3256e5cbad27 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-dwc-qos-eth.c
@@ -74,7 +74,7 @@ static int dwc_eth_dwmac_config_dt(struct platform_device *pdev,
74 plat_dat->axi->axi_wr_osr_lmt--; 74 plat_dat->axi->axi_wr_osr_lmt--;
75 } 75 }
76 76
77 if (of_property_read_u32(np, "read,read-requests", 77 if (of_property_read_u32(np, "snps,read-requests",
78 &plat_dat->axi->axi_rd_osr_lmt)) { 78 &plat_dat->axi->axi_rd_osr_lmt)) {
79 /** 79 /**
80 * Since the register has a reset value of 1, if property 80 * Since the register has a reset value of 1, if property
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
index 8a280b48e3a9..6383695004a5 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c
@@ -150,6 +150,13 @@ static void stmmac_mtl_setup(struct platform_device *pdev,
150 plat->rx_queues_to_use = 1; 150 plat->rx_queues_to_use = 1;
151 plat->tx_queues_to_use = 1; 151 plat->tx_queues_to_use = 1;
152 152
153 /* First Queue must always be in DCB mode. As MTL_QUEUE_DCB = 1 we need
154 * to always set this, otherwise Queue will be classified as AVB
155 * (because MTL_QUEUE_AVB = 0).
156 */
157 plat->rx_queues_cfg[0].mode_to_use = MTL_QUEUE_DCB;
158 plat->tx_queues_cfg[0].mode_to_use = MTL_QUEUE_DCB;
159
153 rx_node = of_parse_phandle(pdev->dev.of_node, "snps,mtl-rx-config", 0); 160 rx_node = of_parse_phandle(pdev->dev.of_node, "snps,mtl-rx-config", 0);
154 if (!rx_node) 161 if (!rx_node)
155 return; 162 return;
diff --git a/drivers/net/ipvlan/ipvtap.c b/drivers/net/ipvlan/ipvtap.c
index 5dea2063dbc8..0bcc07f346c3 100644
--- a/drivers/net/ipvlan/ipvtap.c
+++ b/drivers/net/ipvlan/ipvtap.c
@@ -197,8 +197,8 @@ static int ipvtap_init(void)
197{ 197{
198 int err; 198 int err;
199 199
200 err = tap_create_cdev(&ipvtap_cdev, &ipvtap_major, "ipvtap"); 200 err = tap_create_cdev(&ipvtap_cdev, &ipvtap_major, "ipvtap",
201 201 THIS_MODULE);
202 if (err) 202 if (err)
203 goto out1; 203 goto out1;
204 204
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index c2d0ea2fb019..cba5cb3b849a 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -204,8 +204,8 @@ static int macvtap_init(void)
204{ 204{
205 int err; 205 int err;
206 206
207 err = tap_create_cdev(&macvtap_cdev, &macvtap_major, "macvtap"); 207 err = tap_create_cdev(&macvtap_cdev, &macvtap_major, "macvtap",
208 208 THIS_MODULE);
209 if (err) 209 if (err)
210 goto out1; 210 goto out1;
211 211
diff --git a/drivers/net/tap.c b/drivers/net/tap.c
index 21b71ae947fd..1b10fcc6a58d 100644
--- a/drivers/net/tap.c
+++ b/drivers/net/tap.c
@@ -517,6 +517,10 @@ static int tap_open(struct inode *inode, struct file *file)
517 &tap_proto, 0); 517 &tap_proto, 0);
518 if (!q) 518 if (!q)
519 goto err; 519 goto err;
520 if (skb_array_init(&q->skb_array, tap->dev->tx_queue_len, GFP_KERNEL)) {
521 sk_free(&q->sk);
522 goto err;
523 }
520 524
521 RCU_INIT_POINTER(q->sock.wq, &q->wq); 525 RCU_INIT_POINTER(q->sock.wq, &q->wq);
522 init_waitqueue_head(&q->wq.wait); 526 init_waitqueue_head(&q->wq.wait);
@@ -540,22 +544,18 @@ static int tap_open(struct inode *inode, struct file *file)
540 if ((tap->dev->features & NETIF_F_HIGHDMA) && (tap->dev->features & NETIF_F_SG)) 544 if ((tap->dev->features & NETIF_F_HIGHDMA) && (tap->dev->features & NETIF_F_SG))
541 sock_set_flag(&q->sk, SOCK_ZEROCOPY); 545 sock_set_flag(&q->sk, SOCK_ZEROCOPY);
542 546
543 err = -ENOMEM;
544 if (skb_array_init(&q->skb_array, tap->dev->tx_queue_len, GFP_KERNEL))
545 goto err_array;
546
547 err = tap_set_queue(tap, file, q); 547 err = tap_set_queue(tap, file, q);
548 if (err) 548 if (err) {
549 goto err_queue; 549 /* tap_sock_destruct() will take care of freeing skb_array */
550 goto err_put;
551 }
550 552
551 dev_put(tap->dev); 553 dev_put(tap->dev);
552 554
553 rtnl_unlock(); 555 rtnl_unlock();
554 return err; 556 return err;
555 557
556err_queue: 558err_put:
557 skb_array_cleanup(&q->skb_array);
558err_array:
559 sock_put(&q->sk); 559 sock_put(&q->sk);
560err: 560err:
561 if (tap) 561 if (tap)
@@ -1249,8 +1249,8 @@ static int tap_list_add(dev_t major, const char *device_name)
1249 return 0; 1249 return 0;
1250} 1250}
1251 1251
1252int tap_create_cdev(struct cdev *tap_cdev, 1252int tap_create_cdev(struct cdev *tap_cdev, dev_t *tap_major,
1253 dev_t *tap_major, const char *device_name) 1253 const char *device_name, struct module *module)
1254{ 1254{
1255 int err; 1255 int err;
1256 1256
@@ -1259,6 +1259,7 @@ int tap_create_cdev(struct cdev *tap_cdev,
1259 goto out1; 1259 goto out1;
1260 1260
1261 cdev_init(tap_cdev, &tap_fops); 1261 cdev_init(tap_cdev, &tap_fops);
1262 tap_cdev->owner = module;
1262 err = cdev_add(tap_cdev, *tap_major, TAP_NUM_DEVS); 1263 err = cdev_add(tap_cdev, *tap_major, TAP_NUM_DEVS);
1263 if (err) 1264 if (err)
1264 goto out2; 1265 goto out2;
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
index e21bf90b819f..5550f56cb895 100644
--- a/drivers/net/tun.c
+++ b/drivers/net/tun.c
@@ -1286,6 +1286,7 @@ static struct sk_buff *tun_build_skb(struct tun_struct *tun,
1286 buflen += SKB_DATA_ALIGN(len + pad); 1286 buflen += SKB_DATA_ALIGN(len + pad);
1287 rcu_read_unlock(); 1287 rcu_read_unlock();
1288 1288
1289 alloc_frag->offset = ALIGN((u64)alloc_frag->offset, SMP_CACHE_BYTES);
1289 if (unlikely(!skb_page_frag_refill(buflen, alloc_frag, GFP_KERNEL))) 1290 if (unlikely(!skb_page_frag_refill(buflen, alloc_frag, GFP_KERNEL)))
1290 return ERR_PTR(-ENOMEM); 1291 return ERR_PTR(-ENOMEM);
1291 1292
@@ -2028,7 +2029,7 @@ static int tun_set_iff(struct net *net, struct file *file, struct ifreq *ifr)
2028 if (!dev) 2029 if (!dev)
2029 return -ENOMEM; 2030 return -ENOMEM;
2030 err = dev_get_valid_name(net, dev, name); 2031 err = dev_get_valid_name(net, dev, name);
2031 if (err) 2032 if (err < 0)
2032 goto err_free_dev; 2033 goto err_free_dev;
2033 2034
2034 dev_net_set(dev, net); 2035 dev_net_set(dev, net);
diff --git a/drivers/net/usb/cdc_ether.c b/drivers/net/usb/cdc_ether.c
index 52ea80bcd639..3e7a3ac3a362 100644
--- a/drivers/net/usb/cdc_ether.c
+++ b/drivers/net/usb/cdc_ether.c
@@ -561,6 +561,7 @@ static const struct driver_info wwan_info = {
561#define HP_VENDOR_ID 0x03f0 561#define HP_VENDOR_ID 0x03f0
562#define MICROSOFT_VENDOR_ID 0x045e 562#define MICROSOFT_VENDOR_ID 0x045e
563#define UBLOX_VENDOR_ID 0x1546 563#define UBLOX_VENDOR_ID 0x1546
564#define TPLINK_VENDOR_ID 0x2357
564 565
565static const struct usb_device_id products[] = { 566static const struct usb_device_id products[] = {
566/* BLACKLIST !! 567/* BLACKLIST !!
@@ -813,6 +814,13 @@ static const struct usb_device_id products[] = {
813 .driver_info = 0, 814 .driver_info = 0,
814}, 815},
815 816
817 /* TP-LINK UE300 USB 3.0 Ethernet Adapters (based on Realtek RTL8153) */
818{
819 USB_DEVICE_AND_INTERFACE_INFO(TPLINK_VENDOR_ID, 0x0601, USB_CLASS_COMM,
820 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
821 .driver_info = 0,
822},
823
816/* WHITELIST!!! 824/* WHITELIST!!!
817 * 825 *
818 * CDC Ether uses two interfaces, not necessarily consecutive. 826 * CDC Ether uses two interfaces, not necessarily consecutive.
@@ -864,6 +872,12 @@ static const struct usb_device_id products[] = {
864 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE), 872 USB_CDC_SUBCLASS_ETHERNET, USB_CDC_PROTO_NONE),
865 .driver_info = (kernel_ulong_t)&wwan_info, 873 .driver_info = (kernel_ulong_t)&wwan_info,
866}, { 874}, {
875 /* Huawei ME906 and ME909 */
876 USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x15c1, USB_CLASS_COMM,
877 USB_CDC_SUBCLASS_ETHERNET,
878 USB_CDC_PROTO_NONE),
879 .driver_info = (unsigned long)&wwan_info,
880}, {
867 /* ZTE modules */ 881 /* ZTE modules */
868 USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, USB_CLASS_COMM, 882 USB_VENDOR_AND_INTERFACE_INFO(ZTE_VENDOR_ID, USB_CLASS_COMM,
869 USB_CDC_SUBCLASS_ETHERNET, 883 USB_CDC_SUBCLASS_ETHERNET,
diff --git a/drivers/net/usb/r8152.c b/drivers/net/usb/r8152.c
index 941ece08ba78..d51d9abf7986 100644
--- a/drivers/net/usb/r8152.c
+++ b/drivers/net/usb/r8152.c
@@ -615,6 +615,7 @@ enum rtl8152_flags {
615#define VENDOR_ID_LENOVO 0x17ef 615#define VENDOR_ID_LENOVO 0x17ef
616#define VENDOR_ID_LINKSYS 0x13b1 616#define VENDOR_ID_LINKSYS 0x13b1
617#define VENDOR_ID_NVIDIA 0x0955 617#define VENDOR_ID_NVIDIA 0x0955
618#define VENDOR_ID_TPLINK 0x2357
618 619
619#define MCU_TYPE_PLA 0x0100 620#define MCU_TYPE_PLA 0x0100
620#define MCU_TYPE_USB 0x0000 621#define MCU_TYPE_USB 0x0000
@@ -5319,6 +5320,7 @@ static const struct usb_device_id rtl8152_table[] = {
5319 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214)}, 5320 {REALTEK_USB_DEVICE(VENDOR_ID_LENOVO, 0x7214)},
5320 {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)}, 5321 {REALTEK_USB_DEVICE(VENDOR_ID_LINKSYS, 0x0041)},
5321 {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)}, 5322 {REALTEK_USB_DEVICE(VENDOR_ID_NVIDIA, 0x09ff)},
5323 {REALTEK_USB_DEVICE(VENDOR_ID_TPLINK, 0x0601)},
5322 {} 5324 {}
5323}; 5325};
5324 5326