Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
Commit 772bcadb authored by WingMan Kwok's avatar WingMan Kwok Committed by Lokesh Vutla
Browse files

net: hsr: save tx_flags and tag info of tagged skb


After a tag is created for an egress skb, the tag info and slave port
info is saved in the skb's shared info area so that the saved info can
be returned to user space application by upper core layer.

In this patch, only the support of saving HSR tag info of HSR PTP
over L2 skb is added.

Signed-off-by: default avatarWingMan Kwok <w-kwok2@ti.com>
Signed-off-by: default avatarMurali Karicheri <m-karicheri2@ti.com>
Signed-off-by: default avatarLokesh Vutla <lokeshvutla@ti.com>
parent 47792542
Branches
Tags
No related merge requests found
......@@ -31,6 +31,16 @@ struct hsr_frame_info {
bool is_from_san;
};
static inline int is_hsr_l2ptp(struct sk_buff *skb)
{
struct hsr_ethhdr *hsr_ethhdr;
hsr_ethhdr = (struct hsr_ethhdr *)skb_mac_header(skb);
return (hsr_ethhdr->ethhdr.h_proto == htons(ETH_P_HSR) &&
hsr_ethhdr->hsr_tag.encap_proto == htons(ETH_P_1588));
}
/* The uses I can see for these HSR supervision frames are:
* 1) Use the frames that are sent after node initialization ("HSR_TLV.Type =
* 22") to reset any sequence_nr counters belonging to that node. Useful if
......@@ -289,6 +299,9 @@ static struct sk_buff *create_tagged_skb(struct sk_buff *skb_o,
int movelen;
unsigned char *dst, *src;
struct sk_buff *skb;
struct skb_redundant_info *sred;
struct hsr_ethhdr *hsr_ethhdr;
u16 s;
if (port->hsr->prot_version > HSR_V1) {
skb = skb_copy_expand(skb_o, skb_headroom(skb_o),
......@@ -321,6 +334,22 @@ static struct sk_buff *create_tagged_skb(struct sk_buff *skb_o,
hsr_fill_tag(skb, frame, port, port->hsr->prot_version);
skb_shinfo(skb)->tx_flags = skb_shinfo(skb_o)->tx_flags;
skb->sk = skb_o->sk;
/* TODO: should check socket option instead? */
if (is_hsr_l2ptp(skb)) {
sred = skb_redinfo(skb);
/* assumes no vlan */
hsr_ethhdr = (struct hsr_ethhdr *)skb_mac_header(skb);
sred->io_port = port->type;
sred->ethertype = ntohs(hsr_ethhdr->ethhdr.h_proto);
s = ntohs(hsr_ethhdr->hsr_tag.path_and_LSDU_size);
sred->lsdu_size = s & 0xfff;
sred->pathid = (s >> 12) & 0xf;
sred->seqnr = hsr_get_skb_sequence_nr(skb);
}
return skb;
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment