<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Aptos;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
font-size:11.0pt;
font-family:"Aptos",sans-serif;
mso-ligatures:standardcontextual;
mso-fareast-language:EN-US;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Aptos",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:11.0pt;
mso-fareast-language:EN-US;}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-IN" link="#467886" vlink="#96607D" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US">Hi All,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> I using dpdk pipeline and performing table lookup to decide the packet forwarding.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">One of my use case v4_acl lookup failing could not find the reason.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Scenario:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">pipeline test_pipe1 table match v4_acl ipv4 offset 274 size 1K action test.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Acl table offset is set to 274. In coming packets contains vlan header.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">When normal packet received src and ds tip matching according to the rules I pushed into the table.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Packets with GRE header and outer ip header src and dst ip also matching.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">I wanted to do lookup for inner IP header src and dst fields , to achieve this used
<b>rte_pktmbuf_adj</b> to remove the gre and outer ip header.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Again I placed eth_header and vlan header at the start position.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US">Code snippet:<o:p></o:p></span></b></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">rte_memcpy(&temp_hdr, eth_header,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> (sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr) +<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> sizeof(struct rte_ipv4_hdr) +<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> sizeof(gre_hdr_t)));<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> rte_pktmbuf_adj (mb, (sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr) +<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> sizeof(struct rte_ipv4_hdr) +<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> sizeof(gre_hdr_t)));<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> rte_pktmbuf_prepend (mb,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> sizeof (struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr) );<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> pkt = rte_pktmbuf_mtod(mb, uint8_t *);<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> rte_memcpy (pkt, &temp_hdr,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr) ) ;<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"> ip = (struct rte_ipv4_hdr*) (pkt + sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr));<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">My expectation is inner header lookup will work because now I moved the inner header in place of outer header position.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">But lookup failed could not find the reason for failure.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Could any one help on this to solve the issue.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Why the table offset is set to 274 to match the IP header fields?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Is mbuf ip header will be at offset 274 always, I know mbuf headroom is 128 byte long
<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Could any one explain point me the document to refer the offset calculation for mbuf and acl table?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">Bala <o:p></o:p></span></p>
</div>
</body>
</html>