* [PATCH net-next 1/1] openvswitch: Declare ovs key structures using macros
@ 2019-01-24 9:46 Eli Britstein
2019-01-25 21:55 ` Pravin Shelar
2019-01-26 23:04 ` David Miller
0 siblings, 2 replies; 6+ messages in thread
From: Eli Britstein @ 2019-01-24 9:46 UTC (permalink / raw)
To: Pravin B Shelar
Cc: netdev, Ben Pfaff, dev, Roi Dayan, Simon Horman, Eli Britstein
Declare ovs key structures using macros to enable retrieving fields
information, with no functional change.
Signed-off-by: Eli Britstein <elibr@mellanox.com>
Reviewed-by: Roi Dayan <roid@mellanox.com>
---
include/uapi/linux/openvswitch.h | 102 ++++++++++++++++++++++++++-------------
1 file changed, 69 insertions(+), 33 deletions(-)
diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
index dbe0cbe4f1b7..dc8246f871fd 100644
--- a/include/uapi/linux/openvswitch.h
+++ b/include/uapi/linux/openvswitch.h
@@ -387,73 +387,109 @@ enum ovs_frag_type {
#define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1)
+#define OVS_KEY_FIELD_ARR(type, name, elements) type name[elements];
+#define OVS_KEY_FIELD(type, name) type name;
+
+#define OVS_KEY_ETHERNET_FIELDS \
+ OVS_KEY_FIELD_ARR(__u8, eth_src, ETH_ALEN) \
+ OVS_KEY_FIELD_ARR(__u8, eth_dst, ETH_ALEN)
+
struct ovs_key_ethernet {
- __u8 eth_src[ETH_ALEN];
- __u8 eth_dst[ETH_ALEN];
+ OVS_KEY_ETHERNET_FIELDS
};
struct ovs_key_mpls {
__be32 mpls_lse;
};
+#define OVS_KEY_IPV4_FIELDS \
+ OVS_KEY_FIELD(__be32, ipv4_src) \
+ OVS_KEY_FIELD(__be32, ipv4_dst) \
+ OVS_KEY_FIELD(__u8, ipv4_proto) \
+ OVS_KEY_FIELD(__u8, ipv4_tos) \
+ OVS_KEY_FIELD(__u8, ipv4_ttl) \
+ OVS_KEY_FIELD(__u8, ipv4_frag /* One of OVS_FRAG_TYPE_*. */)
+
struct ovs_key_ipv4 {
- __be32 ipv4_src;
- __be32 ipv4_dst;
- __u8 ipv4_proto;
- __u8 ipv4_tos;
- __u8 ipv4_ttl;
- __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */
+ OVS_KEY_IPV4_FIELDS
};
+#define OVS_KEY_IPV6_FIELDS \
+ OVS_KEY_FIELD_ARR(__be32, ipv6_src, 4) \
+ OVS_KEY_FIELD_ARR(__be32, ipv6_dst, 4) \
+ OVS_KEY_FIELD(__be32, ipv6_label /* 20-bits in least-significant bits. */) \
+ OVS_KEY_FIELD(__u8, ipv6_proto) \
+ OVS_KEY_FIELD(__u8, ipv6_tclass) \
+ OVS_KEY_FIELD(__u8, ipv6_hlimit) \
+ OVS_KEY_FIELD(__u8, ipv6_frag /* One of OVS_FRAG_TYPE_*. */)
+
struct ovs_key_ipv6 {
- __be32 ipv6_src[4];
- __be32 ipv6_dst[4];
- __be32 ipv6_label; /* 20-bits in least-significant bits. */
- __u8 ipv6_proto;
- __u8 ipv6_tclass;
- __u8 ipv6_hlimit;
- __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */
+ OVS_KEY_IPV6_FIELDS
};
+#define OVS_KEY_TCP_FIELDS \
+ OVS_KEY_FIELD(__be16, tcp_src) \
+ OVS_KEY_FIELD(__be16, tcp_dst)
+
struct ovs_key_tcp {
- __be16 tcp_src;
- __be16 tcp_dst;
+ OVS_KEY_TCP_FIELDS
};
+#define OVS_KEY_UDP_FIELDS \
+ OVS_KEY_FIELD(__be16, udp_src) \
+ OVS_KEY_FIELD(__be16, udp_dst)
+
struct ovs_key_udp {
- __be16 udp_src;
- __be16 udp_dst;
+ OVS_KEY_UDP_FIELDS
};
+#define OVS_KEY_SCTP_FIELDS \
+ OVS_KEY_FIELD(__be16, sctp_src) \
+ OVS_KEY_FIELD(__be16, sctp_dst)
+
struct ovs_key_sctp {
- __be16 sctp_src;
- __be16 sctp_dst;
+ OVS_KEY_SCTP_FIELDS
};
+#define OVS_KEY_ICMP_FIELDS \
+ OVS_KEY_FIELD(__u8, icmp_type) \
+ OVS_KEY_FIELD(__u8, icmp_code)
+
struct ovs_key_icmp {
- __u8 icmp_type;
- __u8 icmp_code;
+ OVS_KEY_ICMP_FIELDS
};
+#define OVS_KEY_ICMPV6_FIELDS \
+ OVS_KEY_FIELD(__u8, icmpv6_type) \
+ OVS_KEY_FIELD(__u8, icmpv6_code)
+
struct ovs_key_icmpv6 {
- __u8 icmpv6_type;
- __u8 icmpv6_code;
+ OVS_KEY_ICMPV6_FIELDS
};
+#define OVS_KEY_ARP_FIELDS \
+ OVS_KEY_FIELD(__be32, arp_sip) \
+ OVS_KEY_FIELD(__be32, arp_tip) \
+ OVS_KEY_FIELD(__be16, arp_op) \
+ OVS_KEY_FIELD_ARR(__u8, arp_sha, ETH_ALEN) \
+ OVS_KEY_FIELD_ARR(__u8, arp_tha, ETH_ALEN)
+
struct ovs_key_arp {
- __be32 arp_sip;
- __be32 arp_tip;
- __be16 arp_op;
- __u8 arp_sha[ETH_ALEN];
- __u8 arp_tha[ETH_ALEN];
+ OVS_KEY_ARP_FIELDS
};
+#define OVS_KEY_ND_FIELDS \
+ OVS_KEY_FIELD_ARR(__be32, nd_target, 4) \
+ OVS_KEY_FIELD_ARR(__u8, nd_sll, ETH_ALEN) \
+ OVS_KEY_FIELD_ARR(__u8, nd_tll, ETH_ALEN)
+
struct ovs_key_nd {
- __be32 nd_target[4];
- __u8 nd_sll[ETH_ALEN];
- __u8 nd_tll[ETH_ALEN];
+ OVS_KEY_ND_FIELDS
};
+#undef OVS_KEY_FIELD_ARR
+#undef OVS_KEY_FIELD
+
#define OVS_CT_LABELS_LEN_32 4
#define OVS_CT_LABELS_LEN (OVS_CT_LABELS_LEN_32 * sizeof(__u32))
struct ovs_key_ct_labels {
--
2.14.4
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/1] openvswitch: Declare ovs key structures using macros
2019-01-24 9:46 [PATCH net-next 1/1] openvswitch: Declare ovs key structures using macros Eli Britstein
@ 2019-01-25 21:55 ` Pravin Shelar
2019-01-26 23:04 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: Pravin Shelar @ 2019-01-25 21:55 UTC (permalink / raw)
To: Eli Britstein
Cc: Linux Kernel Network Developers, Ben Pfaff, ovs dev, Roi Dayan,
Simon Horman
On Thu, Jan 24, 2019 at 1:47 AM Eli Britstein <elibr@mellanox.com> wrote:
>
> Declare ovs key structures using macros to enable retrieving fields
> information, with no functional change.
>
I am not sure why is this done. Can you explain what are u trying to solve here?
> Signed-off-by: Eli Britstein <elibr@mellanox.com>
> Reviewed-by: Roi Dayan <roid@mellanox.com>
> ---
> include/uapi/linux/openvswitch.h | 102 ++++++++++++++++++++++++++-------------
> 1 file changed, 69 insertions(+), 33 deletions(-)
>
> diff --git a/include/uapi/linux/openvswitch.h b/include/uapi/linux/openvswitch.h
> index dbe0cbe4f1b7..dc8246f871fd 100644
> --- a/include/uapi/linux/openvswitch.h
> +++ b/include/uapi/linux/openvswitch.h
> @@ -387,73 +387,109 @@ enum ovs_frag_type {
>
> #define OVS_FRAG_TYPE_MAX (__OVS_FRAG_TYPE_MAX - 1)
>
> +#define OVS_KEY_FIELD_ARR(type, name, elements) type name[elements];
> +#define OVS_KEY_FIELD(type, name) type name;
> +
> +#define OVS_KEY_ETHERNET_FIELDS \
> + OVS_KEY_FIELD_ARR(__u8, eth_src, ETH_ALEN) \
> + OVS_KEY_FIELD_ARR(__u8, eth_dst, ETH_ALEN)
> +
> struct ovs_key_ethernet {
> - __u8 eth_src[ETH_ALEN];
> - __u8 eth_dst[ETH_ALEN];
> + OVS_KEY_ETHERNET_FIELDS
> };
>
> struct ovs_key_mpls {
> __be32 mpls_lse;
> };
>
> +#define OVS_KEY_IPV4_FIELDS \
> + OVS_KEY_FIELD(__be32, ipv4_src) \
> + OVS_KEY_FIELD(__be32, ipv4_dst) \
> + OVS_KEY_FIELD(__u8, ipv4_proto) \
> + OVS_KEY_FIELD(__u8, ipv4_tos) \
> + OVS_KEY_FIELD(__u8, ipv4_ttl) \
> + OVS_KEY_FIELD(__u8, ipv4_frag /* One of OVS_FRAG_TYPE_*. */)
> +
> struct ovs_key_ipv4 {
> - __be32 ipv4_src;
> - __be32 ipv4_dst;
> - __u8 ipv4_proto;
> - __u8 ipv4_tos;
> - __u8 ipv4_ttl;
> - __u8 ipv4_frag; /* One of OVS_FRAG_TYPE_*. */
> + OVS_KEY_IPV4_FIELDS
> };
>
> +#define OVS_KEY_IPV6_FIELDS \
> + OVS_KEY_FIELD_ARR(__be32, ipv6_src, 4) \
> + OVS_KEY_FIELD_ARR(__be32, ipv6_dst, 4) \
> + OVS_KEY_FIELD(__be32, ipv6_label /* 20-bits in least-significant bits. */) \
> + OVS_KEY_FIELD(__u8, ipv6_proto) \
> + OVS_KEY_FIELD(__u8, ipv6_tclass) \
> + OVS_KEY_FIELD(__u8, ipv6_hlimit) \
> + OVS_KEY_FIELD(__u8, ipv6_frag /* One of OVS_FRAG_TYPE_*. */)
> +
> struct ovs_key_ipv6 {
> - __be32 ipv6_src[4];
> - __be32 ipv6_dst[4];
> - __be32 ipv6_label; /* 20-bits in least-significant bits. */
> - __u8 ipv6_proto;
> - __u8 ipv6_tclass;
> - __u8 ipv6_hlimit;
> - __u8 ipv6_frag; /* One of OVS_FRAG_TYPE_*. */
> + OVS_KEY_IPV6_FIELDS
> };
>
> +#define OVS_KEY_TCP_FIELDS \
> + OVS_KEY_FIELD(__be16, tcp_src) \
> + OVS_KEY_FIELD(__be16, tcp_dst)
> +
> struct ovs_key_tcp {
> - __be16 tcp_src;
> - __be16 tcp_dst;
> + OVS_KEY_TCP_FIELDS
> };
>
> +#define OVS_KEY_UDP_FIELDS \
> + OVS_KEY_FIELD(__be16, udp_src) \
> + OVS_KEY_FIELD(__be16, udp_dst)
> +
> struct ovs_key_udp {
> - __be16 udp_src;
> - __be16 udp_dst;
> + OVS_KEY_UDP_FIELDS
> };
>
> +#define OVS_KEY_SCTP_FIELDS \
> + OVS_KEY_FIELD(__be16, sctp_src) \
> + OVS_KEY_FIELD(__be16, sctp_dst)
> +
> struct ovs_key_sctp {
> - __be16 sctp_src;
> - __be16 sctp_dst;
> + OVS_KEY_SCTP_FIELDS
> };
>
> +#define OVS_KEY_ICMP_FIELDS \
> + OVS_KEY_FIELD(__u8, icmp_type) \
> + OVS_KEY_FIELD(__u8, icmp_code)
> +
> struct ovs_key_icmp {
> - __u8 icmp_type;
> - __u8 icmp_code;
> + OVS_KEY_ICMP_FIELDS
> };
>
> +#define OVS_KEY_ICMPV6_FIELDS \
> + OVS_KEY_FIELD(__u8, icmpv6_type) \
> + OVS_KEY_FIELD(__u8, icmpv6_code)
> +
> struct ovs_key_icmpv6 {
> - __u8 icmpv6_type;
> - __u8 icmpv6_code;
> + OVS_KEY_ICMPV6_FIELDS
> };
>
> +#define OVS_KEY_ARP_FIELDS \
> + OVS_KEY_FIELD(__be32, arp_sip) \
> + OVS_KEY_FIELD(__be32, arp_tip) \
> + OVS_KEY_FIELD(__be16, arp_op) \
> + OVS_KEY_FIELD_ARR(__u8, arp_sha, ETH_ALEN) \
> + OVS_KEY_FIELD_ARR(__u8, arp_tha, ETH_ALEN)
> +
> struct ovs_key_arp {
> - __be32 arp_sip;
> - __be32 arp_tip;
> - __be16 arp_op;
> - __u8 arp_sha[ETH_ALEN];
> - __u8 arp_tha[ETH_ALEN];
> + OVS_KEY_ARP_FIELDS
> };
>
> +#define OVS_KEY_ND_FIELDS \
> + OVS_KEY_FIELD_ARR(__be32, nd_target, 4) \
> + OVS_KEY_FIELD_ARR(__u8, nd_sll, ETH_ALEN) \
> + OVS_KEY_FIELD_ARR(__u8, nd_tll, ETH_ALEN)
> +
> struct ovs_key_nd {
> - __be32 nd_target[4];
> - __u8 nd_sll[ETH_ALEN];
> - __u8 nd_tll[ETH_ALEN];
> + OVS_KEY_ND_FIELDS
> };
>
> +#undef OVS_KEY_FIELD_ARR
> +#undef OVS_KEY_FIELD
> +
> #define OVS_CT_LABELS_LEN_32 4
> #define OVS_CT_LABELS_LEN (OVS_CT_LABELS_LEN_32 * sizeof(__u32))
> struct ovs_key_ct_labels {
> --
> 2.14.4
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/1] openvswitch: Declare ovs key structures using macros
2019-01-24 9:46 [PATCH net-next 1/1] openvswitch: Declare ovs key structures using macros Eli Britstein
2019-01-25 21:55 ` Pravin Shelar
@ 2019-01-26 23:04 ` David Miller
2019-01-27 6:37 ` Eli Britstein
1 sibling, 1 reply; 6+ messages in thread
From: David Miller @ 2019-01-26 23:04 UTC (permalink / raw)
To: elibr; +Cc: pshelar, netdev, blp, dev, roid, simon.horman
From: Eli Britstein <elibr@mellanox.com>
Date: Thu, 24 Jan 2019 11:46:47 +0200
> Declare ovs key structures using macros to enable retrieving fields
> information, with no functional change.
>
> Signed-off-by: Eli Britstein <elibr@mellanox.com>
> Reviewed-by: Roi Dayan <roid@mellanox.com>
I agree with Pravin, this need a much better commit message.
Maybe even better to submit this alongside whatever is supposed
to use these new macros.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/1] openvswitch: Declare ovs key structures using macros
2019-01-26 23:04 ` David Miller
@ 2019-01-27 6:37 ` Eli Britstein
2019-01-31 11:32 ` Eli Britstein
0 siblings, 1 reply; 6+ messages in thread
From: Eli Britstein @ 2019-01-27 6:37 UTC (permalink / raw)
To: David Miller; +Cc: pshelar, netdev, blp, dev, Roi Dayan, simon.horman
On 1/27/2019 1:04 AM, David Miller wrote:
> From: Eli Britstein <elibr@mellanox.com>
> Date: Thu, 24 Jan 2019 11:46:47 +0200
>
>> Declare ovs key structures using macros to enable retrieving fields
>> information, with no functional change.
>>
>> Signed-off-by: Eli Britstein <elibr@mellanox.com>
>> Reviewed-by: Roi Dayan <roid@mellanox.com>
> I agree with Pravin, this need a much better commit message.
>
> Maybe even better to submit this alongside whatever is supposed
> to use these new macros.
This patch is equivalent to a work done in the OVS tree.
https://patchwork.ozlabs.org/patch/1023405/
As a standalone it doesn't serve any purpose (as mentioned - no
functional change).
It serves as a pre-step towards another patch in the OVS:
https://patchwork.ozlabs.org/patch/1022794/
So, the purpose of doing it in the kernel is just to keep this H file
identical. Once it is approved for the kernel, we will be able to
proceed with it in the OVS.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/1] openvswitch: Declare ovs key structures using macros
2019-01-27 6:37 ` Eli Britstein
@ 2019-01-31 11:32 ` Eli Britstein
2019-02-01 2:39 ` Pravin Shelar
0 siblings, 1 reply; 6+ messages in thread
From: Eli Britstein @ 2019-01-31 11:32 UTC (permalink / raw)
To: David Miller, pshelar; +Cc: netdev, blp, dev, Roi Dayan, simon.horman
ping
for the using patch, i put below the v1 of it. here is v2:
https://patchwork.ozlabs.org/patch/1023406/
On 1/27/2019 8:37 AM, Eli Britstein wrote:
>
> On 1/27/2019 1:04 AM, David Miller wrote:
>> From: Eli Britstein <elibr@mellanox.com>
>> Date: Thu, 24 Jan 2019 11:46:47 +0200
>>
>>> Declare ovs key structures using macros to enable retrieving fields
>>> information, with no functional change.
>>>
>>> Signed-off-by: Eli Britstein <elibr@mellanox.com>
>>> Reviewed-by: Roi Dayan <roid@mellanox.com>
>> I agree with Pravin, this need a much better commit message.
>>
>> Maybe even better to submit this alongside whatever is supposed
>> to use these new macros.
>
> This patch is equivalent to a work done in the OVS tree.
>
> https://patchwork.ozlabs.org/patch/1023405/
>
> As a standalone it doesn't serve any purpose (as mentioned - no
> functional change).
>
> It serves as a pre-step towards another patch in the OVS:
>
> https://patchwork.ozlabs.org/patch/1022794/
>
> So, the purpose of doing it in the kernel is just to keep this H file
> identical. Once it is approved for the kernel, we will be able to
> proceed with it in the OVS.
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH net-next 1/1] openvswitch: Declare ovs key structures using macros
2019-01-31 11:32 ` Eli Britstein
@ 2019-02-01 2:39 ` Pravin Shelar
0 siblings, 0 replies; 6+ messages in thread
From: Pravin Shelar @ 2019-02-01 2:39 UTC (permalink / raw)
To: Eli Britstein; +Cc: David Miller, netdev, blp, dev, Roi Dayan, simon.horman
Can you send patch with this information in commit msg?
On Thu, Jan 31, 2019 at 3:32 AM Eli Britstein <elibr@mellanox.com> wrote:
>
> ping
>
> for the using patch, i put below the v1 of it. here is v2:
>
> https://patchwork.ozlabs.org/patch/1023406/
>
>
> On 1/27/2019 8:37 AM, Eli Britstein wrote:
> >
> > On 1/27/2019 1:04 AM, David Miller wrote:
> >> From: Eli Britstein <elibr@mellanox.com>
> >> Date: Thu, 24 Jan 2019 11:46:47 +0200
> >>
> >>> Declare ovs key structures using macros to enable retrieving fields
> >>> information, with no functional change.
> >>>
> >>> Signed-off-by: Eli Britstein <elibr@mellanox.com>
> >>> Reviewed-by: Roi Dayan <roid@mellanox.com>
> >> I agree with Pravin, this need a much better commit message.
> >>
> >> Maybe even better to submit this alongside whatever is supposed
> >> to use these new macros.
> >
> > This patch is equivalent to a work done in the OVS tree.
> >
> > https://patchwork.ozlabs.org/patch/1023405/
> >
> > As a standalone it doesn't serve any purpose (as mentioned - no
> > functional change).
> >
> > It serves as a pre-step towards another patch in the OVS:
> >
> > https://patchwork.ozlabs.org/patch/1022794/
> >
> > So, the purpose of doing it in the kernel is just to keep this H file
> > identical. Once it is approved for the kernel, we will be able to
> > proceed with it in the OVS.
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-02-01 2:53 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-24 9:46 [PATCH net-next 1/1] openvswitch: Declare ovs key structures using macros Eli Britstein
2019-01-25 21:55 ` Pravin Shelar
2019-01-26 23:04 ` David Miller
2019-01-27 6:37 ` Eli Britstein
2019-01-31 11:32 ` Eli Britstein
2019-02-01 2:39 ` Pravin Shelar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).