Skip to content

Commit 8b5d2e5

Browse files
committed
Merge branch 'net-hsr-use-the-seqnr-lock-for-frames-received-via-interlink-port'
Sebastian Andrzej Siewior says: ==================== net: hsr: Use the seqnr lock for frames received via interlink port. This is follow-up to the thread at https://lore.kernel.org/all/[email protected]/ ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents a18c097 + 35e24f2 commit 8b5d2e5

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

net/hsr/hsr_device.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,6 @@ int hsr_dev_finalize(struct net_device *hsr_dev, struct net_device *slave[2],
625625
/* Overflow soon to find bugs easier: */
626626
hsr->sequence_nr = HSR_SEQNR_START;
627627
hsr->sup_sequence_nr = HSR_SUP_SEQNR_START;
628-
hsr->interlink_sequence_nr = HSR_SEQNR_START;
629628

630629
timer_setup(&hsr->announce_timer, hsr_announce, 0);
631630
timer_setup(&hsr->prune_timer, hsr_prune_nodes, 0);

net/hsr/hsr_main.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,6 @@ struct hsr_priv {
203203
struct timer_list prune_proxy_timer;
204204
int announce_count;
205205
u16 sequence_nr;
206-
u16 interlink_sequence_nr; /* Interlink port seq_nr */
207206
u16 sup_sequence_nr; /* For HSRv1 separate seq_nr for supervision */
208207
enum hsr_version prot_version; /* Indicate if HSRv0, HSRv1 or PRPv1 */
209208
spinlock_t seqnr_lock; /* locking for sequence_nr */

net/hsr/hsr_slave.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,16 @@ static rx_handler_result_t hsr_handle_frame(struct sk_buff **pskb)
6767
skb_set_network_header(skb, ETH_HLEN + HSR_HLEN);
6868
skb_reset_mac_len(skb);
6969

70-
hsr_forward_skb(skb, port);
70+
/* Only the frames received over the interlink port will assign a
71+
* sequence number and require synchronisation vs other sender.
72+
*/
73+
if (port->type == HSR_PT_INTERLINK) {
74+
spin_lock_bh(&hsr->seqnr_lock);
75+
hsr_forward_skb(skb, port);
76+
spin_unlock_bh(&hsr->seqnr_lock);
77+
} else {
78+
hsr_forward_skb(skb, port);
79+
}
7180

7281
finish_consume:
7382
return RX_HANDLER_CONSUMED;

0 commit comments

Comments
 (0)