Hi Dave, Thank You for the explanation. For my code i think u16 is enough. I will use it as it is.
Regards Dimitar On Tue, Nov 26, 2019 at 3:52 PM Dave Barach (dbarach) <dbar...@cisco.com> wrote: > The short answer is no, don’t just change the size. The > vnet_classify_entry_t is packed, and has a documented alignment requirement: > > > > typedef CLIB_PACKED(struct _vnet_classify_entry { > > <snip> > > vnet_classify_action_t action; > > u16 metadata; > > > > <snip> > > > > /* Must be aligned to a 16-octet boundary */ > > u32x4 key[0]; > > }) vnet_classify_entry_t; > > > > As it turns out, a number of fields in the vnet_classify_entry_t are > over-sized. Next_index is a graph node arc index which needs to hold a > small integer with a typical upper bound less than 100, not 4e9. The 2x > u8’s flags and action could be combined. Last_heard (time of last > classifier hit) seems completely unused. It’s not a bad idea, but folks > don’t use it. > > > > FWIW... Dave > > > > *From:* vpp-dev@lists.fd.io <vpp-dev@lists.fd.io> *On Behalf Of *Dimitar > Ivanov > *Sent:* Tuesday, November 26, 2019 3:37 AM > *To:* vpp-dev@lists.fd.io > *Subject:* [vpp-dev] Type mismatch in classify session #vnet > > > > Hi, > To function *vnet_classify_add_del_session* we can pass parameter > metadata. I see that depending on some actions metadata is predefined. But > when action is *CLASSIFY_ACTION_SET_METADATA*, passed metadata is stored > in new session entry. I plan to use this entry for my purposes. But why to > function is passed u32 as metadata, also functions that set some metadata > automatically, depend on action, returns u32 and at the same time > definition of *vnet_classify_entry_t* size of metadata is u16 ? I use > version 19.08. Is is enough safe just to change size in > *vnet_classify_entry_t* ? > -- Dimitar Ivanov | R&D Direct: +359-2-439-2590 ext. 3906 | Mobile: +359-899-909976 | d...@telco.com Telco Systems | www.telco.com Follow us: LinkedIn <http://www.linkedin.com/company/telco-systems> | Twitter <http://twitter.com/TelcoSystems> | Facebook <https://www.facebook.com/TelcoSystems> | YouTube <http://www.youtube.com/TelcoSystems> | Blog <http://www.telco.com/blog> |
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#14703): https://lists.fd.io/g/vpp-dev/message/14703 Mute This Topic: https://lists.fd.io/mt/61956200/21656 Mute #vnet: https://lists.fd.io/mk?hashtag=vnet&subid=1480452 Group Owner: vpp-dev+ow...@lists.fd.io Unsubscribe: https://lists.fd.io/g/vpp-dev/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-