Netdev List
 help / color / mirror / Atom feed
From: Saeed Mahameed <saeedm@mellanox.com>
To: "David S. Miller" <davem@davemloft.net>
Cc: netdev@vger.kernel.org, Or Gerlitz <ogerlitz@mellanox.com>,
	Hadar Hen-Zion <hadarh@mellanox.com>,
	Saeed Mahameed <saeedm@mellanox.com>
Subject: [PATCH net-next 05/13] net/dst: Add dst port to dst_metadata utility functions
Date: Mon,  7 Nov 2016 15:14:40 +0200	[thread overview]
Message-ID: <1478524488-1377-6-git-send-email-saeedm@mellanox.com> (raw)
In-Reply-To: <1478524488-1377-1-git-send-email-saeedm@mellanox.com>

From: Hadar Hen Zion <hadarh@mellanox.com>

Add dst port parameter to __ip_tun_set_dst and __ipv6_tun_set_dst
utility functions.

Signed-off-by: Hadar Hen Zion <hadarh@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
 include/net/dst_metadata.h | 10 ++++++----
 net/sched/act_tunnel_key.c |  4 ++--
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/include/net/dst_metadata.h b/include/net/dst_metadata.h
index 6965c8f..701fc81 100644
--- a/include/net/dst_metadata.h
+++ b/include/net/dst_metadata.h
@@ -115,6 +115,7 @@ static inline struct ip_tunnel_info *skb_tunnel_info_unclone(struct sk_buff *skb
 static inline struct metadata_dst *__ip_tun_set_dst(__be32 saddr,
 						    __be32 daddr,
 						    __u8 tos, __u8 ttl,
+						    __be16 tp_dst,
 						    __be16 flags,
 						    __be64 tunnel_id,
 						    int md_size)
@@ -127,7 +128,7 @@ static inline struct metadata_dst *__ip_tun_set_dst(__be32 saddr,
 
 	ip_tunnel_key_init(&tun_dst->u.tun_info.key,
 			   saddr, daddr, tos, ttl,
-			   0, 0, 0, tunnel_id, flags);
+			   0, 0, tp_dst, tunnel_id, flags);
 	return tun_dst;
 }
 
@@ -139,12 +140,13 @@ static inline struct metadata_dst *ip_tun_rx_dst(struct sk_buff *skb,
 	const struct iphdr *iph = ip_hdr(skb);
 
 	return __ip_tun_set_dst(iph->saddr, iph->daddr, iph->tos, iph->ttl,
-				flags, tunnel_id, md_size);
+				0, flags, tunnel_id, md_size);
 }
 
 static inline struct metadata_dst *__ipv6_tun_set_dst(const struct in6_addr *saddr,
 						      const struct in6_addr *daddr,
 						      __u8 tos, __u8 ttl,
+						      __be16 tp_dst,
 						      __be32 label,
 						      __be16 flags,
 						      __be64 tunnel_id,
@@ -162,7 +164,7 @@ static inline struct metadata_dst *__ipv6_tun_set_dst(const struct in6_addr *sad
 	info->key.tun_flags = flags;
 	info->key.tun_id = tunnel_id;
 	info->key.tp_src = 0;
-	info->key.tp_dst = 0;
+	info->key.tp_dst = tp_dst;
 
 	info->key.u.ipv6.src = *saddr;
 	info->key.u.ipv6.dst = *daddr;
@@ -183,7 +185,7 @@ static inline struct metadata_dst *ipv6_tun_rx_dst(struct sk_buff *skb,
 
 	return __ipv6_tun_set_dst(&ip6h->saddr, &ip6h->daddr,
 				  ipv6_get_dsfield(ip6h), ip6h->hop_limit,
-				  ip6_flowlabel(ip6h), flags, tunnel_id,
+				  0, ip6_flowlabel(ip6h), flags, tunnel_id,
 				  md_size);
 }
 #endif /* __NET_DST_METADATA_H */
diff --git a/net/sched/act_tunnel_key.c b/net/sched/act_tunnel_key.c
index cab1fd5..bd2f63e 100644
--- a/net/sched/act_tunnel_key.c
+++ b/net/sched/act_tunnel_key.c
@@ -119,7 +119,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
 			daddr = nla_get_in_addr(tb[TCA_TUNNEL_KEY_ENC_IPV4_DST]);
 
 			metadata = __ip_tun_set_dst(saddr, daddr, 0, 0,
-						    TUNNEL_KEY, key_id, 0);
+						    0, TUNNEL_KEY, key_id, 0);
 		} else if (tb[TCA_TUNNEL_KEY_ENC_IPV6_SRC] &&
 			   tb[TCA_TUNNEL_KEY_ENC_IPV6_DST]) {
 			struct in6_addr saddr;
@@ -129,7 +129,7 @@ static int tunnel_key_init(struct net *net, struct nlattr *nla,
 			daddr = nla_get_in6_addr(tb[TCA_TUNNEL_KEY_ENC_IPV6_DST]);
 
 			metadata = __ipv6_tun_set_dst(&saddr, &daddr, 0, 0, 0,
-						      TUNNEL_KEY, key_id, 0);
+						      0, TUNNEL_KEY, key_id, 0);
 		}
 
 		if (!metadata) {
-- 
2.7.4

  parent reply	other threads:[~2016-11-07 13:15 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-07 13:14 [PATCH net-next 00/13] Mellanox 100G SRIOV offloads tunnel_key set/release Saeed Mahameed
2016-11-07 13:14 ` [PATCH net-next 01/13] net/sched: act_tunnel_key: add helper inlines to access tcf_tunnel_key Saeed Mahameed
2016-11-07 13:14 ` [PATCH net-next 02/13] flow_dissector: Add enums for encapsulation keys Saeed Mahameed
2016-11-07 13:14 ` [PATCH net-next 03/13] net/sched: cls_flower: Allow setting encapsulation fields as used key Saeed Mahameed
2016-11-07 13:14 ` [PATCH net-next 04/13] net/sched: cls_flower: Add UDP port to tunnel parameters Saeed Mahameed
2016-11-07 13:14 ` Saeed Mahameed [this message]
2016-11-07 13:14 ` [PATCH net-next 06/13] net/sched: act_tunnel_key: Add UDP dst port option Saeed Mahameed
2016-11-07 13:14 ` [PATCH net-next 07/13] net/mlx5: Move alloc/dealloc encap commands declarations to common header file Saeed Mahameed
2016-11-07 13:14 ` [PATCH net-next 08/13] net/mlx5: Check max encap header size capability Saeed Mahameed
2016-11-07 13:14 ` [PATCH net-next 09/13] net/mlx5: Add creation flags when adding new flow table Saeed Mahameed
2016-11-07 13:14 ` [PATCH net-next 10/13] net/mlx5: Support encap id when setting new steering entry Saeed Mahameed
2016-11-07 13:14 ` [PATCH net-next 11/13] net/mlx5e: Add TC tunnel release action for SRIOV offloads Saeed Mahameed
2016-11-07 13:14 ` [PATCH net-next 12/13] net/mlx5e: Add ndo_udp_tunnel_add to VF representors Saeed Mahameed
2016-11-07 13:14 ` [PATCH net-next 13/13] net/mlx5e: Add basic TC tunnel set action for SRIOV offloads Saeed Mahameed
2016-11-09 18:42 ` [PATCH net-next 00/13] Mellanox 100G SRIOV offloads tunnel_key set/release David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1478524488-1377-6-git-send-email-saeedm@mellanox.com \
    --to=saeedm@mellanox.com \
    --cc=davem@davemloft.net \
    --cc=hadarh@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=ogerlitz@mellanox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox