Hi Rujan,

Can you please explain what you are trying to do here.

You cannot assume inside VPP code that rte_mbuf is present and even if it is 
present, that it is filled by real data.
Locally originated packets and packets coming from non-dpdk sources simply 
don't have rte_mbuf initialized.

rte_mbuf header is constructed inside TX code based on data from vlib_buffer_t 
so typically it is enough to modify
vlib_buffer_t fields.

Hope this explains,

Damjan

> On 21 Mar 2017, at 06:45, Li, Rujun <rujun...@intel.com> wrote:
> 
> Hi all
>  
> I have a vlib_buffer_t packets (in GDB) looks like:
>  
> $37 = {cacheline0 = 0x7fff54716f00 "\362\377*", current_data = -14,
>   current_length = 42, flags = 0, free_list_index = 0,
>   total_length_not_including_first_buffer = 0, next_buffer = 0,
>   trace_index = 0, clone_count = 0, error = 401409, opaque = {0, 5, 3, 3, 2,
>     0, 0, 0}, cacheline1 = 0x7fff54716f40 "", opaque2 = {
>     0 <repeats 16 times>}, cacheline2 = 0x7fff54716f80 "",
>   pre_data = '\000' <repeats 114 times>, 
> "\377\377\377\377\377\377\000\036g\246{\356\b\006", data = 0x7fff54717000 ""}
> it is an arp-boardcast packet
>  
> and I want to change it into rte_mbuf *, so I called 
> rte_mbuf_from_vlib_buffer(b)
>  
> but the changed rte_mbuf (in GDB) looks like:
>  
> $38 = {cacheline0 = 0x7fff54716e80, buf_addr = 0x0, buf_physaddr = 0,
>   buf_len = 0, rearm_data = 0x7fff54716e92 "", data_off = 0, {refcnt_atomic = 
> {
>       cnt = 0}, refcnt = 0}, nb_segs = 0 '\000', port = 0 '\000',
>   ol_flags = 0, rx_descriptor_fields1 = 0x7fff54716ea0, {packet_type = 0, {
>       l2_type = 0, l3_type = 0, l4_type = 0, tun_type = 0, inner_l2_type = 0,
>       inner_l3_type = 0, inner_l4_type = 0}}, pkt_len = 0, data_len = 0,
>   vlan_tci = 0, hash = {rss = 0, fdir = {{{hash = 0, id = 0}, lo = 0},
>       hi = 0}, sched = {lo = 0, hi = 0}, usr = 0}, seqn = 0,
>   vlan_tci_outer = 0, cacheline1 = 0x7fff54716ec0, {userdata = 0x0,
>     udata64 = 0}, pool = 0x0, next = 0x0, {tx_offload = 0, {l2_len = 0,
>       l3_len = 0, l4_len = 0, tso_segsz = 0, outer_l3_len = 0,
>       outer_l2_len = 0}}, priv_size = 0, timesync = 0}
>  
> my code is :
>       struct rte_mbuf * mb;
>       mb = (((struct rte_mbuf *)b) - 1);
>     //mb = rte_mbuf_from_vlib_buffer(b); I have also tried this way
>       rte_pktmbuf_data_len(mb) = b->current_length;
>       mb->pkt_len = b->current_data;
>       mb->data_off = 128 + b->current_data;
>  
> the result may not correct, do you know why?
>  
>  
>  
> Best wishes,
> Rujun, Li
>  
> _______________________________________________
> vpp-dev mailing list
> vpp-dev@lists.fd.io <mailto:vpp-dev@lists.fd.io>
> https://lists.fd.io/mailman/listinfo/vpp-dev 
> <https://lists.fd.io/mailman/listinfo/vpp-dev>
_______________________________________________
vpp-dev mailing list
vpp-dev@lists.fd.io
https://lists.fd.io/mailman/listinfo/vpp-dev

Reply via email to