[dpdk-dev,v4,1/7] lib/librte_ether: modify the structures for fdir new modes

Message ID 1445566690-15767-2-git-send-email-wenzhuo.lu@intel.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Wenzhuo Lu Oct. 23, 2015, 2:18 a.m. UTC
  Define the new modes and modify the filter and mask structures for
the mac vlan and tunnel modes.

Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
---
 lib/librte_ether/rte_eth_ctrl.h | 51 +++++++++++++++++++++++++++++++++--------
 1 file changed, 42 insertions(+), 9 deletions(-)
  

Comments

Chilikin, Andrey Oct. 23, 2015, 10:39 a.m. UTC | #1
I would suggest rearranging members of rte_eth_fdir_tunnel_type to set RTE_FDIR_TUNNEL_TYPE_UNKNOWN=0 so any global/static variables or variables after memset(0) would have unknown type.

Regards,
Andrey

> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> Sent: Friday, October 23, 2015 3:18 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for
> fdir new modes
> 
> Define the new modes and modify the filter and mask structures for the mac
> vlan and tunnel modes.
> 
> Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> ---
>  lib/librte_ether/rte_eth_ctrl.h | 51 +++++++++++++++++++++++++++++++++----
> ----
>  1 file changed, 42 insertions(+), 9 deletions(-)
> 
> diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
> index 26b7b33..cf32814 100644
> --- a/lib/librte_ether/rte_eth_ctrl.h
> +++ b/lib/librte_ether/rte_eth_ctrl.h
> @@ -377,18 +377,46 @@ struct rte_eth_sctpv6_flow {  };
> 
>  /**
> + * A structure used to define the input for MAC VLAN flow  */ struct
> +rte_eth_mac_vlan_flow {
> +	struct ether_addr mac_addr;  /**< Mac address to match. */ };
> +
> +/**
> + * Tunnel type for flow director.
> + */
> +enum rte_eth_fdir_tunnel_type {
> +	RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
> +	RTE_FDIR_TUNNEL_TYPE_VXLAN,
> +	RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
> +};
> +
> +/**
> + * A structure used to define the input for tunnel flow, now it's VxLAN
> +or
> + * NVGRE
> + */
> +struct rte_eth_tunnel_flow {
> +	enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to
> match. */
> +	uint32_t tunnel_id;                        /**< Tunnel ID to match. TNI, VNI...
> */
> +	struct ether_addr mac_addr;                /**< Mac address to match. */
> +};
> +
> +/**
>   * An union contains the inputs for all types of flow
>   */
>  union rte_eth_fdir_flow {
> -	struct rte_eth_l2_flow     l2_flow;
> -	struct rte_eth_udpv4_flow  udp4_flow;
> -	struct rte_eth_tcpv4_flow  tcp4_flow;
> -	struct rte_eth_sctpv4_flow sctp4_flow;
> -	struct rte_eth_ipv4_flow   ip4_flow;
> -	struct rte_eth_udpv6_flow  udp6_flow;
> -	struct rte_eth_tcpv6_flow  tcp6_flow;
> -	struct rte_eth_sctpv6_flow sctp6_flow;
> -	struct rte_eth_ipv6_flow   ipv6_flow;
> +	struct rte_eth_l2_flow         l2_flow;
> +	struct rte_eth_udpv4_flow      udp4_flow;
> +	struct rte_eth_tcpv4_flow      tcp4_flow;
> +	struct rte_eth_sctpv4_flow     sctp4_flow;
> +	struct rte_eth_ipv4_flow       ip4_flow;
> +	struct rte_eth_udpv6_flow      udp6_flow;
> +	struct rte_eth_tcpv6_flow      tcp6_flow;
> +	struct rte_eth_sctpv6_flow     sctp6_flow;
> +	struct rte_eth_ipv6_flow       ipv6_flow;
> +	struct rte_eth_mac_vlan_flow   mac_vlan_flow;
> +	struct rte_eth_tunnel_flow     tunnel_flow;
>  };
> 
>  /**
> @@ -465,6 +493,9 @@ struct rte_eth_fdir_masks {
>  	struct rte_eth_ipv6_flow   ipv6_mask;
>  	uint16_t src_port_mask;
>  	uint16_t dst_port_mask;
> +	uint8_t mac_addr_byte_mask;  /** Per byte MAC address mask */
> +	uint32_t tunnel_id_mask;  /** tunnel ID mask */
> +	uint8_t tunnel_type_mask;
>  };
> 
>  /**
> @@ -522,6 +553,8 @@ enum rte_fdir_mode {
>  	RTE_FDIR_MODE_NONE      = 0, /**< Disable FDIR support. */
>  	RTE_FDIR_MODE_SIGNATURE,     /**< Enable FDIR signature filter
> mode. */
>  	RTE_FDIR_MODE_PERFECT,       /**< Enable FDIR perfect filter mode.
> */
> +	RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode
> - MAC VLAN. */
> +	RTE_FDIR_MODE_PERFECT_TUNNEL,   /**< Enable FDIR filter mode -
> tunnel. */
>  };
> 
>  #define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
> --
> 1.9.3
  
Ananyev, Konstantin Oct. 23, 2015, 10:53 a.m. UTC | #2
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Chilikin, Andrey
> Sent: Friday, October 23, 2015 11:39 AM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for fdir new modes
> 
> I would suggest rearranging members of rte_eth_fdir_tunnel_type to set RTE_FDIR_TUNNEL_TYPE_UNKNOWN=0 so any global/static
> variables or variables after memset(0) would have unknown type.

Yes, that's good point.
Konstantin

> 
> Regards,
> Andrey
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Friday, October 23, 2015 3:18 AM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures for
> > fdir new modes
> >
> > Define the new modes and modify the filter and mask structures for the mac
> > vlan and tunnel modes.
> >
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > ---
> >  lib/librte_ether/rte_eth_ctrl.h | 51 +++++++++++++++++++++++++++++++++----
> > ----
> >  1 file changed, 42 insertions(+), 9 deletions(-)
> >
> > diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
> > index 26b7b33..cf32814 100644
> > --- a/lib/librte_ether/rte_eth_ctrl.h
> > +++ b/lib/librte_ether/rte_eth_ctrl.h
> > @@ -377,18 +377,46 @@ struct rte_eth_sctpv6_flow {  };
> >
> >  /**
> > + * A structure used to define the input for MAC VLAN flow  */ struct
> > +rte_eth_mac_vlan_flow {
> > +	struct ether_addr mac_addr;  /**< Mac address to match. */ };
> > +
> > +/**
> > + * Tunnel type for flow director.
> > + */
> > +enum rte_eth_fdir_tunnel_type {
> > +	RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
> > +	RTE_FDIR_TUNNEL_TYPE_VXLAN,
> > +	RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
> > +};
> > +
> > +/**
> > + * A structure used to define the input for tunnel flow, now it's VxLAN
> > +or
> > + * NVGRE
> > + */
> > +struct rte_eth_tunnel_flow {
> > +	enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to
> > match. */
> > +	uint32_t tunnel_id;                        /**< Tunnel ID to match. TNI, VNI...
> > */
> > +	struct ether_addr mac_addr;                /**< Mac address to match. */
> > +};
> > +
> > +/**
> >   * An union contains the inputs for all types of flow
> >   */
> >  union rte_eth_fdir_flow {
> > -	struct rte_eth_l2_flow     l2_flow;
> > -	struct rte_eth_udpv4_flow  udp4_flow;
> > -	struct rte_eth_tcpv4_flow  tcp4_flow;
> > -	struct rte_eth_sctpv4_flow sctp4_flow;
> > -	struct rte_eth_ipv4_flow   ip4_flow;
> > -	struct rte_eth_udpv6_flow  udp6_flow;
> > -	struct rte_eth_tcpv6_flow  tcp6_flow;
> > -	struct rte_eth_sctpv6_flow sctp6_flow;
> > -	struct rte_eth_ipv6_flow   ipv6_flow;
> > +	struct rte_eth_l2_flow         l2_flow;
> > +	struct rte_eth_udpv4_flow      udp4_flow;
> > +	struct rte_eth_tcpv4_flow      tcp4_flow;
> > +	struct rte_eth_sctpv4_flow     sctp4_flow;
> > +	struct rte_eth_ipv4_flow       ip4_flow;
> > +	struct rte_eth_udpv6_flow      udp6_flow;
> > +	struct rte_eth_tcpv6_flow      tcp6_flow;
> > +	struct rte_eth_sctpv6_flow     sctp6_flow;
> > +	struct rte_eth_ipv6_flow       ipv6_flow;
> > +	struct rte_eth_mac_vlan_flow   mac_vlan_flow;
> > +	struct rte_eth_tunnel_flow     tunnel_flow;
> >  };
> >
> >  /**
> > @@ -465,6 +493,9 @@ struct rte_eth_fdir_masks {
> >  	struct rte_eth_ipv6_flow   ipv6_mask;
> >  	uint16_t src_port_mask;
> >  	uint16_t dst_port_mask;
> > +	uint8_t mac_addr_byte_mask;  /** Per byte MAC address mask */
> > +	uint32_t tunnel_id_mask;  /** tunnel ID mask */
> > +	uint8_t tunnel_type_mask;
> >  };
> >
> >  /**
> > @@ -522,6 +553,8 @@ enum rte_fdir_mode {
> >  	RTE_FDIR_MODE_NONE      = 0, /**< Disable FDIR support. */
> >  	RTE_FDIR_MODE_SIGNATURE,     /**< Enable FDIR signature filter
> > mode. */
> >  	RTE_FDIR_MODE_PERFECT,       /**< Enable FDIR perfect filter mode.
> > */
> > +	RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode
> > - MAC VLAN. */
> > +	RTE_FDIR_MODE_PERFECT_TUNNEL,   /**< Enable FDIR filter mode -
> > tunnel. */
> >  };
> >
> >  #define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
> > --
> > 1.9.3
  
Wenzhuo Lu Oct. 23, 2015, 12:55 p.m. UTC | #3
Hi Andrey,

> -----Original Message-----
> From: Chilikin, Andrey
> Sent: Friday, October 23, 2015 6:39 PM
> To: Lu, Wenzhuo; dev@dpdk.org
> Subject: RE: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the structures
> for fdir new modes
> 
> I would suggest rearranging members of rte_eth_fdir_tunnel_type to set
> RTE_FDIR_TUNNEL_TYPE_UNKNOWN=0 so any global/static variables or
> variables after memset(0) would have unknown type.
Sounds good. I follow the datasheet to set the tunnel type value, but your idea looks better :)

> 
> Regards,
> Andrey
> 
> > -----Original Message-----
> > From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Wenzhuo Lu
> > Sent: Friday, October 23, 2015 3:18 AM
> > To: dev@dpdk.org
> > Subject: [dpdk-dev] [PATCH v4 1/7] lib/librte_ether: modify the
> > structures for fdir new modes
> >
> > Define the new modes and modify the filter and mask structures for the
> > mac vlan and tunnel modes.
> >
> > Signed-off-by: Wenzhuo Lu <wenzhuo.lu@intel.com>
> > ---
> >  lib/librte_ether/rte_eth_ctrl.h | 51
> > +++++++++++++++++++++++++++++++++----
> > ----
> >  1 file changed, 42 insertions(+), 9 deletions(-)
> >
> > diff --git a/lib/librte_ether/rte_eth_ctrl.h
> > b/lib/librte_ether/rte_eth_ctrl.h index 26b7b33..cf32814 100644
> > --- a/lib/librte_ether/rte_eth_ctrl.h
> > +++ b/lib/librte_ether/rte_eth_ctrl.h
> > @@ -377,18 +377,46 @@ struct rte_eth_sctpv6_flow {  };
> >
> >  /**
> > + * A structure used to define the input for MAC VLAN flow  */ struct
> > +rte_eth_mac_vlan_flow {
> > +	struct ether_addr mac_addr;  /**< Mac address to match. */ };
> > +
> > +/**
> > + * Tunnel type for flow director.
> > + */
> > +enum rte_eth_fdir_tunnel_type {
> > +	RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
> > +	RTE_FDIR_TUNNEL_TYPE_VXLAN,
> > +	RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
> > +};
> > +
> > +/**
> > + * A structure used to define the input for tunnel flow, now it's
> > +VxLAN or
> > + * NVGRE
> > + */
> > +struct rte_eth_tunnel_flow {
> > +	enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to
> > match. */
> > +	uint32_t tunnel_id;                        /**< Tunnel ID to match. TNI, VNI...
> > */
> > +	struct ether_addr mac_addr;                /**< Mac address to match. */
> > +};
> > +
> > +/**
> >   * An union contains the inputs for all types of flow
> >   */
> >  union rte_eth_fdir_flow {
> > -	struct rte_eth_l2_flow     l2_flow;
> > -	struct rte_eth_udpv4_flow  udp4_flow;
> > -	struct rte_eth_tcpv4_flow  tcp4_flow;
> > -	struct rte_eth_sctpv4_flow sctp4_flow;
> > -	struct rte_eth_ipv4_flow   ip4_flow;
> > -	struct rte_eth_udpv6_flow  udp6_flow;
> > -	struct rte_eth_tcpv6_flow  tcp6_flow;
> > -	struct rte_eth_sctpv6_flow sctp6_flow;
> > -	struct rte_eth_ipv6_flow   ipv6_flow;
> > +	struct rte_eth_l2_flow         l2_flow;
> > +	struct rte_eth_udpv4_flow      udp4_flow;
> > +	struct rte_eth_tcpv4_flow      tcp4_flow;
> > +	struct rte_eth_sctpv4_flow     sctp4_flow;
> > +	struct rte_eth_ipv4_flow       ip4_flow;
> > +	struct rte_eth_udpv6_flow      udp6_flow;
> > +	struct rte_eth_tcpv6_flow      tcp6_flow;
> > +	struct rte_eth_sctpv6_flow     sctp6_flow;
> > +	struct rte_eth_ipv6_flow       ipv6_flow;
> > +	struct rte_eth_mac_vlan_flow   mac_vlan_flow;
> > +	struct rte_eth_tunnel_flow     tunnel_flow;
> >  };
> >
> >  /**
> > @@ -465,6 +493,9 @@ struct rte_eth_fdir_masks {
> >  	struct rte_eth_ipv6_flow   ipv6_mask;
> >  	uint16_t src_port_mask;
> >  	uint16_t dst_port_mask;
> > +	uint8_t mac_addr_byte_mask;  /** Per byte MAC address mask */
> > +	uint32_t tunnel_id_mask;  /** tunnel ID mask */
> > +	uint8_t tunnel_type_mask;
> >  };
> >
> >  /**
> > @@ -522,6 +553,8 @@ enum rte_fdir_mode {
> >  	RTE_FDIR_MODE_NONE      = 0, /**< Disable FDIR support. */
> >  	RTE_FDIR_MODE_SIGNATURE,     /**< Enable FDIR signature filter
> > mode. */
> >  	RTE_FDIR_MODE_PERFECT,       /**< Enable FDIR perfect filter mode.
> > */
> > +	RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode
> > - MAC VLAN. */
> > +	RTE_FDIR_MODE_PERFECT_TUNNEL,   /**< Enable FDIR filter mode -
> > tunnel. */
> >  };
> >
> >  #define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))
> > --
> > 1.9.3
  

Patch

diff --git a/lib/librte_ether/rte_eth_ctrl.h b/lib/librte_ether/rte_eth_ctrl.h
index 26b7b33..cf32814 100644
--- a/lib/librte_ether/rte_eth_ctrl.h
+++ b/lib/librte_ether/rte_eth_ctrl.h
@@ -377,18 +377,46 @@  struct rte_eth_sctpv6_flow {
 };
 
 /**
+ * A structure used to define the input for MAC VLAN flow
+ */
+struct rte_eth_mac_vlan_flow {
+	struct ether_addr mac_addr;  /**< Mac address to match. */
+};
+
+/**
+ * Tunnel type for flow director.
+ */
+enum rte_eth_fdir_tunnel_type {
+	RTE_FDIR_TUNNEL_TYPE_NVGRE = 0,
+	RTE_FDIR_TUNNEL_TYPE_VXLAN,
+	RTE_FDIR_TUNNEL_TYPE_UNKNOWN,
+};
+
+/**
+ * A structure used to define the input for tunnel flow, now it's VxLAN or
+ * NVGRE
+ */
+struct rte_eth_tunnel_flow {
+	enum rte_eth_fdir_tunnel_type tunnel_type; /**< Tunnel type to match. */
+	uint32_t tunnel_id;                        /**< Tunnel ID to match. TNI, VNI... */
+	struct ether_addr mac_addr;                /**< Mac address to match. */
+};
+
+/**
  * An union contains the inputs for all types of flow
  */
 union rte_eth_fdir_flow {
-	struct rte_eth_l2_flow     l2_flow;
-	struct rte_eth_udpv4_flow  udp4_flow;
-	struct rte_eth_tcpv4_flow  tcp4_flow;
-	struct rte_eth_sctpv4_flow sctp4_flow;
-	struct rte_eth_ipv4_flow   ip4_flow;
-	struct rte_eth_udpv6_flow  udp6_flow;
-	struct rte_eth_tcpv6_flow  tcp6_flow;
-	struct rte_eth_sctpv6_flow sctp6_flow;
-	struct rte_eth_ipv6_flow   ipv6_flow;
+	struct rte_eth_l2_flow         l2_flow;
+	struct rte_eth_udpv4_flow      udp4_flow;
+	struct rte_eth_tcpv4_flow      tcp4_flow;
+	struct rte_eth_sctpv4_flow     sctp4_flow;
+	struct rte_eth_ipv4_flow       ip4_flow;
+	struct rte_eth_udpv6_flow      udp6_flow;
+	struct rte_eth_tcpv6_flow      tcp6_flow;
+	struct rte_eth_sctpv6_flow     sctp6_flow;
+	struct rte_eth_ipv6_flow       ipv6_flow;
+	struct rte_eth_mac_vlan_flow   mac_vlan_flow;
+	struct rte_eth_tunnel_flow     tunnel_flow;
 };
 
 /**
@@ -465,6 +493,9 @@  struct rte_eth_fdir_masks {
 	struct rte_eth_ipv6_flow   ipv6_mask;
 	uint16_t src_port_mask;
 	uint16_t dst_port_mask;
+	uint8_t mac_addr_byte_mask;  /** Per byte MAC address mask */
+	uint32_t tunnel_id_mask;  /** tunnel ID mask */
+	uint8_t tunnel_type_mask;
 };
 
 /**
@@ -522,6 +553,8 @@  enum rte_fdir_mode {
 	RTE_FDIR_MODE_NONE      = 0, /**< Disable FDIR support. */
 	RTE_FDIR_MODE_SIGNATURE,     /**< Enable FDIR signature filter mode. */
 	RTE_FDIR_MODE_PERFECT,       /**< Enable FDIR perfect filter mode. */
+	RTE_FDIR_MODE_PERFECT_MAC_VLAN, /**< Enable FDIR filter mode - MAC VLAN. */
+	RTE_FDIR_MODE_PERFECT_TUNNEL,   /**< Enable FDIR filter mode - tunnel. */
 };
 
 #define UINT32_BIT (CHAR_BIT * sizeof(uint32_t))