mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-07 15:01:44 +00:00
openvswitch: support MPLS push and pop for L3 packets
Update Ethernet header only if there is one. Signed-off-by: Jiri Benc <jbenc@redhat.com> Acked-by: Pravin B Shelar <pshelar@ovn.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
e2d9d8358c
commit
1560a074df
1 changed files with 11 additions and 7 deletions
|
@ -187,7 +187,8 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key,
|
||||||
|
|
||||||
skb_postpush_rcsum(skb, new_mpls_lse, MPLS_HLEN);
|
skb_postpush_rcsum(skb, new_mpls_lse, MPLS_HLEN);
|
||||||
|
|
||||||
update_ethertype(skb, eth_hdr(skb), mpls->mpls_ethertype);
|
if (ovs_key_mac_proto(key) == MAC_PROTO_ETHERNET)
|
||||||
|
update_ethertype(skb, eth_hdr(skb), mpls->mpls_ethertype);
|
||||||
skb->protocol = mpls->mpls_ethertype;
|
skb->protocol = mpls->mpls_ethertype;
|
||||||
|
|
||||||
invalidate_flow_key(key);
|
invalidate_flow_key(key);
|
||||||
|
@ -197,7 +198,6 @@ static int push_mpls(struct sk_buff *skb, struct sw_flow_key *key,
|
||||||
static int pop_mpls(struct sk_buff *skb, struct sw_flow_key *key,
|
static int pop_mpls(struct sk_buff *skb, struct sw_flow_key *key,
|
||||||
const __be16 ethertype)
|
const __be16 ethertype)
|
||||||
{
|
{
|
||||||
struct ethhdr *hdr;
|
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
err = skb_ensure_writable(skb, skb->mac_len + MPLS_HLEN);
|
err = skb_ensure_writable(skb, skb->mac_len + MPLS_HLEN);
|
||||||
|
@ -213,11 +213,15 @@ static int pop_mpls(struct sk_buff *skb, struct sw_flow_key *key,
|
||||||
skb_reset_mac_header(skb);
|
skb_reset_mac_header(skb);
|
||||||
skb_set_network_header(skb, skb->mac_len);
|
skb_set_network_header(skb, skb->mac_len);
|
||||||
|
|
||||||
/* mpls_hdr() is used to locate the ethertype field correctly in the
|
if (ovs_key_mac_proto(key) == MAC_PROTO_ETHERNET) {
|
||||||
* presence of VLAN tags.
|
struct ethhdr *hdr;
|
||||||
*/
|
|
||||||
hdr = (struct ethhdr *)((void *)mpls_hdr(skb) - ETH_HLEN);
|
/* mpls_hdr() is used to locate the ethertype field correctly in the
|
||||||
update_ethertype(skb, hdr, ethertype);
|
* presence of VLAN tags.
|
||||||
|
*/
|
||||||
|
hdr = (struct ethhdr *)((void *)mpls_hdr(skb) - ETH_HLEN);
|
||||||
|
update_ethertype(skb, hdr, ethertype);
|
||||||
|
}
|
||||||
if (eth_p_mpls(skb->protocol))
|
if (eth_p_mpls(skb->protocol))
|
||||||
skb->protocol = ethertype;
|
skb->protocol = ethertype;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue