Re: [PATCH net-next v3 1/2] net: hsr: Fix PRP duplicate detection

From: Paolo Abeni
Date: Tue Mar 04 2025 - 04:37:31 EST


On 2/27/25 6:09 AM, Jaakko Karrenpalo wrote:
> +int prp_register_frame_out(struct hsr_port *port, struct hsr_frame_info *frame)
> +{
> + enum hsr_port_type other_port;
> + enum hsr_port_type rcv_port;
> + struct hsr_node *node;
> + u16 sequence_diff;
> + u16 sequence_exp;
> + u16 sequence_nr;
> +
> + /* out-going frames are always in order
> + *and can be checked the same way as for HSR
> + */
> + if (frame->port_rcv->type == HSR_PT_MASTER)
> + return hsr_register_frame_out(port, frame);
> +
> + /* for PRP we should only forward frames from the slave ports
> + * to the master port
> + */
> + if (port->type != HSR_PT_MASTER)
> + return 1;
> +
> + node = frame->node_src;
> + sequence_nr = frame->sequence_nr;
> + sequence_exp = sequence_nr + 1;
> + rcv_port = frame->port_rcv->type;
> + other_port =
> + rcv_port == HSR_PT_SLAVE_A ? HSR_PT_SLAVE_B : HSR_PT_SLAVE_A;

I'm again surprised checkpatch did not complain WRT the above. Please
reformat it as:

other_port = rcv_port == HSR_PT_SLAVE_A ? HSR_PT_SLAVE_B :
HSR_PT_SLAVE_A;

Also, please address the other things mentioned by Simon.

Note: you can retain Simon's tag in next iteration.

Thanks,

Paolo