Lines Matching full:frame

7  * Frame router for HSR and PRP.
25 * Or not - resetting the counter and bridging the frame would create a
29 * frame is received from a particular node, we know something is wrong.
93 /* if this is a redbox supervision frame we need to verify in is_supervision_frame()
143 * frame with MAC addresses from own ProxyNodeTable. in is_proxy_supervision_frame()
150 struct hsr_frame_info *frame) in create_stripped_skb_hsr() argument
168 if (frame->is_vlan) in create_stripped_skb_hsr()
178 struct sk_buff *hsr_get_untagged_frame(struct hsr_frame_info *frame, in hsr_get_untagged_frame() argument
181 if (!frame->skb_std) { in hsr_get_untagged_frame()
182 if (frame->skb_hsr) in hsr_get_untagged_frame()
183 frame->skb_std = in hsr_get_untagged_frame()
184 create_stripped_skb_hsr(frame->skb_hsr, frame); in hsr_get_untagged_frame()
187 "Unexpected frame received in hsr_get_untagged_frame()\n"); in hsr_get_untagged_frame()
189 if (!frame->skb_std) in hsr_get_untagged_frame()
193 return skb_clone(frame->skb_std, GFP_ATOMIC); in hsr_get_untagged_frame()
196 struct sk_buff *prp_get_untagged_frame(struct hsr_frame_info *frame, in prp_get_untagged_frame() argument
199 if (!frame->skb_std) { in prp_get_untagged_frame()
200 if (frame->skb_prp) { in prp_get_untagged_frame()
202 skb_trim(frame->skb_prp, in prp_get_untagged_frame()
203 frame->skb_prp->len - HSR_HLEN); in prp_get_untagged_frame()
204 frame->skb_std = in prp_get_untagged_frame()
205 __pskb_copy(frame->skb_prp, in prp_get_untagged_frame()
206 skb_headroom(frame->skb_prp), in prp_get_untagged_frame()
210 WARN_ONCE(1, "%s:%d: Unexpected frame received (port_src %s)\n", in prp_get_untagged_frame()
216 return skb_clone(frame->skb_std, GFP_ATOMIC); in prp_get_untagged_frame()
236 struct hsr_frame_info *frame, in prp_fill_rct() argument
246 if (frame->is_vlan) in prp_fill_rct()
254 if (frame->is_vlan) in prp_fill_rct()
258 trailer->sequence_nr = htons(frame->sequence_nr); in prp_fill_rct()
279 struct hsr_frame_info *frame, in hsr_fill_tag() argument
290 if (frame->is_vlan) in hsr_fill_tag()
297 hsr_ethhdr->hsr_tag.sequence_nr = htons(frame->sequence_nr); in hsr_fill_tag()
306 /* If the original frame was an HSR tagged frame, just clone it to be sent
307 * unchanged. Otherwise, create a private frame especially tagged for 'port'.
309 struct sk_buff *hsr_create_tagged_frame(struct hsr_frame_info *frame, in hsr_create_tagged_frame() argument
316 if (frame->skb_hsr) { in hsr_create_tagged_frame()
318 (struct hsr_ethhdr *)skb_mac_header(frame->skb_hsr); in hsr_create_tagged_frame()
322 return skb_clone(frame->skb_hsr, GFP_ATOMIC); in hsr_create_tagged_frame()
324 return skb_clone(frame->skb_std, GFP_ATOMIC); in hsr_create_tagged_frame()
328 skb = __pskb_copy(frame->skb_std, in hsr_create_tagged_frame()
329 skb_headroom(frame->skb_std) + HSR_HLEN, GFP_ATOMIC); in hsr_create_tagged_frame()
338 if (frame->is_vlan) in hsr_create_tagged_frame()
349 return hsr_fill_tag(skb, frame, port, port->hsr->prot_version); in hsr_create_tagged_frame()
352 struct sk_buff *prp_create_tagged_frame(struct hsr_frame_info *frame, in prp_create_tagged_frame() argument
357 if (frame->skb_prp) { in prp_create_tagged_frame()
358 struct prp_rct *trailer = skb_get_PRP_rct(frame->skb_prp); in prp_create_tagged_frame()
366 return skb_clone(frame->skb_prp, GFP_ATOMIC); in prp_create_tagged_frame()
368 return skb_clone(frame->skb_std, GFP_ATOMIC); in prp_create_tagged_frame()
371 skb = skb_copy_expand(frame->skb_std, 0, in prp_create_tagged_frame()
372 skb_tailroom(frame->skb_std) + HSR_HLEN, in prp_create_tagged_frame()
374 return prp_fill_rct(skb, frame, port); in prp_create_tagged_frame()
399 struct hsr_frame_info *frame) in hsr_xmit() argument
401 if (frame->port_rcv->type == HSR_PT_MASTER) { in hsr_xmit()
402 hsr_addr_subst_dest(frame->node_src, skb, port); in hsr_xmit()
405 * address of outgoing frame with that of the outgoing slave's. in hsr_xmit()
410 /* When HSR node is used as RedBox - the frame received from HSR ring in hsr_xmit()
421 bool prp_drop_frame(struct hsr_frame_info *frame, struct hsr_port *port) in prp_drop_frame() argument
423 return ((frame->port_rcv->type == HSR_PT_SLAVE_A && in prp_drop_frame()
425 (frame->port_rcv->type == HSR_PT_SLAVE_B && in prp_drop_frame()
429 bool hsr_drop_frame(struct hsr_frame_info *frame, struct hsr_port *port) in hsr_drop_frame() argument
434 return prp_drop_frame(frame, port); in hsr_drop_frame()
440 if (frame->is_supervision && port->type == HSR_PT_INTERLINK) in hsr_drop_frame()
446 skb = frame->skb_hsr; in hsr_drop_frame()
447 if (skb && prp_drop_frame(frame, port) && in hsr_drop_frame()
457 if ((frame->port_rcv->type == HSR_PT_SLAVE_A || in hsr_drop_frame()
458 frame->port_rcv->type == HSR_PT_SLAVE_B) && in hsr_drop_frame()
460 skb = frame->skb_hsr; in hsr_drop_frame()
473 frame->port_rcv->type == HSR_PT_INTERLINK) { in hsr_drop_frame()
474 skb = frame->skb_std; in hsr_drop_frame()
485 /* Forward the frame through all devices except:
487 * - If it's a HSR frame: through a device where it has passed before
488 * - if it's a PRP frame: through another PRP slave device (no bridge)
489 * - To the local HSR master only if the frame is directly addressed to it, or
490 * a non-supervision multicast or broadcast frame.
492 * HSR slave devices should insert a HSR tag into the frame, or forward the
493 * frame unchanged if it's already tagged. Interlink devices should strip HSR
497 static void hsr_forward_do(struct hsr_frame_info *frame) in hsr_forward_do() argument
503 hsr_for_each_port(frame->port_rcv->hsr, port) { in hsr_forward_do()
505 /* Don't send frame back the way it came */ in hsr_forward_do()
506 if (port == frame->port_rcv) in hsr_forward_do()
510 if (port->type == HSR_PT_MASTER && !frame->is_local_dest) in hsr_forward_do()
514 if (port->type != HSR_PT_MASTER && frame->is_local_exclusive) in hsr_forward_do()
523 /* Don't send frame over port where it has been sent before. in hsr_forward_do()
526 if (!frame->is_from_san && in hsr_forward_do()
527 hsr_register_frame_out(port, frame->node_src, in hsr_forward_do()
528 frame->sequence_nr)) in hsr_forward_do()
531 if (frame->is_supervision && port->type == HSR_PT_MASTER && in hsr_forward_do()
532 !frame->is_proxy_supervision) { in hsr_forward_do()
533 hsr_handle_sup_frame(frame); in hsr_forward_do()
537 /* Check if frame is to be dropped. Eg. for PRP no forward in hsr_forward_do()
541 hsr->proto_ops->drop_frame(frame, port)) in hsr_forward_do()
546 skb = hsr->proto_ops->create_tagged_frame(frame, port); in hsr_forward_do()
548 skb = hsr->proto_ops->get_untagged_frame(frame, port); in hsr_forward_do()
551 frame->port_rcv->dev->stats.rx_dropped++; in hsr_forward_do()
557 hsr_deliver_master(skb, port->dev, frame->node_src); in hsr_forward_do()
559 if (!hsr_xmit(skb, port, frame)) in hsr_forward_do()
568 struct hsr_frame_info *frame) in check_local_dest() argument
571 frame->is_local_exclusive = true; in check_local_dest()
574 frame->is_local_exclusive = false; in check_local_dest()
580 frame->is_local_dest = true; in check_local_dest()
582 frame->is_local_dest = false; in check_local_dest()
587 struct hsr_frame_info *frame) in handle_std_frame() argument
589 struct hsr_port *port = frame->port_rcv; in handle_std_frame()
592 frame->skb_hsr = NULL; in handle_std_frame()
593 frame->skb_prp = NULL; in handle_std_frame()
594 frame->skb_std = skb; in handle_std_frame()
597 frame->is_from_san = true; in handle_std_frame()
603 frame->sequence_nr = hsr->sequence_nr; in handle_std_frame()
609 struct hsr_frame_info *frame) in hsr_fill_frame_info() argument
611 struct hsr_port *port = frame->port_rcv; in hsr_fill_frame_info()
621 /* HSR tagged frame :- Data or Supervision */ in hsr_fill_frame_info()
622 frame->skb_std = NULL; in hsr_fill_frame_info()
623 frame->skb_prp = NULL; in hsr_fill_frame_info()
624 frame->skb_hsr = skb; in hsr_fill_frame_info()
625 frame->sequence_nr = hsr_get_skb_sequence_nr(skb); in hsr_fill_frame_info()
629 /* Standard frame or PRP from master port */ in hsr_fill_frame_info()
630 handle_std_frame(skb, frame); in hsr_fill_frame_info()
636 struct hsr_frame_info *frame) in prp_fill_frame_info() argument
638 /* Supervision frame */ in prp_fill_frame_info()
642 prp_check_lsdu_size(skb, rct, frame->is_supervision)) { in prp_fill_frame_info()
643 frame->skb_hsr = NULL; in prp_fill_frame_info()
644 frame->skb_std = NULL; in prp_fill_frame_info()
645 frame->skb_prp = skb; in prp_fill_frame_info()
646 frame->sequence_nr = prp_get_skb_sequence_nr(rct); in prp_fill_frame_info()
649 handle_std_frame(skb, frame); in prp_fill_frame_info()
654 static int fill_frame_info(struct hsr_frame_info *frame, in fill_frame_info() argument
668 memset(frame, 0, sizeof(*frame)); in fill_frame_info()
669 frame->is_supervision = is_supervision_frame(port->hsr, skb); in fill_frame_info()
670 if (frame->is_supervision && hsr->redbox) in fill_frame_info()
671 frame->is_proxy_supervision = in fill_frame_info()
678 frame->node_src = hsr_get_node(port, n_db, skb, in fill_frame_info()
679 frame->is_supervision, port->type); in fill_frame_info()
680 if (!frame->node_src) in fill_frame_info()
684 frame->is_vlan = false; in fill_frame_info()
688 frame->is_vlan = true; in fill_frame_info()
690 if (frame->is_vlan) { in fill_frame_info()
698 frame->is_from_san = false; in fill_frame_info()
699 frame->port_rcv = port; in fill_frame_info()
700 ret = hsr->proto_ops->fill_frame_info(proto, skb, frame); in fill_frame_info()
704 check_local_dest(port->hsr, skb, frame); in fill_frame_info()
712 struct hsr_frame_info frame; in hsr_forward_skb() local
715 if (fill_frame_info(&frame, skb, port) < 0) in hsr_forward_skb()
718 hsr_register_frame_in(frame.node_src, port, frame.sequence_nr); in hsr_forward_skb()
719 hsr_forward_do(&frame); in hsr_forward_skb()
729 kfree_skb(frame.skb_hsr); in hsr_forward_skb()
730 kfree_skb(frame.skb_prp); in hsr_forward_skb()
731 kfree_skb(frame.skb_std); in hsr_forward_skb()