Skip to content

Commit b395456

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) Use after free in vlan, from Cong Wang. 2) Handle NAPI poll with a zero budget properly in mlx5 driver, from Saeed Mahameed. 3) If DMA mapping fails in mlx5 driver, NULL out page, from Inbar Karmy. 4) Handle overrun in RX FIFO of sun4i CAN driver, from Gerhard Bertelsmann. 5) Missing return in mdb and vlan prepare phase of DSA layer, from Vivien Didelot. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: vlan: fix a use-after-free in vlan_device_event() net: dsa: return after vlan prepare phase net: dsa: return after mdb prepare phase can: ifi: Fix transmitter delay calculation tcp: fix tcp_fastretrans_alert warning tcp: gso: avoid refcount_t warning from tcp_gso_segment() can: peak: Add support for new PCIe/M2 CAN FD interfaces can: sun4i: handle overrun in RX FIFO can: c_can: don't indicate triple sampling support for D_CAN net/mlx5e: Increase Striding RQ minimum size limit to 4 multi-packet WQEs net/mlx5e: Set page to null in case dma mapping fails net/mlx5e: Fix napi poll with zero budget net/mlx5: Cancel health poll before sending panic teardown command net/mlx5: Loop over temp list to release delay events rds: ib: Fix NULL pointer dereference in debug code
2 parents ca91659 + 92d2882 commit b395456

File tree

15 files changed

+68
-34
lines changed

15 files changed

+68
-34
lines changed

drivers/net/can/c_can/c_can_pci.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ static int c_can_pci_probe(struct pci_dev *pdev,
178178
break;
179179
case BOSCH_D_CAN:
180180
priv->regs = reg_map_d_can;
181-
priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
182181
break;
183182
default:
184183
ret = -EINVAL;

drivers/net/can/c_can/c_can_platform.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ static int c_can_plat_probe(struct platform_device *pdev)
320320
break;
321321
case BOSCH_D_CAN:
322322
priv->regs = reg_map_d_can;
323-
priv->can.ctrlmode_supported |= CAN_CTRLMODE_3_SAMPLES;
324323
priv->read_reg = c_can_plat_read_reg_aligned_to_16bit;
325324
priv->write_reg = c_can_plat_write_reg_aligned_to_16bit;
326325
priv->read_reg32 = d_can_plat_read_reg32;

drivers/net/can/ifi_canfd/ifi_canfd.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -670,9 +670,9 @@ static void ifi_canfd_set_bittiming(struct net_device *ndev)
670670
priv->base + IFI_CANFD_FTIME);
671671

672672
/* Configure transmitter delay */
673-
tdc = (dbt->brp * (dbt->phase_seg1 + 1)) & IFI_CANFD_TDELAY_MASK;
674-
writel(IFI_CANFD_TDELAY_EN | IFI_CANFD_TDELAY_ABS | tdc,
675-
priv->base + IFI_CANFD_TDELAY);
673+
tdc = dbt->brp * (dbt->prop_seg + dbt->phase_seg1);
674+
tdc &= IFI_CANFD_TDELAY_MASK;
675+
writel(IFI_CANFD_TDELAY_EN | tdc, priv->base + IFI_CANFD_TDELAY);
676676
}
677677

678678
static void ifi_canfd_set_filter(struct net_device *ndev, const u32 id,

drivers/net/can/peak_canfd/peak_pciefd_main.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,19 @@
2929
#include "peak_canfd_user.h"
3030

3131
MODULE_AUTHOR("Stephane Grosjean <[email protected]>");
32-
MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCIe FD family cards");
33-
MODULE_SUPPORTED_DEVICE("PEAK PCAN PCIe FD CAN cards");
32+
MODULE_DESCRIPTION("Socket-CAN driver for PEAK PCAN PCIe/M.2 FD family cards");
33+
MODULE_SUPPORTED_DEVICE("PEAK PCAN PCIe/M.2 FD CAN cards");
3434
MODULE_LICENSE("GPL v2");
3535

3636
#define PCIEFD_DRV_NAME "peak_pciefd"
3737

3838
#define PEAK_PCI_VENDOR_ID 0x001c /* The PCI device and vendor IDs */
3939
#define PEAK_PCIEFD_ID 0x0013 /* for PCIe slot cards */
40+
#define PCAN_CPCIEFD_ID 0x0014 /* for Compact-PCI Serial slot cards */
41+
#define PCAN_PCIE104FD_ID 0x0017 /* for PCIe-104 Express slot cards */
42+
#define PCAN_MINIPCIEFD_ID 0x0018 /* for mini-PCIe slot cards */
43+
#define PCAN_PCIEFD_OEM_ID 0x0019 /* for PCIe slot OEM cards */
44+
#define PCAN_M2_ID 0x001a /* for M2 slot cards */
4045

4146
/* PEAK PCIe board access description */
4247
#define PCIEFD_BAR0_SIZE (64 * 1024)
@@ -203,6 +208,11 @@ struct pciefd_board {
203208
/* supported device ids. */
204209
static const struct pci_device_id peak_pciefd_tbl[] = {
205210
{PEAK_PCI_VENDOR_ID, PEAK_PCIEFD_ID, PCI_ANY_ID, PCI_ANY_ID,},
211+
{PEAK_PCI_VENDOR_ID, PCAN_CPCIEFD_ID, PCI_ANY_ID, PCI_ANY_ID,},
212+
{PEAK_PCI_VENDOR_ID, PCAN_PCIE104FD_ID, PCI_ANY_ID, PCI_ANY_ID,},
213+
{PEAK_PCI_VENDOR_ID, PCAN_MINIPCIEFD_ID, PCI_ANY_ID, PCI_ANY_ID,},
214+
{PEAK_PCI_VENDOR_ID, PCAN_PCIEFD_OEM_ID, PCI_ANY_ID, PCI_ANY_ID,},
215+
{PEAK_PCI_VENDOR_ID, PCAN_M2_ID, PCI_ANY_ID, PCI_ANY_ID,},
206216
{0,}
207217
};
208218

drivers/net/can/sun4i_can.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,13 @@ static int sun4i_can_err(struct net_device *dev, u8 isrc, u8 status)
539539
}
540540
stats->rx_over_errors++;
541541
stats->rx_errors++;
542+
543+
/* reset the CAN IP by entering reset mode
544+
* ignoring timeout error
545+
*/
546+
set_reset_mode(dev);
547+
set_normal_mode(dev);
548+
542549
/* clear bit */
543550
sun4i_can_write_cmdreg(priv, SUN4I_CMD_CLEAR_OR_FLAG);
544551
}
@@ -653,8 +660,9 @@ static irqreturn_t sun4i_can_interrupt(int irq, void *dev_id)
653660
netif_wake_queue(dev);
654661
can_led_event(dev, CAN_LED_EVENT_TX);
655662
}
656-
if (isrc & SUN4I_INT_RBUF_VLD) {
657-
/* receive interrupt */
663+
if ((isrc & SUN4I_INT_RBUF_VLD) &&
664+
!(isrc & SUN4I_INT_DATA_OR)) {
665+
/* receive interrupt - don't read if overrun occurred */
658666
while (status & SUN4I_STA_RBUF_RDY) {
659667
/* RX buffer is not empty */
660668
sun4i_can_rx(dev);

drivers/net/ethernet/mellanox/mlx5/core/dev.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ static void delayed_event_release(struct mlx5_device_context *dev_ctx,
9393
list_splice_init(&priv->waiting_events_list, &temp);
9494
if (!dev_ctx->context)
9595
goto out;
96-
list_for_each_entry_safe(de, n, &priv->waiting_events_list, list)
96+
list_for_each_entry_safe(de, n, &temp, list)
9797
dev_ctx->intf->event(dev, dev_ctx->context, de->event, de->param);
9898

9999
out:

drivers/net/ethernet/mellanox/mlx5/core/en.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
#define MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE 0xa
6868
#define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE 0xd
6969

70-
#define MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE_MPW 0x1
70+
#define MLX5E_PARAMS_MINIMUM_LOG_RQ_SIZE_MPW 0x2
7171
#define MLX5E_PARAMS_DEFAULT_LOG_RQ_SIZE_MPW 0x3
7272
#define MLX5E_PARAMS_MAXIMUM_LOG_RQ_SIZE_MPW 0x6
7373

drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -215,22 +215,20 @@ static inline bool mlx5e_rx_cache_get(struct mlx5e_rq *rq,
215215
static inline int mlx5e_page_alloc_mapped(struct mlx5e_rq *rq,
216216
struct mlx5e_dma_info *dma_info)
217217
{
218-
struct page *page;
219-
220218
if (mlx5e_rx_cache_get(rq, dma_info))
221219
return 0;
222220

223-
page = dev_alloc_pages(rq->buff.page_order);
224-
if (unlikely(!page))
221+
dma_info->page = dev_alloc_pages(rq->buff.page_order);
222+
if (unlikely(!dma_info->page))
225223
return -ENOMEM;
226224

227-
dma_info->addr = dma_map_page(rq->pdev, page, 0,
225+
dma_info->addr = dma_map_page(rq->pdev, dma_info->page, 0,
228226
RQ_PAGE_SIZE(rq), rq->buff.map_dir);
229227
if (unlikely(dma_mapping_error(rq->pdev, dma_info->addr))) {
230-
put_page(page);
228+
put_page(dma_info->page);
229+
dma_info->page = NULL;
231230
return -ENOMEM;
232231
}
233-
dma_info->page = page;
234232

235233
return 0;
236234
}

drivers/net/ethernet/mellanox/mlx5/core/en_txrx.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
4949
struct mlx5e_channel *c = container_of(napi, struct mlx5e_channel,
5050
napi);
5151
bool busy = false;
52-
int work_done;
52+
int work_done = 0;
5353
int i;
5454

5555
for (i = 0; i < c->num_tc; i++)
@@ -58,15 +58,17 @@ int mlx5e_napi_poll(struct napi_struct *napi, int budget)
5858
if (c->xdp)
5959
busy |= mlx5e_poll_xdpsq_cq(&c->rq.xdpsq.cq);
6060

61-
work_done = mlx5e_poll_rx_cq(&c->rq.cq, budget);
62-
busy |= work_done == budget;
61+
if (likely(budget)) { /* budget=0 means: don't poll rx rings */
62+
work_done = mlx5e_poll_rx_cq(&c->rq.cq, budget);
63+
busy |= work_done == budget;
64+
}
6365

6466
busy |= c->rq.post_wqes(&c->rq);
6567

6668
if (busy) {
6769
if (likely(mlx5e_channel_no_affinity_change(c)))
6870
return budget;
69-
if (work_done == budget)
71+
if (budget && work_done == budget)
7072
work_done--;
7173
}
7274

drivers/net/ethernet/mellanox/mlx5/core/main.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,9 +1482,16 @@ static int mlx5_try_fast_unload(struct mlx5_core_dev *dev)
14821482
return -EAGAIN;
14831483
}
14841484

1485+
/* Panic tear down fw command will stop the PCI bus communication
1486+
* with the HCA, so the health polll is no longer needed.
1487+
*/
1488+
mlx5_drain_health_wq(dev);
1489+
mlx5_stop_health_poll(dev);
1490+
14851491
ret = mlx5_cmd_force_teardown_hca(dev);
14861492
if (ret) {
14871493
mlx5_core_dbg(dev, "Firmware couldn't do fast unload error: %d\n", ret);
1494+
mlx5_start_health_poll(dev);
14881495
return ret;
14891496
}
14901497

0 commit comments

Comments
 (0)