History

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

Pull networking fixes from David Miller: "One last pull request before heading to Vancouver for LPC, here we have: 1) Don't forget to free VSI contexts during ice driver unload, from Victor Raj. 2) Don't forget napi delete calls during device remove in ice driver, from Dave Ertman. 3) Don't request VLAN tag insertion of ibmvnic device when SKB doesn't have VLAN tags at all. 4) IPV4 frag handling code has to accomodate the situation where two threads try to insert the same fragment into the hash table at the same time. From Eric Dumazet. 5) Relatedly, don't flow separate on protocol ports for fragmented frames, also from Eric Dumazet. 6) Memory leaks in qed driver, from Denis Bolotin. 7) Correct valid MTU range in smsc95xx driver, from Stefan Wahren. 8) Validate cls_flower nested policies properly, from Jakub Kicinski. 9) Clearing of stats counters in mc88e6xxx driver doesn't retain important bits in the G1_STATS_OP register causing the chip to hang. Fix from Andrew Lunn" * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (41 commits) act_mirred: clear skb->tstamp on redirect net: dsa: mv88e6xxx: Fix clearing of stats counters tipc: fix link re-establish failure net: sched: cls_flower: validate nested enc_opts_policy to avoid warning net: mvneta: correct typo flow_dissector: do not dissect l4 ports for fragments net: qualcomm: rmnet: Fix incorrect assignment of real_dev net: aquantia: allow rx checksum offload configuration net: aquantia: invalid checksumm offload implementation net: aquantia: fixed enable unicast on 32 macvlan net: aquantia: fix potential IOMMU fault after driver unbind net: aquantia: synchronized flow control between mac/phy net: smsc95xx: Fix MTU range net: stmmac: Fix RX packet size > 8191 qed: Fix potential memory corruption qed: Fix SPQ entries not returned to pool in error flows qed: Fix blocking/unlimited SPQ entries leak qed: Fix memory/entry leak in qed_init_sp_request() inet: frags: better deal with smp races net: hns3: bugfix for not checking return value ...

Linus Torvalds committed 8 years ago

Commit 7a3765e2 parents e12e00e 7236ead54 files · +430 −199Browse files

Unified · Split

54 files
  1. drivers/net/dsa/mv88e6xxx/global1.c +2 −0
  2. drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c +4 −4
  3. drivers/net/ethernet/aquantia/atlantic/aq_hw.h +6 −0
  4. drivers/net/ethernet/aquantia/atlantic/aq_main.c +8 −2
  5. drivers/net/ethernet/aquantia/atlantic/aq_nic.c +15 −3
  6. drivers/net/ethernet/aquantia/atlantic/aq_nic.h +1 −1
  7. drivers/net/ethernet/aquantia/atlantic/aq_ring.c +23 −12
  8. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c +38 −23
  9. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c +8 −0
  10. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h +3 −0
  11. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h +18 −0
  12. drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c +21 −0
  13. drivers/net/ethernet/hisilicon/hns3/hns3_enet.c +2 −1
  14. drivers/net/ethernet/ibm/ibmvnic.c +1 −1
  15. drivers/net/ethernet/intel/i40e/i40e_main.c +5 −3
  16. drivers/net/ethernet/intel/ice/ice.h +3 −1
  17. drivers/net/ethernet/intel/ice/ice_common.c +3 −0
  18. drivers/net/ethernet/intel/ice/ice_ethtool.c +6 −1
  19. drivers/net/ethernet/intel/ice/ice_hw_autogen.h +2 −0
  20. drivers/net/ethernet/intel/ice/ice_lib.c +2 −1
  21. drivers/net/ethernet/intel/ice/ice_main.c +48 −38
  22. drivers/net/ethernet/intel/ice/ice_switch.c +12 −0
  23. drivers/net/ethernet/intel/ice/ice_switch.h +2 −0
  24. drivers/net/ethernet/intel/ice/ice_txrx.c +6 −5
  25. drivers/net/ethernet/intel/ice/ice_txrx.h +15 −2
  26. drivers/net/ethernet/intel/ice/ice_type.h +1 −1
  27. drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c +1 −3
  28. drivers/net/ethernet/intel/igb/igb_ptp.c +7 −5
  29. drivers/net/ethernet/marvell/mvneta.c +2 −2
  30. drivers/net/ethernet/qlogic/qed/qed_fcoe.c +8 −3
  31. drivers/net/ethernet/qlogic/qed/qed_iscsi.c +1 −0
  32. drivers/net/ethernet/qlogic/qed/qed_l2.c +8 −4
  33. drivers/net/ethernet/qlogic/qed/qed_rdma.c +1 −0
  34. drivers/net/ethernet/qlogic/qed/qed_roce.c +1 −0
  35. drivers/net/ethernet/qlogic/qed/qed_sp.h +14 −0
  36. drivers/net/ethernet/qlogic/qed/qed_sp_commands.c +20 −2
  37. drivers/net/ethernet/qlogic/qed/qed_spq.c +35 −34
  38. drivers/net/ethernet/qlogic/qed/qed_sriov.c +1 −0
  39. drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c +5 −3
  40. drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c +3 −3
  41. drivers/net/ethernet/stmicro/stmmac/common.h +2 −1
  42. drivers/net/ethernet/stmicro/stmmac/descs_com.h +1 −1
  43. drivers/net/ethernet/stmicro/stmmac/enh_desc.c +1 −1
  44. drivers/net/ethernet/stmicro/stmmac/ring_mode.c +1 −1
  45. drivers/net/fddi/defza.c +4 −3
  46. drivers/net/fddi/defza.h +2 −1
  47. drivers/net/phy/broadcom.c +16 −2
  48. drivers/net/usb/smsc95xx.c +2 −0
  49. net/core/flow_dissector.c +2 −2
  50. net/ipv4/inet_fragment.c +15 −14
  51. net/sched/act_mirred.c +2 −1
  52. net/sched/cls_flower.c +13 −1
  53. net/sched/sch_netem.c +0 −9
  54. net/tipc/link.c +7 −4
drivers/net/dsa/mv88e6xxx/global1.c+2−0
@@ -567,6 +567,8 @@ int mv88e6xxx_g1_stats_clear(struct mv88e6xxx_chip *chip) · 566 unmodified lines
567567 if (err)
568568 return err;
569569
570+ /* Keep the histogram mode bits */
571+ val &= MV88E6XXX_G1_STATS_OP_HIST_RX_TX;
570572 val |= MV88E6XXX_G1_STATS_OP_BUSY | MV88E6XXX_G1_STATS_OP_FLUSH_ALL;
571573
572574 err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_STATS_OP, val);
drivers/net/ethernet/aquantia/atlantic/aq_ethtool.c+4−4
@@ -407,13 +407,13 @@ static void aq_ethtool_get_pauseparam(struct net_device *ndev, · 406 unmodified lines
407407 struct ethtool_pauseparam *pause)
408408 {
409409 struct aq_nic_s *aq_nic = netdev_priv(ndev);
410+ u32 fc = aq_nic->aq_nic_cfg.flow_control;
410411
411412 pause->autoneg = 0;
412413
413− if (aq_nic->aq_hw->aq_nic_cfg->flow_control & AQ_NIC_FC_RX)
414− pause->rx_pause = 1;
415− if (aq_nic->aq_hw->aq_nic_cfg->flow_control & AQ_NIC_FC_TX)
416− pause->tx_pause = 1;
414+ pause->rx_pause = !!(fc & AQ_NIC_FC_RX);
415+ pause->tx_pause = !!(fc & AQ_NIC_FC_TX);
416+
417417 }
418418
419419 static int aq_ethtool_set_pauseparam(struct net_device *ndev,
drivers/net/ethernet/aquantia/atlantic/aq_hw.h+6−0
@@ -204,6 +204,10 @@ struct aq_hw_ops { · 203 unmodified lines
204204
205205 int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version);
206206
207+ int (*hw_set_offload)(struct aq_hw_s *self,
208+ struct aq_nic_cfg_s *aq_nic_cfg);
209+
210+ int (*hw_set_fc)(struct aq_hw_s *self, u32 fc, u32 tc);
207211 };
208212
209213 struct aq_fw_ops {
@@ -226,6 +230,8 @@ struct aq_fw_ops { · 16 unmodified lines
226230
227231 int (*update_stats)(struct aq_hw_s *self);
228232
233+ u32 (*get_flow_control)(struct aq_hw_s *self, u32 *fcmode);
234+
229235 int (*set_flow_control)(struct aq_hw_s *self);
230236
231237 int (*set_power)(struct aq_hw_s *self, unsigned int power_state,
drivers/net/ethernet/aquantia/atlantic/aq_main.c+8−2
@@ -99,8 +99,11 @@ static int aq_ndev_set_features(struct net_device *ndev, · 98 unmodified lines
9999 struct aq_nic_s *aq_nic = netdev_priv(ndev);
100100 struct aq_nic_cfg_s *aq_cfg = aq_nic_get_cfg(aq_nic);
101101 bool is_lro = false;
102+ int err = 0;
103+
104+ aq_cfg->features = features;
102105
103− if (aq_cfg->hw_features & NETIF_F_LRO) {
106+ if (aq_cfg->aq_hw_caps->hw_features & NETIF_F_LRO) {
104107 is_lro = features & NETIF_F_LRO;
105108
106109 if (aq_cfg->is_lro != is_lro) {
@@ -112,8 +115,11 @@ static int aq_ndev_set_features(struct net_device *ndev, · 5 unmodified lines
112115 }
113116 }
114117 }
118+ if ((aq_nic->ndev->features ^ features) & NETIF_F_RXCSUM)
119+ err = aq_nic->aq_hw_ops->hw_set_offload(aq_nic->aq_hw,
120+ aq_cfg);
115121
116− return 0;
122+ return err;
117123 }
118124
119125 static int aq_ndev_set_mac_address(struct net_device *ndev, void *addr)
drivers/net/ethernet/aquantia/atlantic/aq_nic.c+15−3
@@ -118,12 +118,13 @@ void aq_nic_cfg_start(struct aq_nic_s *self) · 117 unmodified lines
118118 }
119119
120120 cfg->link_speed_msk &= cfg->aq_hw_caps->link_speed_msk;
121− cfg->hw_features = cfg->aq_hw_caps->hw_features;
121+ cfg->features = cfg->aq_hw_caps->hw_features;
122122 }
123123
124124 static int aq_nic_update_link_status(struct aq_nic_s *self)
125125 {
126126 int err = self->aq_fw_ops->update_link_status(self->aq_hw);
127+ u32 fc = 0;
127128
128129 if (err)
129130 return err;
@@ -133,6 +134,15 @@ static int aq_nic_update_link_status(struct aq_nic_s *self) · 3 unmodified lines
133134 AQ_CFG_DRV_NAME, self->link_status.mbps,
134135 self->aq_hw->aq_link_status.mbps);
135136 aq_nic_update_interrupt_moderation_settings(self);
137+
138+ /* Driver has to update flow control settings on RX block
139+ * on any link event.
140+ * We should query FW whether it negotiated FC.
141+ */
142+ if (self->aq_fw_ops->get_flow_control)
143+ self->aq_fw_ops->get_flow_control(self->aq_hw, &fc);
144+ if (self->aq_hw_ops->hw_set_fc)
145+ self->aq_hw_ops->hw_set_fc(self->aq_hw, fc, 0);
136146 }
137147
138148 self->link_status = self->aq_hw->aq_link_status;
@@ -590,7 +600,7 @@ int aq_nic_set_multicast_list(struct aq_nic_s *self, struct net_device *ndev) · 451 unmodified lines
590600 }
591601 }
592602
593− if (i > 0 && i < AQ_HW_MULTICAST_ADDRESS_MAX) {
603+ if (i > 0 && i <= AQ_HW_MULTICAST_ADDRESS_MAX) {
594604 packet_filter |= IFF_MULTICAST;
595605 self->mc_list.count = i;
596606 self->aq_hw_ops->hw_multicast_list_set(self->aq_hw,
@@ -772,7 +782,9 @@ void aq_nic_get_link_ksettings(struct aq_nic_s *self, · 175 unmodified lines
772782 ethtool_link_ksettings_add_link_mode(cmd, advertising,
773783 Pause);
774784
775− if (self->aq_nic_cfg.flow_control & AQ_NIC_FC_TX)
785+ /* Asym is when either RX or TX, but not both */
786+ if (!!(self->aq_nic_cfg.flow_control & AQ_NIC_FC_TX) ^
787+ !!(self->aq_nic_cfg.flow_control & AQ_NIC_FC_RX))
776788 ethtool_link_ksettings_add_link_mode(cmd, advertising,
777789 Asym_Pause);
778790
drivers/net/ethernet/aquantia/atlantic/aq_nic.h+1−1
@@ -23,7 +23,7 @@ struct aq_vec_s; · 22 unmodified lines
2323
2424 struct aq_nic_cfg_s {
2525 const struct aq_hw_caps_s *aq_hw_caps;
26− u64 hw_features;
26+ u64 features;
2727 u32 rxds; /* rx ring size, descriptors # */
2828 u32 txds; /* tx ring size, descriptors # */
2929 u32 vecs; /* vecs==allocated irqs */
drivers/net/ethernet/aquantia/atlantic/aq_ring.c+23−12
@@ -172,6 +172,27 @@ bool aq_ring_tx_clean(struct aq_ring_s *self) · 171 unmodified lines
172172 return !!budget;
173173 }
174174
175+static void aq_rx_checksum(struct aq_ring_s *self,
176+ struct aq_ring_buff_s *buff,
177+ struct sk_buff *skb)
178+{
179+ if (!(self->aq_nic->ndev->features & NETIF_F_RXCSUM))
180+ return;
181+
182+ if (unlikely(buff->is_cso_err)) {
183+ ++self->stats.rx.errors;
184+ skb->ip_summed = CHECKSUM_NONE;
185+ return;
186+ }
187+ if (buff->is_ip_cso) {
188+ __skb_incr_checksum_unnecessary(skb);
189+ if (buff->is_udp_cso || buff->is_tcp_cso)
190+ __skb_incr_checksum_unnecessary(skb);
191+ } else {
192+ skb->ip_summed = CHECKSUM_NONE;
193+ }
194+}
195+
175196 #define AQ_SKB_ALIGN SKB_DATA_ALIGN(sizeof(struct skb_shared_info))
176197 int aq_ring_rx_clean(struct aq_ring_s *self,
177198 struct napi_struct *napi,
@@ -267,18 +288,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self, · 89 unmodified lines
267288 }
268289
269290 skb->protocol = eth_type_trans(skb, ndev);
270− if (unlikely(buff->is_cso_err)) {
271− ++self->stats.rx.errors;
272− skb->ip_summed = CHECKSUM_NONE;
273− } else {
274− if (buff->is_ip_cso) {
275− __skb_incr_checksum_unnecessary(skb);
276− if (buff->is_udp_cso || buff->is_tcp_cso)
277− __skb_incr_checksum_unnecessary(skb);
278− } else {
279− skb->ip_summed = CHECKSUM_NONE;
280− }
281− }
291+
292+ aq_rx_checksum(self, buff, skb);
282293
283294 skb_set_hash(skb, buff->rss_hash,
284295 buff->is_hash_l4 ? PKT_HASH_TYPE_L4 :
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c+38−23
@@ -100,12 +100,17 @@ static int hw_atl_b0_hw_reset(struct aq_hw_s *self) · 99 unmodified lines
100100 return err;
101101 }
102102
103+static int hw_atl_b0_set_fc(struct aq_hw_s *self, u32 fc, u32 tc)
104+{
105+ hw_atl_rpb_rx_xoff_en_per_tc_set(self, !!(fc & AQ_NIC_FC_RX), tc);
106+ return 0;
107+}
108+
103109 static int hw_atl_b0_hw_qos_set(struct aq_hw_s *self)
104110 {
105111 u32 tc = 0U;
106112 u32 buff_size = 0U;
107113 unsigned int i_priority = 0U;
108− bool is_rx_flow_control = false;
109114
110115 /* TPS Descriptor rate init */
111116 hw_atl_tps_tx_pkt_shed_desc_rate_curr_time_res_set(self, 0x0U);
@@ -138,7 +143,6 @@ static int hw_atl_b0_hw_qos_set(struct aq_hw_s *self) · 26 unmodified lines
138143
139144 /* QoS Rx buf size per TC */
140145 tc = 0;
141− is_rx_flow_control = (AQ_NIC_FC_RX & self->aq_nic_cfg->flow_control);
142146 buff_size = HW_ATL_B0_RXBUF_MAX;
143147
144148 hw_atl_rpb_rx_pkt_buff_size_per_tc_set(self, buff_size, tc);
@@ -150,7 +154,8 @@ static int hw_atl_b0_hw_qos_set(struct aq_hw_s *self) · 5 unmodified lines
150154 (buff_size *
151155 (1024U / 32U) * 50U) /
152156 100U, tc);
153− hw_atl_rpb_rx_xoff_en_per_tc_set(self, is_rx_flow_control ? 1U : 0U, tc);
157+
158+ hw_atl_b0_set_fc(self, self->aq_nic_cfg->flow_control, tc);
154159
155160 /* QoS 802.1p priority -> TC mapping */
156161 for (i_priority = 8U; i_priority--;)
@@ -229,8 +234,10 @@ static int hw_atl_b0_hw_offload_set(struct aq_hw_s *self, · 72 unmodified lines
229234 hw_atl_tpo_tcp_udp_crc_offload_en_set(self, 1);
230235
231236 /* RX checksums offloads*/
232− hw_atl_rpo_ipv4header_crc_offload_en_set(self, 1);
233− hw_atl_rpo_tcp_udp_crc_offload_en_set(self, 1);
237+ hw_atl_rpo_ipv4header_crc_offload_en_set(self, !!(aq_nic_cfg->features &
238+ NETIF_F_RXCSUM));
239+ hw_atl_rpo_tcp_udp_crc_offload_en_set(self, !!(aq_nic_cfg->features &
240+ NETIF_F_RXCSUM));
234241
235242 /* LSO offloads*/
236243 hw_atl_tdm_large_send_offload_en_set(self, 0xFFFFFFFFU);
@@ -655,9 +662,9 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self, · 418 unmodified lines
655662 struct hw_atl_rxd_wb_s *rxd_wb = (struct hw_atl_rxd_wb_s *)
656663 &ring->dx_ring[ring->hw_head * HW_ATL_B0_RXD_SIZE];
657664
658− unsigned int is_err = 1U;
659665 unsigned int is_rx_check_sum_enabled = 0U;
660666 unsigned int pkt_type = 0U;
667+ u8 rx_stat = 0U;
661668
662669 if (!(rxd_wb->status & 0x1U)) { /* RxD is not done */
663670 break;
@@ -665,35 +672,35 @@ static int hw_atl_b0_hw_ring_rx_receive(struct aq_hw_s *self, · 1 unmodified line
665672
666673 buff = &ring->buff_ring[ring->hw_head];
667674
668− is_err = (0x0000003CU & rxd_wb->status);
675+ rx_stat = (0x0000003CU & rxd_wb->status) >> 2;
669676
670677 is_rx_check_sum_enabled = (rxd_wb->type) & (0x3U << 19);
671− is_err &= ~0x20U; /* exclude validity bit */
672678
673679 pkt_type = 0xFFU & (rxd_wb->type >> 4);
674680
675− if (is_rx_check_sum_enabled) {
676− if (0x0U == (pkt_type & 0x3U))
677− buff->is_ip_cso = (is_err & 0x08U) ? 0U : 1U;
681+ if (is_rx_check_sum_enabled & BIT(0) &&
682+ (0x0U == (pkt_type & 0x3U)))
683+ buff->is_ip_cso = (rx_stat & BIT(1)) ? 0U : 1U;
678684
685+ if (is_rx_check_sum_enabled & BIT(1)) {
679686 if (0x4U == (pkt_type & 0x1CU))
680− buff->is_udp_cso = buff->is_cso_err ? 0U : 1U;
687+ buff->is_udp_cso = (rx_stat & BIT(2)) ? 0U :
688+ !!(rx_stat & BIT(3));
681689 else if (0x0U == (pkt_type & 0x1CU))
682− buff->is_tcp_cso = buff->is_cso_err ? 0U : 1U;
683−
684− /* Checksum offload workaround for small packets */
685− if (rxd_wb->pkt_len <= 60) {
686− buff->is_ip_cso = 0U;
687− buff->is_cso_err = 0U;
688− }
690+ buff->is_tcp_cso = (rx_stat & BIT(2)) ? 0U :
691+ !!(rx_stat & BIT(3));
692+ }
693+ buff->is_cso_err = !!(rx_stat & 0x6);
694+ /* Checksum offload workaround for small packets */
695+ if (unlikely(rxd_wb->pkt_len <= 60)) {
696+ buff->is_ip_cso = 0U;
697+ buff->is_cso_err = 0U;
689698 }
690−
691− is_err &= ~0x18U;
692699
693700 dma_unmap_page(ndev, buff->pa, buff->len, DMA_FROM_DEVICE);
694701
695− if (is_err || rxd_wb->type & 0x1000U) {
696− /* status error or DMA error */
702+ if ((rx_stat & BIT(0)) || rxd_wb->type & 0x1000U) {
703+ /* MAC error or DMA error */
697704 buff->is_error = 1U;
698705 } else {
699706 if (self->aq_nic_cfg->is_rss) {
@@ -915,6 +922,12 @@ static int hw_atl_b0_hw_interrupt_moderation_set(struct aq_hw_s *self) · 215 unmodified lines
915922 static int hw_atl_b0_hw_stop(struct aq_hw_s *self)
916923 {
917924 hw_atl_b0_hw_irq_disable(self, HW_ATL_B0_INT_MASK);
925+
926+ /* Invalidate Descriptor Cache to prevent writing to the cached
927+ * descriptors and to the data pointer of those descriptors
928+ */
929+ hw_atl_rdm_rx_dma_desc_cache_init_set(self, 1);
930+
918931 return aq_hw_err_from_flags(self);
919932 }
920933
@@ -963,4 +976,6 @@ const struct aq_hw_ops hw_atl_ops_b0 = { · 42 unmodified lines
963976 .hw_get_regs = hw_atl_utils_hw_get_regs,
964977 .hw_get_hw_stats = hw_atl_utils_get_hw_stats,
965978 .hw_get_fw_version = hw_atl_utils_get_fw_version,
979+ .hw_set_offload = hw_atl_b0_hw_offload_set,
980+ .hw_set_fc = hw_atl_b0_set_fc,
966981 };
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.c+8−0
@@ -619,6 +619,14 @@ void hw_atl_rpb_rx_flow_ctl_mode_set(struct aq_hw_s *aq_hw, u32 rx_flow_ctl_mode · 618 unmodified lines
619619 HW_ATL_RPB_RX_FC_MODE_SHIFT, rx_flow_ctl_mode);
620620 }
621621
622+void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init)
623+{
624+ aq_hw_write_reg_bit(aq_hw, HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR,
625+ HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK,
626+ HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT,
627+ init);
628+}
629+
622630 void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw,
623631 u32 rx_pkt_buff_size_per_tc, u32 buffer)
624632 {
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh.h+3−0
@@ -325,6 +325,9 @@ void hw_atl_rpb_rx_pkt_buff_size_per_tc_set(struct aq_hw_s *aq_hw, · 324 unmodified lines
325325 u32 rx_pkt_buff_size_per_tc,
326326 u32 buffer);
327327
328+/* set rdm rx dma descriptor cache init */
329+void hw_atl_rdm_rx_dma_desc_cache_init_set(struct aq_hw_s *aq_hw, u32 init);
330+
328331 /* set rx xoff enable (per tc) */
329332 void hw_atl_rpb_rx_xoff_en_per_tc_set(struct aq_hw_s *aq_hw, u32 rx_xoff_en_per_tc,
330333 u32 buffer);
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_llh_internal.h+18−0
@@ -293,6 +293,24 @@ · 292 unmodified lines
293293 /* default value of bitfield desc{d}_reset */
294294 #define HW_ATL_RDM_DESCDRESET_DEFAULT 0x0
295295
296+/* rdm_desc_init_i bitfield definitions
297+ * preprocessor definitions for the bitfield rdm_desc_init_i.
298+ * port="pif_rdm_desc_init_i"
299+ */
300+
301+/* register address for bitfield rdm_desc_init_i */
302+#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_ADR 0x00005a00
303+/* bitmask for bitfield rdm_desc_init_i */
304+#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSK 0xffffffff
305+/* inverted bitmask for bitfield rdm_desc_init_i */
306+#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_MSKN 0x00000000
307+/* lower bit position of bitfield rdm_desc_init_i */
308+#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_SHIFT 0
309+/* width of bitfield rdm_desc_init_i */
310+#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_WIDTH 32
311+/* default value of bitfield rdm_desc_init_i */
312+#define HW_ATL_RDM_RX_DMA_DESC_CACHE_INIT_DEFAULT 0x0
313+
296314 /* rx int_desc_wrb_en bitfield definitions
297315 * preprocessor definitions for the bitfield "int_desc_wrb_en".
298316 * port="pif_rdm_int_desc_wrb_en_i"
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c+21−0
@@ -30,6 +30,8 @@ · 29 unmodified lines
3030 #define HW_ATL_FW2X_MPI_STATE_ADDR 0x370
3131 #define HW_ATL_FW2X_MPI_STATE2_ADDR 0x374
3232
33+#define HW_ATL_FW2X_CAP_PAUSE BIT(CAPS_HI_PAUSE)
34+#define HW_ATL_FW2X_CAP_ASYM_PAUSE BIT(CAPS_HI_ASYMMETRIC_PAUSE)
3335 #define HW_ATL_FW2X_CAP_SLEEP_PROXY BIT(CAPS_HI_SLEEP_PROXY)
3436 #define HW_ATL_FW2X_CAP_WOL BIT(CAPS_HI_WOL)
3537
@@ -451,6 +453,24 @@ static int aq_fw2x_set_flow_control(struct aq_hw_s *self) · 415 unmodified lines
451453 return 0;
452454 }
453455
456+static u32 aq_fw2x_get_flow_control(struct aq_hw_s *self, u32 *fcmode)
457+{
458+ u32 mpi_state = aq_hw_read_reg(self, HW_ATL_FW2X_MPI_STATE2_ADDR);
459+
460+ if (mpi_state & HW_ATL_FW2X_CAP_PAUSE)
461+ if (mpi_state & HW_ATL_FW2X_CAP_ASYM_PAUSE)
462+ *fcmode = AQ_NIC_FC_RX;
463+ else
464+ *fcmode = AQ_NIC_FC_RX | AQ_NIC_FC_TX;
465+ else
466+ if (mpi_state & HW_ATL_FW2X_CAP_ASYM_PAUSE)
467+ *fcmode = AQ_NIC_FC_TX;
468+ else
469+ *fcmode = 0;
470+
471+ return 0;
472+}
473+
454474 const struct aq_fw_ops aq_fw_2x_ops = {
455475 .init = aq_fw2x_init,
456476 .deinit = aq_fw2x_deinit,
@@ -465,4 +485,5 @@ const struct aq_fw_ops aq_fw_2x_ops = { · 8 unmodified lines
465485 .set_eee_rate = aq_fw2x_set_eee_rate,
466486 .get_eee_rate = aq_fw2x_get_eee_rate,
467487 .set_flow_control = aq_fw2x_set_flow_control,
488+ .get_flow_control = aq_fw2x_get_flow_control
468489 };
drivers/net/ethernet/hisilicon/hns3/hns3_enet.c+2−1
@@ -3760,7 +3760,8 @@ static int hns3_reset_notify_init_enet(struct hnae3_handle *handle) · 3759 unmodified lines
37603760 /* Hardware table is only clear when pf resets */
37613761 if (!(handle->flags & HNAE3_SUPPORT_VF)) {
37623762 ret = hns3_restore_vlan(netdev);
3763− return ret;
3763+ if (ret)
3764+ return ret;
37643765 }
37653766
37663767 ret = hns3_restore_fd_rules(netdev);
drivers/net/ethernet/ibm/ibmvnic.c+1−1
@@ -1545,7 +1545,7 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) · 1544 unmodified lines
15451545 tx_crq.v1.sge_len = cpu_to_be32(skb->len);
15461546 tx_crq.v1.ioba = cpu_to_be64(data_dma_addr);
15471547
1548− if (adapter->vlan_header_insertion) {
1548+ if (adapter->vlan_header_insertion && skb_vlan_tag_present(skb)) {
15491549 tx_crq.v1.flags2 |= IBMVNIC_TX_VLAN_INSERT;
15501550 tx_crq.v1.vlan_id = cpu_to_be16(skb->vlan_tci);
15511551 }
drivers/net/ethernet/intel/i40e/i40e_main.c+5−3
@@ -12249,6 +12249,8 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) · 12248 unmodified lines
1224912249 NETIF_F_GSO_GRE |
1225012250 NETIF_F_GSO_GRE_CSUM |
1225112251 NETIF_F_GSO_PARTIAL |
12252+ NETIF_F_GSO_IPXIP4 |
12253+ NETIF_F_GSO_IPXIP6 |
1225212254 NETIF_F_GSO_UDP_TUNNEL |
1225312255 NETIF_F_GSO_UDP_TUNNEL_CSUM |
1225412256 NETIF_F_SCTP_CRC |
@@ -12266,13 +12268,13 @@ static int i40e_config_netdev(struct i40e_vsi *vsi) · 11 unmodified lines
1226612268 /* record features VLANs can make use of */
1226712269 netdev->vlan_features |= hw_enc_features | NETIF_F_TSO_MANGLEID;
1226812270
12269− if (!(pf->flags & I40E_FLAG_MFP_ENABLED))
12270− netdev->hw_features |= NETIF_F_NTUPLE | NETIF_F_HW_TC;
12271−
1227212271 hw_features = hw_enc_features |
1227312272 NETIF_F_HW_VLAN_CTAG_TX |
1227412273 NETIF_F_HW_VLAN_CTAG_RX;
1227512274
12275+ if (!(pf->flags & I40E_FLAG_MFP_ENABLED))
12276+ hw_features |= NETIF_F_NTUPLE | NETIF_F_HW_TC;
12277+
1227612278 netdev->hw_features |= hw_features;
1227712279
1227812280 netdev->features |= hw_features | NETIF_F_HW_VLAN_CTAG_FILTER;
drivers/net/ethernet/intel/ice/ice.h+3−1
@@ -76,6 +76,8 @@ extern const char ice_drv_ver[]; · 75 unmodified lines
7676 #define ICE_MIN_INTR_PER_VF (ICE_MIN_QS_PER_VF + 1)
7777 #define ICE_DFLT_INTR_PER_VF (ICE_DFLT_QS_PER_VF + 1)
7878
79+#define ICE_MAX_RESET_WAIT 20
80+
7981 #define ICE_VSIQF_HKEY_ARRAY_SIZE ((VSIQF_HKEY_MAX_INDEX + 1) * 4)
8082
8183 #define ICE_DFLT_NETIF_M (NETIF_MSG_DRV | NETIF_MSG_PROBE | NETIF_MSG_LINK)
@@ -189,7 +191,6 @@ struct ice_vsi { · 107 unmodified lines
189191 u64 tx_linearize;
190192 DECLARE_BITMAP(state, __ICE_STATE_NBITS);
191193 DECLARE_BITMAP(flags, ICE_VSI_FLAG_NBITS);
192− unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
193194 unsigned int current_netdev_flags;
194195 u32 tx_restart;
195196 u32 tx_busy;
@@ -369,5 +370,6 @@ int ice_set_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size); · 173 unmodified lines
369370 int ice_get_rss(struct ice_vsi *vsi, u8 *seed, u8 *lut, u16 lut_size);
370371 void ice_fill_rss_lut(u8 *lut, u16 rss_table_size, u16 rss_size);
371372 void ice_print_link_msg(struct ice_vsi *vsi, bool isup);
373+void ice_napi_del(struct ice_vsi *vsi);
372374
373375 #endif /* _ICE_H_ */
drivers/net/ethernet/intel/ice/ice_common.c+3−0
@@ -811,6 +811,9 @@ void ice_deinit_hw(struct ice_hw *hw) · 810 unmodified lines
811811 /* Attempt to disable FW logging before shutting down control queues */
812812 ice_cfg_fw_log(hw, false);
813813 ice_shutdown_all_ctrlq(hw);
814+
815+ /* Clear VSI contexts if not already cleared */
816+ ice_clear_all_vsi_ctx(hw);
814817 }
815818
816819 /**
drivers/net/ethernet/intel/ice/ice_ethtool.c+6−1
@@ -1517,10 +1517,15 @@ ice_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *pause) · 1516 unmodified lines
15171517 }
15181518
15191519 if (!test_bit(__ICE_DOWN, pf->state)) {
1520− /* Give it a little more time to try to come back */
1520+ /* Give it a little more time to try to come back. If still
1521+ * down, restart autoneg link or reinitialize the interface.
1522+ */
15211523 msleep(75);
15221524 if (!test_bit(__ICE_DOWN, pf->state))
15231525 return ice_nway_reset(netdev);
1526+
1527+ ice_down(vsi);
1528+ ice_up(vsi);
15241529 }
15251530
15261531 return err;
drivers/net/ethernet/intel/ice/ice_hw_autogen.h+2−0
@@ -242,6 +242,8 @@ · 241 unmodified lines
242242 #define GLNVM_ULD 0x000B6008
243243 #define GLNVM_ULD_CORER_DONE_M BIT(3)
244244 #define GLNVM_ULD_GLOBR_DONE_M BIT(4)
245+#define GLPCI_CNF2 0x000BE004
246+#define GLPCI_CNF2_CACHELINE_SIZE_M BIT(1)
245247 #define PF_FUNC_RID 0x0009E880
246248 #define PF_FUNC_RID_FUNC_NUM_S 0
247249 #define PF_FUNC_RID_FUNC_NUM_M ICE_M(0x7, 0)
drivers/net/ethernet/intel/ice/ice_lib.c+2−1
@@ -1997,7 +1997,7 @@ int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena) · 1996 unmodified lines
19971997 status = ice_update_vsi(&vsi->back->hw, vsi->idx, ctxt, NULL);
19981998 if (status) {
19991999 netdev_err(vsi->netdev, "%sabling VLAN pruning on VSI handle: %d, VSI HW ID: %d failed, err = %d, aq_err = %d\n",
2000− ena ? "Ena" : "Dis", vsi->idx, vsi->vsi_num, status,
2000+ ena ? "En" : "Dis", vsi->idx, vsi->vsi_num, status,
20012001 vsi->back->hw.adminq.sq_last_status);
20022002 goto err_out;
20032003 }
@@ -2458,6 +2458,7 @@ int ice_vsi_release(struct ice_vsi *vsi) · 454 unmodified lines
24582458 * on this wq
24592459 */
24602460 if (vsi->netdev && !ice_is_reset_in_progress(pf->state)) {
2461+ ice_napi_del(vsi);
24612462 unregister_netdev(vsi->netdev);
24622463 free_netdev(vsi->netdev);
24632464 vsi->netdev = NULL;
drivers/net/ethernet/intel/ice/ice_main.c+48−38
@@ -1465,7 +1465,7 @@ skip_req_irq: · 1464 unmodified lines
14651465 * ice_napi_del - Remove NAPI handler for the VSI
14661466 * @vsi: VSI for which NAPI handler is to be removed
14671467 */
1468−static void ice_napi_del(struct ice_vsi *vsi)
1468+void ice_napi_del(struct ice_vsi *vsi)
14691469 {
14701470 int v_idx;
14711471
@@ -1622,7 +1622,6 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev, · 150 unmodified lines
16221622 {
16231623 struct ice_netdev_priv *np = netdev_priv(netdev);
16241624 struct ice_vsi *vsi = np->vsi;
1625− int ret;
16261625
16271626 if (vid >= VLAN_N_VID) {
16281627 netdev_err(netdev, "VLAN id requested %d is out of range %d\n",
@@ -1635,7 +1634,8 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev, · 6 unmodified lines
16351634
16361635 /* Enable VLAN pruning when VLAN 0 is added */
16371636 if (unlikely(!vid)) {
1638− ret = ice_cfg_vlan_pruning(vsi, true);
1637+ int ret = ice_cfg_vlan_pruning(vsi, true);
1638+
16391639 if (ret)
16401640 return ret;
16411641 }
@@ -1644,12 +1644,7 @@ static int ice_vlan_rx_add_vid(struct net_device *netdev, · 2 unmodified lines
16441644 * needed to continue allowing all untagged packets since VLAN prune
16451645 * list is applied to all packets by the switch
16461646 */
1647− ret = ice_vsi_add_vlan(vsi, vid);
1648−
1649− if (!ret)
1650− set_bit(vid, vsi->active_vlans);
1651−
1652− return ret;
1647+ return ice_vsi_add_vlan(vsi, vid);
16531648 }
16541649
16551650 /**
@@ -1677,8 +1672,6 @@ static int ice_vlan_rx_kill_vid(struct net_device *netdev, · 21 unmodified lines
16771672 if (status)
16781673 return status;
16791674
1680− clear_bit(vid, vsi->active_vlans);
1681−
16821675 /* Disable VLAN pruning when VLAN 0 is removed */
16831676 if (unlikely(!vid))
16841677 status = ice_cfg_vlan_pruning(vsi, false);
@@ -2001,6 +1994,22 @@ static int ice_init_interrupt_scheme(struct ice_pf *pf) · 316 unmodified lines
20011994 return 0;
20021995 }
20031996
1997+/**
1998+ * ice_verify_cacheline_size - verify driver's assumption of 64 Byte cache lines
1999+ * @pf: pointer to the PF structure
2000+ *
2001+ * There is no error returned here because the driver should be able to handle
2002+ * 128 Byte cache lines, so we only print a warning in case issues are seen,
2003+ * specifically with Tx.
2004+ */
2005+static void ice_verify_cacheline_size(struct ice_pf *pf)
2006+{
2007+ if (rd32(&pf->hw, GLPCI_CNF2) & GLPCI_CNF2_CACHELINE_SIZE_M)
2008+ dev_warn(&pf->pdev->dev,
2009+ "%d Byte cache line assumption is invalid, driver may have Tx timeouts!\n",
2010+ ICE_CACHE_LINE_BYTES);
2011+}
2012+
20042013 /**
20052014 * ice_probe - Device initialization routine
20062015 * @pdev: PCI device information struct
@@ -2151,6 +2160,8 @@ static int ice_probe(struct pci_dev *pdev, · 144 unmodified lines
21512160 /* since everything is good, start the service timer */
21522161 mod_timer(&pf->serv_tmr, round_jiffies(jiffies + pf->serv_tmr_period));
21532162
2163+ ice_verify_cacheline_size(pf);
2164+
21542165 return 0;
21552166
21562167 err_alloc_sw_unroll:
@@ -2182,6 +2193,12 @@ static void ice_remove(struct pci_dev *pdev) · 25 unmodified lines
21822193 if (!pf)
21832194 return;
21842195
2196+ for (i = 0; i < ICE_MAX_RESET_WAIT; i++) {
2197+ if (!ice_is_reset_in_progress(pf->state))
2198+ break;
2199+ msleep(100);
2200+ }
2201+
21852202 set_bit(__ICE_DOWN, pf->state);
21862203 ice_service_task_stop(pf);
21872204
@@ -2509,31 +2526,6 @@ static int ice_vsi_vlan_setup(struct ice_vsi *vsi) · 321 unmodified lines
25092526 return ret;
25102527 }
25112528
2512−/**
2513− * ice_restore_vlan - Reinstate VLANs when vsi/netdev comes back up
2514− * @vsi: the VSI being brought back up
2515− */
2516−static int ice_restore_vlan(struct ice_vsi *vsi)
2517−{
2518− int err;
2519− u16 vid;
2520−
2521− if (!vsi->netdev)
2522− return -EINVAL;
2523−
2524− err = ice_vsi_vlan_setup(vsi);
2525− if (err)
2526− return err;
2527−
2528− for_each_set_bit(vid, vsi->active_vlans, VLAN_N_VID) {
2529− err = ice_vlan_rx_add_vid(vsi->netdev, htons(ETH_P_8021Q), vid);
2530− if (err)
2531− break;
2532− }
2533−
2534− return err;
2535−}
2536−
25372529 /**
25382530 * ice_vsi_cfg - Setup the VSI
25392531 * @vsi: the VSI being configured
@@ -2546,7 +2538,9 @@ static int ice_vsi_cfg(struct ice_vsi *vsi) · 6 unmodified lines
25462538
25472539 if (vsi->netdev) {
25482540 ice_set_rx_mode(vsi->netdev);
2549− err = ice_restore_vlan(vsi);
2541+
2542+ err = ice_vsi_vlan_setup(vsi);
2543+
25502544 if (err)
25512545 return err;
25522546 }
@@ -3296,7 +3290,7 @@ static void ice_rebuild(struct ice_pf *pf) · 743 unmodified lines
32963290 struct device *dev = &pf->pdev->dev;
32973291 struct ice_hw *hw = &pf->hw;
32983292 enum ice_status ret;
3299− int err;
3293+ int err, i;
33003294
33013295 if (test_bit(__ICE_DOWN, pf->state))
33023296 goto clear_recovery;
@@ -3370,6 +3364,22 @@ static void ice_rebuild(struct ice_pf *pf) · 67 unmodified lines
33703364 }
33713365
33723366 ice_reset_all_vfs(pf, true);
3367+
3368+ for (i = 0; i < pf->num_alloc_vsi; i++) {
3369+ bool link_up;
3370+
3371+ if (!pf->vsi[i] || pf->vsi[i]->type != ICE_VSI_PF)
3372+ continue;
3373+ ice_get_link_status(pf->vsi[i]->port_info, &link_up);
3374+ if (link_up) {
3375+ netif_carrier_on(pf->vsi[i]->netdev);
3376+ netif_tx_wake_all_queues(pf->vsi[i]->netdev);
3377+ } else {
3378+ netif_carrier_off(pf->vsi[i]->netdev);
3379+ netif_tx_stop_all_queues(pf->vsi[i]->netdev);
3380+ }
3381+ }
3382+
33733383 /* if we get here, reset flow is successful */
33743384 clear_bit(__ICE_RESET_FAILED, pf->state);
33753385 return;
drivers/net/ethernet/intel/ice/ice_switch.c+12−0
@@ -347,6 +347,18 @@ static void ice_clear_vsi_ctx(struct ice_hw *hw, u16 vsi_handle) · 346 unmodified lines
347347 }
348348 }
349349
350+/**
351+ * ice_clear_all_vsi_ctx - clear all the VSI context entries
352+ * @hw: pointer to the hw struct
353+ */
354+void ice_clear_all_vsi_ctx(struct ice_hw *hw)
355+{
356+ u16 i;
357+
358+ for (i = 0; i < ICE_MAX_VSI; i++)
359+ ice_clear_vsi_ctx(hw, i);
360+}
361+
350362 /**
351363 * ice_add_vsi - add VSI context to the hardware and VSI handle list
352364 * @hw: pointer to the hw struct
drivers/net/ethernet/intel/ice/ice_switch.h+2−0
@@ -190,6 +190,8 @@ ice_update_vsi(struct ice_hw *hw, u16 vsi_handle, struct ice_vsi_ctx *vsi_ctx, · 189 unmodified lines
190190 struct ice_sq_cd *cd);
191191 bool ice_is_vsi_valid(struct ice_hw *hw, u16 vsi_handle);
192192 struct ice_vsi_ctx *ice_get_vsi_ctx(struct ice_hw *hw, u16 vsi_handle);
193+void ice_clear_all_vsi_ctx(struct ice_hw *hw);
194+/* Switch config */
193195 enum ice_status ice_get_initial_sw_cfg(struct ice_hw *hw);
194196
195197 /* Switch/bridge related commands */
drivers/net/ethernet/intel/ice/ice_txrx.c+6−5
@@ -1520,7 +1520,7 @@ int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off) · 1519 unmodified lines
15201520
15211521 /* update gso_segs and bytecount */
15221522 first->gso_segs = skb_shinfo(skb)->gso_segs;
1523− first->bytecount = (first->gso_segs - 1) * off->header_len;
1523+ first->bytecount += (first->gso_segs - 1) * off->header_len;
15241524
15251525 cd_tso_len = skb->len - off->header_len;
15261526 cd_mss = skb_shinfo(skb)->gso_size;
@@ -1556,15 +1556,15 @@ int ice_tso(struct ice_tx_buf *first, struct ice_tx_offload_params *off) · 29 unmodified lines
15561556 * magnitude greater than our largest possible GSO size.
15571557 *
15581558 * This would then be implemented as:
1559− * return (((size >> 12) * 85) >> 8) + 1;
1559+ * return (((size >> 12) * 85) >> 8) + ICE_DESCS_FOR_SKB_DATA_PTR;
15601560 *
15611561 * Since multiplication and division are commutative, we can reorder
15621562 * operations into:
1563− * return ((size * 85) >> 20) + 1;
1563+ * return ((size * 85) >> 20) + ICE_DESCS_FOR_SKB_DATA_PTR;
15641564 */
15651565 static unsigned int ice_txd_use_count(unsigned int size)
15661566 {
1567− return ((size * 85) >> 20) + 1;
1567+ return ((size * 85) >> 20) + ICE_DESCS_FOR_SKB_DATA_PTR;
15681568 }
15691569
15701570 /**
@@ -1706,7 +1706,8 @@ ice_xmit_frame_ring(struct sk_buff *skb, struct ice_ring *tx_ring) · 135 unmodified lines
17061706 * + 1 desc for context descriptor,
17071707 * otherwise try next time
17081708 */
1709− if (ice_maybe_stop_tx(tx_ring, count + 4 + 1)) {
1709+ if (ice_maybe_stop_tx(tx_ring, count + ICE_DESCS_PER_CACHE_LINE +
1710+ ICE_DESCS_FOR_CTX_DESC)) {
17101711 tx_ring->tx_stats.tx_busy++;
17111712 return NETDEV_TX_BUSY;
17121713 }
drivers/net/ethernet/intel/ice/ice_txrx.h+15−2
@@ -22,8 +22,21 @@ · 21 unmodified lines
2222 #define ICE_RX_BUF_WRITE 16 /* Must be power of 2 */
2323 #define ICE_MAX_TXQ_PER_TXQG 128
2424
25−/* Tx Descriptors needed, worst case */
26−#define DESC_NEEDED (MAX_SKB_FRAGS + 4)
25+/* We are assuming that the cache line is always 64 Bytes here for ice.
26+ * In order to make sure that is a correct assumption there is a check in probe
27+ * to print a warning if the read from GLPCI_CNF2 tells us that the cache line
28+ * size is 128 bytes. We do it this way because we do not want to read the
29+ * GLPCI_CNF2 register or a variable containing the value on every pass through
30+ * the Tx path.
31+ */
32+#define ICE_CACHE_LINE_BYTES 64
33+#define ICE_DESCS_PER_CACHE_LINE (ICE_CACHE_LINE_BYTES / \
34+ sizeof(struct ice_tx_desc))
35+#define ICE_DESCS_FOR_CTX_DESC 1
36+#define ICE_DESCS_FOR_SKB_DATA_PTR 1
37+/* Tx descriptors needed, worst case */
38+#define DESC_NEEDED (MAX_SKB_FRAGS + ICE_DESCS_FOR_CTX_DESC + \
39+ ICE_DESCS_PER_CACHE_LINE + ICE_DESCS_FOR_SKB_DATA_PTR)
2740 #define ICE_DESC_UNUSED(R) \
2841 ((((R)->next_to_clean > (R)->next_to_use) ? 0 : (R)->count) + \
2942 (R)->next_to_clean - (R)->next_to_use - 1)
drivers/net/ethernet/intel/ice/ice_type.h+1−1
@@ -92,12 +92,12 @@ struct ice_link_status { · 91 unmodified lines
9292 u64 phy_type_low;
9393 u16 max_frame_size;
9494 u16 link_speed;
95+ u16 req_speeds;
9596 u8 lse_ena; /* Link Status Event notification */
9697 u8 link_info;
9798 u8 an_info;
9899 u8 ext_info;
99100 u8 pacing;
100− u8 req_speeds;
101101 /* Refer to #define from module_type[ICE_MODULE_TYPE_TOTAL_BYTE] of
102102 * ice_aqc_get_phy_caps structure
103103 */
drivers/net/ethernet/intel/ice/ice_virtchnl_pf.c+1−3
@@ -348,7 +348,7 @@ static int ice_vsi_set_pvid(struct ice_vsi *vsi, u16 vid) · 347 unmodified lines
348348 struct ice_vsi_ctx ctxt = { 0 };
349349 enum ice_status status;
350350
351− ctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_TAGGED |
351+ ctxt.info.vlan_flags = ICE_AQ_VSI_VLAN_MODE_UNTAGGED |
352352 ICE_AQ_VSI_PVLAN_INSERT_PVID |
353353 ICE_AQ_VSI_VLAN_EMOD_STR;
354354 ctxt.info.pvid = cpu_to_le16(vid);
@@ -2171,7 +2171,6 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v) · 1816 unmodified lines
21712171
21722172 if (!ice_vsi_add_vlan(vsi, vid)) {
21732173 vf->num_vlan++;
2174− set_bit(vid, vsi->active_vlans);
21752174
21762175 /* Enable VLAN pruning when VLAN 0 is added */
21772176 if (unlikely(!vid))
@@ -2190,7 +2189,6 @@ static int ice_vc_process_vlan_msg(struct ice_vf *vf, u8 *msg, bool add_v) · 12 unmodified lines
21902189 */
21912190 if (!ice_vsi_kill_vlan(vsi, vid)) {
21922191 vf->num_vlan--;
2193− clear_bit(vid, vsi->active_vlans);
21942192
21952193 /* Disable VLAN pruning when removing VLAN 0 */
21962194 if (unlikely(!vid))
drivers/net/ethernet/intel/igb/igb_ptp.c+7−5
@@ -53,13 +53,15 @@ · 52 unmodified lines
5353 * 2^40 * 10^-9 / 60 = 18.3 minutes.
5454 *
5555 * SYSTIM is converted to real time using a timecounter. As
56− * timecounter_cyc2time() allows old timestamps, the timecounter
57− * needs to be updated at least once per half of the SYSTIM interval.
58− * Scheduling of delayed work is not very accurate, so we aim for 8
59− * minutes to be sure the actual interval is shorter than 9.16 minutes.
56+ * timecounter_cyc2time() allows old timestamps, the timecounter needs
57+ * to be updated at least once per half of the SYSTIM interval.
58+ * Scheduling of delayed work is not very accurate, and also the NIC
59+ * clock can be adjusted to run up to 6% faster and the system clock
60+ * up to 10% slower, so we aim for 6 minutes to be sure the actual
61+ * interval in the NIC time is shorter than 9.16 minutes.
6062 */
6163
62−#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 8)
64+#define IGB_SYSTIM_OVERFLOW_PERIOD (HZ * 60 * 6)
6365 #define IGB_PTP_TX_TIMEOUT (HZ * 15)
6466 #define INCPERIOD_82576 BIT(E1000_TIMINCA_16NS_SHIFT)
6567 #define INCVALUE_82576_MASK GENMASK(E1000_TIMINCA_16NS_SHIFT - 1, 0)
drivers/net/ethernet/marvell/mvneta.c+2−2
@@ -494,7 +494,7 @@ struct mvneta_port { · 493 unmodified lines
494494 #if defined(__LITTLE_ENDIAN)
495495 struct mvneta_tx_desc {
496496 u32 command; /* Options used by HW for packet transmitting.*/
497− u16 reserverd1; /* csum_l4 (for future use) */
497+ u16 reserved1; /* csum_l4 (for future use) */
498498 u16 data_size; /* Data size of transmitted packet in bytes */
499499 u32 buf_phys_addr; /* Physical addr of transmitted buffer */
500500 u32 reserved2; /* hw_cmd - (for future use, PMT) */
@@ -519,7 +519,7 @@ struct mvneta_rx_desc { · 18 unmodified lines
519519 #else
520520 struct mvneta_tx_desc {
521521 u16 data_size; /* Data size of transmitted packet in bytes */
522− u16 reserverd1; /* csum_l4 (for future use) */
522+ u16 reserved1; /* csum_l4 (for future use) */
523523 u32 command; /* Options used by HW for packet transmitting.*/
524524 u32 reserved2; /* hw_cmd - (for future use, PMT) */
525525 u32 buf_phys_addr; /* Physical addr of transmitted buffer */
drivers/net/ethernet/qlogic/qed/qed_fcoe.c+8−3
@@ -147,7 +147,8 @@ qed_sp_fcoe_func_start(struct qed_hwfn *p_hwfn, · 146 unmodified lines
147147 "Cannot satisfy CQ amount. CQs requested %d, CQs available %d. Aborting function start\n",
148148 fcoe_pf_params->num_cqs,
149149 p_hwfn->hw_info.feat_num[QED_FCOE_CQ]);
150− return -EINVAL;
150+ rc = -EINVAL;
151+ goto err;
151152 }
152153
153154 p_data->mtu = cpu_to_le16(fcoe_pf_params->mtu);
@@ -156,14 +157,14 @@ qed_sp_fcoe_func_start(struct qed_hwfn *p_hwfn, · 2 unmodified lines
156157
157158 rc = qed_cxt_acquire_cid(p_hwfn, PROTOCOLID_FCOE, &dummy_cid);
158159 if (rc)
159− return rc;
160+ goto err;
160161
161162 cxt_info.iid = dummy_cid;
162163 rc = qed_cxt_get_cid_info(p_hwfn, &cxt_info);
163164 if (rc) {
164165 DP_NOTICE(p_hwfn, "Cannot find context info for dummy cid=%d\n",
165166 dummy_cid);
166− return rc;
167+ goto err;
167168 }
168169 p_cxt = cxt_info.p_cxt;
169170 SET_FIELD(p_cxt->tstorm_ag_context.flags3,
@@ -240,6 +241,10 @@ qed_sp_fcoe_func_start(struct qed_hwfn *p_hwfn, · 70 unmodified lines
240241 rc = qed_spq_post(p_hwfn, p_ent, NULL);
241242
242243 return rc;
244+
245+err:
246+ qed_sp_destroy_request(p_hwfn, p_ent);
247+ return rc;
243248 }
244249
245250 static int
drivers/net/ethernet/qlogic/qed/qed_iscsi.c+1−0
@@ -200,6 +200,7 @@ qed_sp_iscsi_func_start(struct qed_hwfn *p_hwfn, · 199 unmodified lines
200200 "Cannot satisfy CQ amount. Queues requested %d, CQs available %d. Aborting function start\n",
201201 p_params->num_queues,
202202 p_hwfn->hw_info.feat_num[QED_ISCSI_CQ]);
203+ qed_sp_destroy_request(p_hwfn, p_ent);
203204 return -EINVAL;
204205 }
205206
drivers/net/ethernet/qlogic/qed/qed_l2.c+8−4
@@ -740,8 +740,7 @@ int qed_sp_vport_update(struct qed_hwfn *p_hwfn, · 739 unmodified lines
740740
741741 rc = qed_sp_vport_update_rss(p_hwfn, p_ramrod, p_rss_params);
742742 if (rc) {
743− /* Return spq entry which is taken in qed_sp_init_request()*/
744− qed_spq_return_entry(p_hwfn, p_ent);
743+ qed_sp_destroy_request(p_hwfn, p_ent);
745744 return rc;
746745 }
747746
@@ -1355,6 +1354,7 @@ qed_filter_ucast_common(struct qed_hwfn *p_hwfn, · 607 unmodified lines
13551354 DP_NOTICE(p_hwfn,
13561355 "%d is not supported yet\n",
13571356 p_filter_cmd->opcode);
1357+ qed_sp_destroy_request(p_hwfn, *pp_ent);
13581358 return -EINVAL;
13591359 }
13601360
@@ -2056,13 +2056,13 @@ qed_configure_rfs_ntuple_filter(struct qed_hwfn *p_hwfn, · 695 unmodified lines
20562056 } else {
20572057 rc = qed_fw_vport(p_hwfn, p_params->vport_id, &abs_vport_id);
20582058 if (rc)
2059− return rc;
2059+ goto err;
20602060
20612061 if (p_params->qid != QED_RFS_NTUPLE_QID_RSS) {
20622062 rc = qed_fw_l2_queue(p_hwfn, p_params->qid,
20632063 &abs_rx_q_id);
20642064 if (rc)
2065− return rc;
2065+ goto err;
20662066
20672067 p_ramrod->rx_qid_valid = 1;
20682068 p_ramrod->rx_qid = cpu_to_le16(abs_rx_q_id);
@@ -2083,6 +2083,10 @@ qed_configure_rfs_ntuple_filter(struct qed_hwfn *p_hwfn, · 14 unmodified lines
20832083 (u64)p_params->addr, p_params->length);
20842084
20852085 return qed_spq_post(p_hwfn, p_ent, NULL);
2086+
2087+err:
2088+ qed_sp_destroy_request(p_hwfn, p_ent);
2089+ return rc;
20862090 }
20872091
20882092 int qed_get_rxq_coalesce(struct qed_hwfn *p_hwfn,
drivers/net/ethernet/qlogic/qed/qed_rdma.c+1−0
@@ -1514,6 +1514,7 @@ qed_rdma_register_tid(void *rdma_cxt, · 1513 unmodified lines
15141514 default:
15151515 rc = -EINVAL;
15161516 DP_VERBOSE(p_hwfn, QED_MSG_RDMA, "rc = %d\n", rc);
1517+ qed_sp_destroy_request(p_hwfn, p_ent);
15171518 return rc;
15181519 }
15191520 SET_FIELD(p_ramrod->flags1,
drivers/net/ethernet/qlogic/qed/qed_roce.c+1−0
@@ -745,6 +745,7 @@ static int qed_roce_sp_destroy_qp_responder(struct qed_hwfn *p_hwfn, · 744 unmodified lines
745745 DP_NOTICE(p_hwfn,
746746 "qed destroy responder failed: cannot allocate memory (ramrod). rc = %d\n",
747747 rc);
748+ qed_sp_destroy_request(p_hwfn, p_ent);
748749 return rc;
749750 }
750751
drivers/net/ethernet/qlogic/qed/qed_sp.h+14−0
@@ -167,6 +167,9 @@ struct qed_spq_entry { · 166 unmodified lines
167167 enum spq_mode comp_mode;
168168 struct qed_spq_comp_cb comp_cb;
169169 struct qed_spq_comp_done comp_done; /* SPQ_MODE_EBLOCK */
170+
171+ /* Posted entry for unlimited list entry in EBLOCK mode */
172+ struct qed_spq_entry *post_ent;
170173 };
171174
172175 struct qed_eq {
@@ -396,6 +399,17 @@ struct qed_sp_init_data { · 223 unmodified lines
396399 struct qed_spq_comp_cb *p_comp_data;
397400 };
398401
402+/**
403+ * @brief Returns a SPQ entry to the pool / frees the entry if allocated.
404+ * Should be called on in error flows after initializing the SPQ entry
405+ * and before posting it.
406+ *
407+ * @param p_hwfn
408+ * @param p_ent
409+ */
410+void qed_sp_destroy_request(struct qed_hwfn *p_hwfn,
411+ struct qed_spq_entry *p_ent);
412+
399413 int qed_sp_init_request(struct qed_hwfn *p_hwfn,
400414 struct qed_spq_entry **pp_ent,
401415 u8 cmd,
drivers/net/ethernet/qlogic/qed/qed_sp_commands.c+20−2
@@ -47,6 +47,19 @@ · 46 unmodified lines
4747 #include "qed_sp.h"
4848 #include "qed_sriov.h"
4949
50+void qed_sp_destroy_request(struct qed_hwfn *p_hwfn,
51+ struct qed_spq_entry *p_ent)
52+{
53+ /* qed_spq_get_entry() can either get an entry from the free_pool,
54+ * or, if no entries are left, allocate a new entry and add it to
55+ * the unlimited_pending list.
56+ */
57+ if (p_ent->queue == &p_hwfn->p_spq->unlimited_pending)
58+ kfree(p_ent);
59+ else
60+ qed_spq_return_entry(p_hwfn, p_ent);
61+}
62+
5063 int qed_sp_init_request(struct qed_hwfn *p_hwfn,
5164 struct qed_spq_entry **pp_ent,
5265 u8 cmd, u8 protocol, struct qed_sp_init_data *p_data)
@@ -80,7 +93,7 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn, · 27 unmodified lines
8093
8194 case QED_SPQ_MODE_BLOCK:
8295 if (!p_data->p_comp_data)
83− return -EINVAL;
96+ goto err;
8497
8598 p_ent->comp_cb.cookie = p_data->p_comp_data->cookie;
8699 break;
@@ -95,7 +108,7 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn, · 8 unmodified lines
95108 default:
96109 DP_NOTICE(p_hwfn, "Unknown SPQE completion mode %d\n",
97110 p_ent->comp_mode);
98− return -EINVAL;
111+ goto err;
99112 }
100113
101114 DP_VERBOSE(p_hwfn, QED_MSG_SPQ,
@@ -109,6 +122,11 @@ int qed_sp_init_request(struct qed_hwfn *p_hwfn, · 7 unmodified lines
109122 memset(&p_ent->ramrod, 0, sizeof(p_ent->ramrod));
110123
111124 return 0;
125+
126+err:
127+ qed_sp_destroy_request(p_hwfn, p_ent);
128+
129+ return -EINVAL;
112130 }
113131
114132 static enum tunnel_clss qed_tunn_clss_to_fw_clss(u8 type)
drivers/net/ethernet/qlogic/qed/qed_spq.c+35−34
@@ -142,6 +142,7 @@ static int qed_spq_block(struct qed_hwfn *p_hwfn, · 141 unmodified lines
142142
143143 DP_INFO(p_hwfn, "Ramrod is stuck, requesting MCP drain\n");
144144 rc = qed_mcp_drain(p_hwfn, p_ptt);
145+ qed_ptt_release(p_hwfn, p_ptt);
145146 if (rc) {
146147 DP_NOTICE(p_hwfn, "MCP drain failed\n");
147148 goto err;
@@ -150,18 +151,15 @@ static int qed_spq_block(struct qed_hwfn *p_hwfn, · 2 unmodified lines
150151 /* Retry after drain */
151152 rc = __qed_spq_block(p_hwfn, p_ent, p_fw_ret, true);
152153 if (!rc)
153− goto out;
154+ return 0;
154155
155156 comp_done = (struct qed_spq_comp_done *)p_ent->comp_cb.cookie;
156− if (comp_done->done == 1)
157+ if (comp_done->done == 1) {
157158 if (p_fw_ret)
158159 *p_fw_ret = comp_done->fw_return_code;
159−out:
160− qed_ptt_release(p_hwfn, p_ptt);
161− return 0;
162−
160+ return 0;
161+ }
163162 err:
164− qed_ptt_release(p_hwfn, p_ptt);
165163 DP_NOTICE(p_hwfn,
166164 "Ramrod is stuck [CID %08x cmd %02x protocol %02x echo %04x]\n",
167165 le32_to_cpu(p_ent->elem.hdr.cid),
@@ -685,6 +683,8 @@ static int qed_spq_add_entry(struct qed_hwfn *p_hwfn, · 517 unmodified lines
685683 /* EBLOCK responsible to free the allocated p_ent */
686684 if (p_ent->comp_mode != QED_SPQ_MODE_EBLOCK)
687685 kfree(p_ent);
686+ else
687+ p_ent->post_ent = p_en2;
688688
689689 p_ent = p_en2;
690690 }
@@ -767,6 +767,25 @@ static int qed_spq_pend_post(struct qed_hwfn *p_hwfn) · 76 unmodified lines
767767 SPQ_HIGH_PRI_RESERVE_DEFAULT);
768768 }
769769
770+/* Avoid overriding of SPQ entries when getting out-of-order completions, by
771+ * marking the completions in a bitmap and increasing the chain consumer only
772+ * for the first successive completed entries.
773+ */
774+static void qed_spq_comp_bmap_update(struct qed_hwfn *p_hwfn, __le16 echo)
775+{
776+ u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE;
777+ struct qed_spq *p_spq = p_hwfn->p_spq;
778+
779+ __set_bit(pos, p_spq->p_comp_bitmap);
780+ while (test_bit(p_spq->comp_bitmap_idx,
781+ p_spq->p_comp_bitmap)) {
782+ __clear_bit(p_spq->comp_bitmap_idx,
783+ p_spq->p_comp_bitmap);
784+ p_spq->comp_bitmap_idx++;
785+ qed_chain_return_produced(&p_spq->chain);
786+ }
787+}
788+
770789 int qed_spq_post(struct qed_hwfn *p_hwfn,
771790 struct qed_spq_entry *p_ent, u8 *fw_return_code)
772791 {
@@ -824,11 +843,12 @@ int qed_spq_post(struct qed_hwfn *p_hwfn, · 51 unmodified lines
824843 p_ent->queue == &p_spq->unlimited_pending);
825844
826845 if (p_ent->queue == &p_spq->unlimited_pending) {
827− /* This is an allocated p_ent which does not need to
828− * return to pool.
829− */
846+ struct qed_spq_entry *p_post_ent = p_ent->post_ent;
847+
830848 kfree(p_ent);
831− return rc;
849+
850+ /* Return the entry which was actually posted */
851+ p_ent = p_post_ent;
832852 }
833853
834854 if (rc)
@@ -842,7 +862,7 @@ int qed_spq_post(struct qed_hwfn *p_hwfn, · 7 unmodified lines
842862 spq_post_fail2:
843863 spin_lock_bh(&p_spq->lock);
844864 list_del(&p_ent->list);
845− qed_chain_return_produced(&p_spq->chain);
865+ qed_spq_comp_bmap_update(p_hwfn, p_ent->elem.hdr.echo);
846866
847867 spq_post_fail:
848868 /* return to the free pool */
@@ -874,25 +894,8 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, · 25 unmodified lines
874894 spin_lock_bh(&p_spq->lock);
875895 list_for_each_entry_safe(p_ent, tmp, &p_spq->completion_pending, list) {
876896 if (p_ent->elem.hdr.echo == echo) {
877− u16 pos = le16_to_cpu(echo) % SPQ_RING_SIZE;
878−
879897 list_del(&p_ent->list);
880−
881− /* Avoid overriding of SPQ entries when getting
882− * out-of-order completions, by marking the completions
883− * in a bitmap and increasing the chain consumer only
884− * for the first successive completed entries.
885− */
886− __set_bit(pos, p_spq->p_comp_bitmap);
887−
888− while (test_bit(p_spq->comp_bitmap_idx,
889− p_spq->p_comp_bitmap)) {
890− __clear_bit(p_spq->comp_bitmap_idx,
891− p_spq->p_comp_bitmap);
892− p_spq->comp_bitmap_idx++;
893− qed_chain_return_produced(&p_spq->chain);
894− }
895−
898+ qed_spq_comp_bmap_update(p_hwfn, echo);
896899 p_spq->comp_count++;
897900 found = p_ent;
898901 break;
@@ -931,11 +934,9 @@ int qed_spq_completion(struct qed_hwfn *p_hwfn, · 32 unmodified lines
931934 QED_MSG_SPQ,
932935 "Got a completion without a callback function\n");
933936
934− if ((found->comp_mode != QED_SPQ_MODE_EBLOCK) ||
935− (found->queue == &p_spq->unlimited_pending))
937+ if (found->comp_mode != QED_SPQ_MODE_EBLOCK)
936938 /* EBLOCK is responsible for returning its own entry into the
937− * free list, unless it originally added the entry into the
938− * unlimited pending list.
939+ * free list.
939940 */
940941 qed_spq_return_entry(p_hwfn, found);
941942
drivers/net/ethernet/qlogic/qed/qed_sriov.c+1−0
@@ -101,6 +101,7 @@ static int qed_sp_vf_start(struct qed_hwfn *p_hwfn, struct qed_vf_info *p_vf) · 100 unmodified lines
101101 default:
102102 DP_NOTICE(p_hwfn, "Unknown VF personality %d\n",
103103 p_hwfn->hw_info.personality);
104+ qed_sp_destroy_request(p_hwfn, p_ent);
104105 return -EINVAL;
105106 }
106107
drivers/net/ethernet/qlogic/qlcnic/qlcnic_io.c+5−3
@@ -459,7 +459,7 @@ static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter, · 458 unmodified lines
459459 struct cmd_desc_type0 *first_desc, struct sk_buff *skb,
460460 struct qlcnic_host_tx_ring *tx_ring)
461461 {
462− u8 l4proto, opcode = 0, hdr_len = 0;
462+ u8 l4proto, opcode = 0, hdr_len = 0, tag_vlan = 0;
463463 u16 flags = 0, vlan_tci = 0;
464464 int copied, offset, copy_len, size;
465465 struct cmd_desc_type0 *hwdesc;
@@ -472,14 +472,16 @@ static int qlcnic_tx_pkt(struct qlcnic_adapter *adapter, · 6 unmodified lines
472472 flags = QLCNIC_FLAGS_VLAN_TAGGED;
473473 vlan_tci = ntohs(vh->h_vlan_TCI);
474474 protocol = ntohs(vh->h_vlan_encapsulated_proto);
475+ tag_vlan = 1;
475476 } else if (skb_vlan_tag_present(skb)) {
476477 flags = QLCNIC_FLAGS_VLAN_OOB;
477478 vlan_tci = skb_vlan_tag_get(skb);
479+ tag_vlan = 1;
478480 }
479481 if (unlikely(adapter->tx_pvid)) {
480− if (vlan_tci && !(adapter->flags & QLCNIC_TAGGING_ENABLED))
482+ if (tag_vlan && !(adapter->flags & QLCNIC_TAGGING_ENABLED))
481483 return -EIO;
482− if (vlan_tci && (adapter->flags & QLCNIC_TAGGING_ENABLED))
484+ if (tag_vlan && (adapter->flags & QLCNIC_TAGGING_ENABLED))
483485 goto set_flags;
484486
485487 flags = QLCNIC_FLAGS_VLAN_OOB;
drivers/net/ethernet/qualcomm/rmnet/rmnet_vnd.c+3−3
@@ -234,7 +234,7 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev, · 233 unmodified lines
234234 struct net_device *real_dev,
235235 struct rmnet_endpoint *ep)
236236 {
237− struct rmnet_priv *priv;
237+ struct rmnet_priv *priv = netdev_priv(rmnet_dev);
238238 int rc;
239239
240240 if (ep->egress_dev)
@@ -247,6 +247,8 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev, · 6 unmodified lines
247247 rmnet_dev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
248248 rmnet_dev->hw_features |= NETIF_F_SG;
249249
250+ priv->real_dev = real_dev;
251+
250252 rc = register_netdevice(rmnet_dev);
251253 if (!rc) {
252254 ep->egress_dev = rmnet_dev;
@@ -255,9 +257,7 @@ int rmnet_vnd_newlink(u8 id, struct net_device *rmnet_dev, · 2 unmodified lines
255257
256258 rmnet_dev->rtnl_link_ops = &rmnet_link_ops;
257259
258− priv = netdev_priv(rmnet_dev);
259260 priv->mux_id = id;
260− priv->real_dev = real_dev;
261261
262262 netdev_dbg(rmnet_dev, "rmnet dev created\n");
263263 }
drivers/net/ethernet/stmicro/stmmac/common.h+2−1
@@ -365,7 +365,8 @@ struct dma_features { · 364 unmodified lines
365365
366366 /* GMAC TX FIFO is 8K, Rx FIFO is 16K */
367367 #define BUF_SIZE_16KiB 16384
368−#define BUF_SIZE_8KiB 8192
368+/* RX Buffer size must be < 8191 and multiple of 4/8/16 bytes */
369+#define BUF_SIZE_8KiB 8188
369370 #define BUF_SIZE_4KiB 4096
370371 #define BUF_SIZE_2KiB 2048
371372
drivers/net/ethernet/stmicro/stmmac/descs_com.h+1−1
@@ -31,7 +31,7 @@ · 30 unmodified lines
3131 /* Enhanced descriptors */
3232 static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end)
3333 {
34− p->des1 |= cpu_to_le32(((BUF_SIZE_8KiB - 1)
34+ p->des1 |= cpu_to_le32((BUF_SIZE_8KiB
3535 << ERDES1_BUFFER2_SIZE_SHIFT)
3636 & ERDES1_BUFFER2_SIZE_MASK);
3737
drivers/net/ethernet/stmicro/stmmac/enh_desc.c+1−1
@@ -262,7 +262,7 @@ static void enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, · 261 unmodified lines
262262 int mode, int end)
263263 {
264264 p->des0 |= cpu_to_le32(RDES0_OWN);
265− p->des1 |= cpu_to_le32((BUF_SIZE_8KiB - 1) & ERDES1_BUFFER1_SIZE_MASK);
265+ p->des1 |= cpu_to_le32(BUF_SIZE_8KiB & ERDES1_BUFFER1_SIZE_MASK);
266266
267267 if (mode == STMMAC_CHAIN_MODE)
268268 ehn_desc_rx_set_on_chain(p);
drivers/net/ethernet/stmicro/stmmac/ring_mode.c+1−1
@@ -140,7 +140,7 @@ static void clean_desc3(void *priv_ptr, struct dma_desc *p) · 139 unmodified lines
140140 static int set_16kib_bfsize(int mtu)
141141 {
142142 int ret = 0;
143− if (unlikely(mtu >= BUF_SIZE_8KiB))
143+ if (unlikely(mtu > BUF_SIZE_8KiB))
144144 ret = BUF_SIZE_16KiB;
145145 return ret;
146146 }
drivers/net/fddi/defza.c+4−3
@@ -1,4 +1,4 @@
1−// SPDX-License-Identifier: GPL-2.0
1+// SPDX-License-Identifier: GPL-2.0+
22 /* FDDI network adapter driver for DEC FDDIcontroller 700/700-C devices.
33 *
44 * Copyright (c) 2018 Maciej W. Rozycki
@@ -56,7 +56,7 @@ · 51 unmodified lines
5656 #define DRV_VERSION "v.1.1.4"
5757 #define DRV_RELDATE "Oct 6 2018"
5858
59−static char version[] =
59+static const char version[] =
6060 DRV_NAME ": " DRV_VERSION " " DRV_RELDATE " Maciej W. Rozycki\n";
6161
6262 MODULE_AUTHOR("Maciej W. Rozycki <macro@linux-mips.org>");
@@ -784,7 +784,7 @@ err_rx: · 721 unmodified lines
784784 static void fza_tx_smt(struct net_device *dev)
785785 {
786786 struct fza_private *fp = netdev_priv(dev);
787− struct fza_buffer_tx __iomem *smt_tx_ptr, *skb_data_ptr;
787+ struct fza_buffer_tx __iomem *smt_tx_ptr;
788788 int i, len;
789789 u32 own;
790790
@@ -799,6 +799,7 @@ static void fza_tx_smt(struct net_device *dev) · 8 unmodified lines
799799
800800 if (!netif_queue_stopped(dev)) {
801801 if (dev_nit_active(dev)) {
802+ struct fza_buffer_tx *skb_data_ptr;
802803 struct sk_buff *skb;
803804
804805 /* Length must be a multiple of 4 as only word
drivers/net/fddi/defza.h+2−1
@@ -1,4 +1,4 @@
1−/* SPDX-License-Identifier: GPL-2.0 */
1+/* SPDX-License-Identifier: GPL-2.0+ */
22 /* FDDI network adapter driver for DEC FDDIcontroller 700/700-C devices.
33 *
44 * Copyright (c) 2018 Maciej W. Rozycki
@@ -235,6 +235,7 @@ struct fza_ring_cmd { · 230 unmodified lines
235235 #define FZA_RING_CMD 0x200400 /* command ring address */
236236 #define FZA_RING_CMD_SIZE 0x40 /* command descriptor ring
237237 * size
238+ */
238239 /* Command constants. */
239240 #define FZA_RING_CMD_MASK 0x7fffffff
240241 #define FZA_RING_CMD_NOP 0x00000000 /* nop */
drivers/net/phy/broadcom.c+16−2
@@ -92,7 +92,7 @@ static int bcm54612e_config_init(struct phy_device *phydev) · 91 unmodified lines
9292 return 0;
9393 }
9494
95−static int bcm5481x_config(struct phy_device *phydev)
95+static int bcm54xx_config_clock_delay(struct phy_device *phydev)
9696 {
9797 int rc, val;
9898
@@ -429,7 +429,7 @@ static int bcm5481_config_aneg(struct phy_device *phydev) · 330 unmodified lines
429429 ret = genphy_config_aneg(phydev);
430430
431431 /* Then we can set up the delay. */
432− bcm5481x_config(phydev);
432+ bcm54xx_config_clock_delay(phydev);
433433
434434 if (of_property_read_bool(np, "enet-phy-lane-swap")) {
435435 /* Lane Swap - Undocumented register...magic! */
@@ -442,6 +442,19 @@ static int bcm5481_config_aneg(struct phy_device *phydev) · 6 unmodified lines
442442 return ret;
443443 }
444444
445+static int bcm54616s_config_aneg(struct phy_device *phydev)
446+{
447+ int ret;
448+
449+ /* Aneg firsly. */
450+ ret = genphy_config_aneg(phydev);
451+
452+ /* Then we can set up the delay. */
453+ bcm54xx_config_clock_delay(phydev);
454+
455+ return ret;
456+}
457+
445458 static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
446459 {
447460 int val;
@@ -636,6 +649,7 @@ static struct phy_driver broadcom_drivers[] = { · 188 unmodified lines
636649 .features = PHY_GBIT_FEATURES,
637650 .flags = PHY_HAS_INTERRUPT,
638651 .config_init = bcm54xx_config_init,
652+ .config_aneg = bcm54616s_config_aneg,
639653 .ack_interrupt = bcm_phy_ack_intr,
640654 .config_intr = bcm_phy_config_intr,
641655 }, {
drivers/net/usb/smsc95xx.c+2−0
@@ -1321,6 +1321,8 @@ static int smsc95xx_bind(struct usbnet *dev, struct usb_interface *intf) · 1320 unmodified lines
13211321 dev->net->ethtool_ops = &smsc95xx_ethtool_ops;
13221322 dev->net->flags |= IFF_MULTICAST;
13231323 dev->net->hard_header_len += SMSC95XX_TX_OVERHEAD_CSUM;
1324+ dev->net->min_mtu = ETH_MIN_MTU;
1325+ dev->net->max_mtu = ETH_DATA_LEN;
13241326 dev->hard_mtu = dev->net->mtu + dev->net->hard_header_len;
13251327
13261328 pdata->dev = dev;
net/core/flow_dissector.c+2−2
@@ -1166,8 +1166,8 @@ ip_proto_again: · 1165 unmodified lines
11661166 break;
11671167 }
11681168
1169− if (dissector_uses_key(flow_dissector,
1170− FLOW_DISSECTOR_KEY_PORTS)) {
1169+ if (dissector_uses_key(flow_dissector, FLOW_DISSECTOR_KEY_PORTS) &&
1170+ !(key_control->flags & FLOW_DIS_IS_FRAGMENT)) {
11711171 key_ports = skb_flow_dissector_target(flow_dissector,
11721172 FLOW_DISSECTOR_KEY_PORTS,
11731173 target_container);
net/ipv4/inet_fragment.c+15−14
@@ -178,21 +178,22 @@ static struct inet_frag_queue *inet_frag_alloc(struct netns_frags *nf, · 177 unmodified lines
178178 }
179179
180180 static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf,
181− void *arg)
181+ void *arg,
182+ struct inet_frag_queue **prev)
182183 {
183184 struct inet_frags *f = nf->f;
184185 struct inet_frag_queue *q;
185− int err;
186186
187187 q = inet_frag_alloc(nf, f, arg);
188− if (!q)
188+ if (!q) {
189+ *prev = ERR_PTR(-ENOMEM);
189190 return NULL;
190−
191+ }
191192 mod_timer(&q->timer, jiffies + nf->timeout);
192193
193− err = rhashtable_insert_fast(&nf->rhashtable, &q->node,
194− f->rhash_params);
195− if (err < 0) {
194+ *prev = rhashtable_lookup_get_insert_key(&nf->rhashtable, &q->key,
195+ &q->node, f->rhash_params);
196+ if (*prev) {
196197 q->flags |= INET_FRAG_COMPLETE;
197198 inet_frag_kill(q);
198199 inet_frag_destroy(q);
@@ -204,22 +205,22 @@ static struct inet_frag_queue *inet_frag_create(struct netns_frags *nf, · 5 unmodified lines
204205 /* TODO : call from rcu_read_lock() and no longer use refcount_inc_not_zero() */
205206 struct inet_frag_queue *inet_frag_find(struct netns_frags *nf, void *key)
206207 {
207− struct inet_frag_queue *fq;
208+ struct inet_frag_queue *fq = NULL, *prev;
208209
209210 if (!nf->high_thresh || frag_mem_limit(nf) > nf->high_thresh)
210211 return NULL;
211212
212213 rcu_read_lock();
213214
214− fq = rhashtable_lookup(&nf->rhashtable, key, nf->f->rhash_params);
215− if (fq) {
215+ prev = rhashtable_lookup(&nf->rhashtable, key, nf->f->rhash_params);
216+ if (!prev)
217+ fq = inet_frag_create(nf, key, &prev);
218+ if (prev && !IS_ERR(prev)) {
219+ fq = prev;
216220 if (!refcount_inc_not_zero(&fq->refcnt))
217221 fq = NULL;
218− rcu_read_unlock();
219− return fq;
220222 }
221223 rcu_read_unlock();
222−
223− return inet_frag_create(nf, key);
224+ return fq;
224225 }
225226 EXPORT_SYMBOL(inet_frag_find);
net/sched/act_mirred.c+2−1
@@ -258,7 +258,8 @@ static int tcf_mirred_act(struct sk_buff *skb, const struct tc_action *a, · 257 unmodified lines
258258 if (is_redirect) {
259259 skb2->tc_redirected = 1;
260260 skb2->tc_from_ingress = skb2->tc_at_ingress;
261−
261+ if (skb2->tc_from_ingress)
262+ skb2->tstamp = 0;
262263 /* let's the caller reinsert the packet, if possible */
263264 if (use_reinsert) {
264265 res->ingress = want_ingress;
net/sched/cls_flower.c+13−1
@@ -709,11 +709,23 @@ static int fl_set_enc_opt(struct nlattr **tb, struct fl_flow_key *key, · 708 unmodified lines
709709 struct netlink_ext_ack *extack)
710710 {
711711 const struct nlattr *nla_enc_key, *nla_opt_key, *nla_opt_msk = NULL;
712− int option_len, key_depth, msk_depth = 0;
712+ int err, option_len, key_depth, msk_depth = 0;
713+
714+ err = nla_validate_nested(tb[TCA_FLOWER_KEY_ENC_OPTS],
715+ TCA_FLOWER_KEY_ENC_OPTS_MAX,
716+ enc_opts_policy, extack);
717+ if (err)
718+ return err;
713719
714720 nla_enc_key = nla_data(tb[TCA_FLOWER_KEY_ENC_OPTS]);
715721
716722 if (tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]) {
723+ err = nla_validate_nested(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK],
724+ TCA_FLOWER_KEY_ENC_OPTS_MAX,
725+ enc_opts_policy, extack);
726+ if (err)
727+ return err;
728+
717729 nla_opt_msk = nla_data(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]);
718730 msk_depth = nla_len(tb[TCA_FLOWER_KEY_ENC_OPTS_MASK]);
719731 }
net/sched/sch_netem.c+0−9
@@ -648,15 +648,6 @@ deliver: · 647 unmodified lines
648648 */
649649 skb->dev = qdisc_dev(sch);
650650
651−#ifdef CONFIG_NET_CLS_ACT
652− /*
653− * If it's at ingress let's pretend the delay is
654− * from the network (tstamp will be updated).
655− */
656− if (skb->tc_redirected && skb->tc_from_ingress)
657− skb->tstamp = 0;
658−#endif
659−
660651 if (q->slot.slot_next) {
661652 q->slot.packets_left--;
662653 q->slot.bytes_left -= qdisc_pkt_len(skb);
net/tipc/link.c+7−4
@@ -1594,14 +1594,17 @@ static int tipc_link_proto_rcv(struct tipc_link *l, struct sk_buff *skb, · 1593 unmodified lines
15941594 if (in_range(peers_prio, l->priority + 1, TIPC_MAX_LINK_PRI))
15951595 l->priority = peers_prio;
15961596
1597− /* ACTIVATE_MSG serves as PEER_RESET if link is already down */
1598− if (msg_peer_stopping(hdr))
1597+ /* If peer is going down we want full re-establish cycle */
1598+ if (msg_peer_stopping(hdr)) {
15991599 rc = tipc_link_fsm_evt(l, LINK_FAILURE_EVT);
1600− else if ((mtyp == RESET_MSG) || !link_is_up(l))
1600+ break;
1601+ }
1602+ /* ACTIVATE_MSG serves as PEER_RESET if link is already down */
1603+ if (mtyp == RESET_MSG || !link_is_up(l))
16011604 rc = tipc_link_fsm_evt(l, LINK_PEER_RESET_EVT);
16021605
16031606 /* ACTIVATE_MSG takes up link if it was already locally reset */
1604− if ((mtyp == ACTIVATE_MSG) && (l->state == LINK_ESTABLISHING))
1607+ if (mtyp == ACTIVATE_MSG && l->state == LINK_ESTABLISHING)
16051608 rc = TIPC_LINK_UP_EVT;
16061609
16071610 l->peer_session = msg_session(hdr);