> -----Original Message----- > From: EXT Balasubramanian Manoharan [mailto:bala.manoha...@linaro.org] > Sent: Thursday, April 21, 2016 9:19 AM > To: lng-odp@lists.linaro.org > Cc: Savolainen, Petri (Nokia - FI/Espoo) <petri.savolai...@nokia.com>; > Balasubramanian Manoharan <bala.manoha...@linaro.org> > Subject: [API-NEXT 1/4] api: classification: Adds capability and PMR range > > Adds classification capability structure and PMR range functionality. > odp_cls_capability_t structure defines system level classification > capability. > > Signed-off-by: Balasubramanian Manoharan <bala.manoha...@linaro.org> > --- > include/odp/api/spec/classification.h | 134 ++++++++++++++++++++++++++++- > ----- > 1 file changed, 112 insertions(+), 22 deletions(-) > > diff --git a/include/odp/api/spec/classification.h > b/include/odp/api/spec/classification.h > index 076b3de..28619a9 100644 > --- a/include/odp/api/spec/classification.h > +++ b/include/odp/api/spec/classification.h > @@ -55,6 +55,76 @@ extern "C" { > */ > > /** > + * Supported PMR term values > + * > + * Supported Packet Matching Rule term values in a bit field structure. > + */ > +typedef union odp_cls_pmr_supported_t { > + struct { > + /** Total length of received packet */ > + uint64_t pmr_len:1;
This should be shortly "len". > + /** Initial (outer) Ethertype only */ > + uint64_t ethtype_0:1; > + /** Ethertype of most inner VLAN tag */ > + uint64_t ethtype_x:1; > + /** First VLAN ID (outer) */ > + uint64_t vlan_id_0:1; > + /** Last VLAN ID (inner) */ > + uint64_t vlan_id_x:1; > + /** destination MAC address */ > + uint64_t dmac:1; > + /** IP Protocol or IPv6 Next Header */ > + uint64_t ip_proto:1; > + /** Destination UDP port, implies IPPROTO=17 */ > + uint64_t udp_dport:1; > + /** Destination TCP port implies IPPROTO=6 */ > + uint64_t tcp_dport:1; > + /** Source UDP Port */ > + uint64_t udp_sport:1; > + /** Source TCP port */ > + uint64_t tcp_sport:1; > + /** Source IP address */ > + uint64_t sip_addr:1; > + /** Destination IP address */ > + uint64_t dip_addr:1; > + /** Source IP address */ > + uint64_t sip6_addr:1; > + /** Destination IP address */ > + uint64_t dip6_addr:1; > + /** IPsec session identifier */ > + uint64_t ipsec_spi:1; > + /** NVGRE/VXLAN network identifier */ > + uint64_t ld_vni:1; > + /** Custom match rule, offset from start of > + * frame. The match is defined by the offset, the > + * expected value, and its size. > + */ > + uint64_t custom_frame:1; > + > + } proto; I'd use "bit" here, proto is definitely wrong here since there are fields that are not protocols (len, address, custom ...). Proto is copy-paste from hash struct, but bit would be better also there. pmr_terms.all_bits = 0; pmr_terms.bit.len = 1; pmr_terms.bit.udp_sport = 1; ... > + uint64_t all_bits; > +} odp_cls_pmr_supported_t; Since this is a general list of pmr terms, a better name for the type would be odp_cls_pmr_terms_t, which may then be used for multiple purposes (supported, not supported, hw offloaded, etc). > + > +/** > + * Classification capabilities > + * This capability structure defines system level classfication > capability > + */ > +typedef struct odp_cls_capability_t { > + /** PMR terms supported by the classifier > + * A mask one bit for each of odp_pmr_term_t "A bit mask of one bit for each ..." > + */ > + odp_cls_pmr_supported_t pmr_terms; odp_cls_pmr_terms_t supported; > + /** Maximum number of PMR terms */ > + unsigned max_pmr_terms; A line feed between every struct field would make this code more readable. > + /** Number of PMR terms available for use now */ > + unsigned available_pmr_terms; > + /** Maximum number of CoS supported */ > + unsigned max_cos; > + /** A Boolean to denote support of PMR range */ > + odp_bool_t pmr_range_supported; > +} odp_cls_capability_t; > + > +/** > * class of service packet drop policies > */ > typedef enum { > @@ -103,6 +173,17 @@ typedef struct odp_cls_cos_param { > void odp_cls_cos_param_init(odp_cls_cos_param_t *param); > > /** > + * Query classification capabilities > + * > + * Outputs classification capabilities on success. > + * > + * @param[out] capability Classification capability structure for > output "Pointer to classification ... " > + * @retval 0 on success > + * @retval <0 on failure > + */ > +int odp_cls_capability(odp_cls_capability_t *capability); > + > +/** > * Create a class-of-service > * > * @param name String intended for debugging purposes. > @@ -268,17 +349,40 @@ typedef enum { > } odp_pmr_term_t; > > /** > - * Following structure is used to define a packet matching rule > + * Packet Matching Rule parameter structure > */ > -typedef struct odp_pmr_match_t { > - odp_pmr_term_t term; /**< PMR term value to be matched */ > - const void *val; /**< Value to be matched */ > - const void *mask; /**< Masked set of bits to be matched */ > +typedef struct odp_pmr_param_t { > + odp_pmr_term_t term; /**< Packet Macthing Rule term */ > + bool range_term; /**< True if the value is range and false if > match Must be odp_bool_t -Petri > */ > + union { > + struct { > + /**< Value to be matched */ > + const void *value; > + /**< Masked set of bits to be matched */ > + const void *mask; > + } match; > + struct { > + /* Start and End values are included in the range */ > + /**< start value of range */ > + const void *val_start; > + /**< End value of range */ > + const void *val_end; > + } range; > + }; > uint32_t val_sz; /**< Size of the term value */ > uint32_t offset; /**< User-defined offset in packet > Used if term == ODP_PMR_CUSTOM_FRAME only, > ignored otherwise */ > -} odp_pmr_match_t; > +} odp_pmr_param_t; _______________________________________________ lng-odp mailing list lng-odp@lists.linaro.org https://lists.linaro.org/mailman/listinfo/lng-odp