DPDK usage discussions
 help / color / mirror / Atom feed
* v4_acl lookup failed after rte_pktmbuf_adj in dpdk pipeline
@ 2024-08-30  5:35 Balakrishnan K
  0 siblings, 0 replies; 2+ messages in thread
From: Balakrishnan K @ 2024-08-30  5:35 UTC (permalink / raw)
  To: users, dev

[-- Attachment #1: Type: text/plain, Size: 2179 bytes --]

Hi All,
    I using dpdk pipeline and performing table lookup to decide the packet forwarding.
One of my use case v4_acl lookup failing could not find the reason.

Scenario:
pipeline test_pipe1 table match v4_acl ipv4 offset 274 size 1K action test.

Acl table offset is set to 274. In coming packets contains vlan header.
When normal packet received src and ds tip matching according  to the rules I pushed into the table.
Packets with GRE header and outer ip header src and dst ip also matching.

I wanted to do lookup for inner IP header src and dst fields , to achieve this used rte_pktmbuf_adj to remove the gre and outer ip header.
Again I placed eth_header and vlan header at the start position.

Code snippet:

rte_memcpy(&temp_hdr, eth_header,
                                (sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr) +
                                 sizeof(struct rte_ipv4_hdr) +
                                 sizeof(gre_hdr_t)));

                rte_pktmbuf_adj (mb, (sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr) +
                                        sizeof(struct rte_ipv4_hdr) +
                                        sizeof(gre_hdr_t)));
                rte_pktmbuf_prepend (mb,
                                sizeof (struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr) );
                pkt = rte_pktmbuf_mtod(mb, uint8_t *);

                rte_memcpy (pkt, &temp_hdr,
                                sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr) ) ;
                ip = (struct rte_ipv4_hdr*) (pkt + sizeof(struct rte_ether_hdr) + sizeof(struct rte_vlan_hdr));


My expectation is inner header lookup will work because now I moved the inner header in place of outer header position.
But lookup failed could not find the reason for failure.

Could any one help on this to solve the issue.

Why the table offset is set to 274 to match the IP header fields?
Is mbuf ip header will be at offset 274 always, I know mbuf headroom is 128 byte long
Could any one explain point me the document to refer the offset calculation for mbuf and acl table?


Regards,
Bala

[-- Attachment #2: Type: text/html, Size: 8098 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* v4_acl lookup failed after rte_pktmbuf_adj in dpdk pipeline
@ 2024-08-30  8:14 bala krishnan.k
  0 siblings, 0 replies; 2+ messages in thread
From: bala krishnan.k @ 2024-08-30  8:14 UTC (permalink / raw)
  To: dev, users

[-- Attachment #1: Type: text/plain, Size: 2182 bytes --]

Hi All,

    I using dpdk pipeline and performing table lookup to decide the packet
forwarding.

One of my use case v4_acl lookup failing could not find the reason.



Scenario:

pipeline test_pipe1 table match v4_acl ipv4 offset 274 size 1K action test.



Acl table offset is set to 274. In coming packets contains vlan header.

When normal packet received src and ds tip matching according  to the rules
I pushed into the table.

Packets with GRE header and outer ip header src and dst ip also matching.



I wanted to do lookup for inner IP header src and dst fields , to achieve
this used *rte_pktmbuf_adj* to remove the gre and outer ip header.

Again I placed eth_header and vlan header at the start position.



*Code snippet:*



rte_memcpy(&temp_hdr, eth_header,

                                (sizeof(struct rte_ether_hdr) +
sizeof(struct rte_vlan_hdr) +

                                 sizeof(struct rte_ipv4_hdr) +

                                 sizeof(gre_hdr_t)));



                rte_pktmbuf_adj (mb, (sizeof(struct rte_ether_hdr) +
sizeof(struct rte_vlan_hdr) +

                                        sizeof(struct rte_ipv4_hdr) +

                                        sizeof(gre_hdr_t)));

                rte_pktmbuf_prepend (mb,

                                sizeof (struct rte_ether_hdr) +
sizeof(struct rte_vlan_hdr) );

                pkt = rte_pktmbuf_mtod(mb, uint8_t *);



                rte_memcpy (pkt, &temp_hdr,

                                sizeof(struct rte_ether_hdr) +
sizeof(struct rte_vlan_hdr) ) ;

                ip = (struct rte_ipv4_hdr*) (pkt + sizeof(struct
rte_ether_hdr) + sizeof(struct rte_vlan_hdr));





My expectation is inner header lookup will work because now I moved the
inner header in place of outer header position.

But lookup failed could not find the reason for failure.



Could any one help on this to solve the issue.



Why the table offset is set to 274 to match the IP header fields?

Is mbuf ip header will be at offset 274 always, I know mbuf headroom is 128
byte long

Could any one explain point me the document to refer the offset calculation
for mbuf and acl table?





Regards,

Bala

[-- Attachment #2: Type: text/html, Size: 7837 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-08-30 11:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-08-30  5:35 v4_acl lookup failed after rte_pktmbuf_adj in dpdk pipeline Balakrishnan K
2024-08-30  8:14 bala krishnan.k

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).