Skip to content

Commit d5c7652

Browse files
Sebastian Andrzej Siewiorkuba-moo
authored andcommitted
hsr: Disable netpoll.
The hsr device is a software device. Its net_device_ops::ndo_start_xmit() routine will process the packet and then pass the resulting skb to dev_queue_xmit(). During processing, hsr acquires a lock with spin_lock_bh() (hsr_add_node()) which needs to be promoted to the _irq() suffix in order to avoid a potential deadlock. Then there are the warnings in dev_queue_xmit() (due to local_bh_disable() with disabled interrupts) left. Instead trying to address those (there is qdisc and…) for netpoll sake, just disable netpoll on hsr. Disable netpoll on hsr and replace the _irqsave() locking with _bh(). Fixes: f421436 ("net/hsr: Add support for the High-availability Seamless Redundancy protocol (HSRv0)") Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0c74d9f commit d5c7652

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

net/hsr/hsr_device.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,6 @@ static void send_hsr_supervision_frame(struct hsr_port *master,
278278
__u8 type = HSR_TLV_LIFE_CHECK;
279279
struct hsr_sup_payload *hsr_sp;
280280
struct hsr_sup_tag *hsr_stag;
281-
unsigned long irqflags;
282281
struct sk_buff *skb;
283282

284283
*interval = msecs_to_jiffies(HSR_LIFE_CHECK_INTERVAL);
@@ -299,15 +298,15 @@ static void send_hsr_supervision_frame(struct hsr_port *master,
299298
set_hsr_stag_HSR_ver(hsr_stag, hsr->prot_version);
300299

301300
/* From HSRv1 on we have separate supervision sequence numbers. */
302-
spin_lock_irqsave(&master->hsr->seqnr_lock, irqflags);
301+
spin_lock_bh(&hsr->seqnr_lock);
303302
if (hsr->prot_version > 0) {
304303
hsr_stag->sequence_nr = htons(hsr->sup_sequence_nr);
305304
hsr->sup_sequence_nr++;
306305
} else {
307306
hsr_stag->sequence_nr = htons(hsr->sequence_nr);
308307
hsr->sequence_nr++;
309308
}
310-
spin_unlock_irqrestore(&master->hsr->seqnr_lock, irqflags);
309+
spin_unlock_bh(&hsr->seqnr_lock);
311310

312311
hsr_stag->tlv.HSR_TLV_type = type;
313312
/* TODO: Why 12 in HSRv0? */
@@ -332,7 +331,6 @@ static void send_prp_supervision_frame(struct hsr_port *master,
332331
struct hsr_priv *hsr = master->hsr;
333332
struct hsr_sup_payload *hsr_sp;
334333
struct hsr_sup_tag *hsr_stag;
335-
unsigned long irqflags;
336334
struct sk_buff *skb;
337335

338336
skb = hsr_init_skb(master);
@@ -347,7 +345,7 @@ static void send_prp_supervision_frame(struct hsr_port *master,
347345
set_hsr_stag_HSR_ver(hsr_stag, (hsr->prot_version ? 1 : 0));
348346

349347
/* From HSRv1 on we have separate supervision sequence numbers. */
350-
spin_lock_irqsave(&master->hsr->seqnr_lock, irqflags);
348+
spin_lock_bh(&hsr->seqnr_lock);
351349
hsr_stag->sequence_nr = htons(hsr->sup_sequence_nr);
352350
hsr->sup_sequence_nr++;
353351
hsr_stag->tlv.HSR_TLV_type = PRP_TLV_LIFE_CHECK_DD;
@@ -358,11 +356,11 @@ static void send_prp_supervision_frame(struct hsr_port *master,
358356
ether_addr_copy(hsr_sp->macaddress_A, master->dev->dev_addr);
359357

360358
if (skb_put_padto(skb, ETH_ZLEN)) {
361-
spin_unlock_irqrestore(&master->hsr->seqnr_lock, irqflags);
359+
spin_unlock_bh(&hsr->seqnr_lock);
362360
return;
363361
}
364362

365-
spin_unlock_irqrestore(&master->hsr->seqnr_lock, irqflags);
363+
spin_unlock_bh(&hsr->seqnr_lock);
366364

367365
hsr_forward_skb(skb, master);
368366
}
@@ -444,7 +442,7 @@ void hsr_dev_setup(struct net_device *dev)
444442
dev->header_ops = &hsr_header_ops;
445443
dev->netdev_ops = &hsr_device_ops;
446444
SET_NETDEV_DEVTYPE(dev, &hsr_type);
447-
dev->priv_flags |= IFF_NO_QUEUE;
445+
dev->priv_flags |= IFF_NO_QUEUE | IFF_DISABLE_NETPOLL;
448446

449447
dev->needs_free_netdev = true;
450448

net/hsr/hsr_forward.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,6 @@ static void handle_std_frame(struct sk_buff *skb,
500500
{
501501
struct hsr_port *port = frame->port_rcv;
502502
struct hsr_priv *hsr = port->hsr;
503-
unsigned long irqflags;
504503

505504
frame->skb_hsr = NULL;
506505
frame->skb_prp = NULL;
@@ -510,10 +509,10 @@ static void handle_std_frame(struct sk_buff *skb,
510509
frame->is_from_san = true;
511510
} else {
512511
/* Sequence nr for the master node */
513-
spin_lock_irqsave(&hsr->seqnr_lock, irqflags);
512+
spin_lock_bh(&hsr->seqnr_lock);
514513
frame->sequence_nr = hsr->sequence_nr;
515514
hsr->sequence_nr++;
516-
spin_unlock_irqrestore(&hsr->seqnr_lock, irqflags);
515+
spin_unlock_bh(&hsr->seqnr_lock);
517516
}
518517
}
519518

0 commit comments

Comments
 (0)