[dpdk-users] Flow director struct rte_flow_item_raw guild

曾懷恩 the at csie.io
Thu May 9 05:51:14 CEST 2019

Hi, 敬昊,

Sorry for my question is not clear.

My question is, should I declare a variable to store the bytes I want to filter and just assign it to the pattern element?

Therefore, will the result of init flow filter be like 

	struct rte_flow_item_raw raw_spec, raw_mask; 
	uint8_t spec[12] = {0x08,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01}; 
	 uint8_t mask[12] = {0xff,0xff,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xff};

	*(uint32_t *)&raw_spec = 0x40000000;
	raw_spec.offset = 12;
	raw_spec.limit = 12;
	raw_spec.length = 24;
	raw_spec.pattern = spec;
	raw_mask.pattern = mask;
	pattern[0].type = RTE_FLOW_ITEM_TYPE_RAW;
	pattern[0].spec = &raw_spec;
	pattern[0].mask = &raw_mask;

if i want to filter out icmp packet?

thanks a lot.

Best Regards,

> 張敬昊 <frank at csie.io> 於 2019年5月9日 上午10:10 寫道:
> Hi 懷恩,
> On the second line of the detailed description of the struct reference <https://doc.dpdk.org/api/structrte__flow__item__raw.html#a0ea66fcaa4ad84410cef13b693809bd2>, it says
> "Matches a byte string of a given length at a given offset."
> I think pattern is the byte string to look for.
> Regards,
> Frank
> On Thu, May 9, 2019 at 10:01 AM 曾懷恩 <the at csie.io <mailto:the at csie.io>> wrote:
> Hi, 
> I have a few questions about structure rte_flow_item_raw.
> In DPDK API doc, it shows there are some below elements in this structure
> uint32_t        relative:1
> uint32_t        search:1
> uint32_t        reserved:30
> int32_t         offset
> uint16_t        limit
> uint16_t        length
> const uint8_t *         pattern
>  Now I can understand the relative and search elements are used to determine search type.
> The offset element is used to set the start search point in packet.
> The limit element is used to set the end search point in packet.
> However, I can’t understand what the pattern element is used to?
> What kind of pointer should I assign to the pattern element?
> Besides, in other rte_flow_item_* structures, there are clearly elements to let user to set contents and masks.
> How do I do in the structure rte_flow_item_raw?
> Thanks a lot,
> Best Regards,
> -- 
> 張敬昊 Frank Chang
> Email: frank at csie.io <mailto:frank at csie.io>
> https://frankchang.me <https://frankchang.me/>
> High Speed Network Lab <http://speed.cis.nctu.edu.tw/>
> National Chiao Tung University

More information about the users mailing list