Sending data from emem to host.

77 views
Skip to first unread message

Xiong Holo

unread,
Aug 1, 2023, 9:21:08 AM8/1/23
to open-nfp

Hi everyone,

The purpose of my letter this time is to ask you some questions about sending data from micro-c to host.

    Now, I have defined some structures in micro-c emem memory to store data from packets as follows.

typedef struct data{

uint32_t switch_id;

uint32_t level1_ingress_port_id;

uint32_t level1_egress_port_id;

uint32_t hop_latency;

......

}data;

typedef struct sfint{

data R[NODE_NUM];  // 4

uint32_t send_flag[NODE_NUM];

}sfint;

__declspec(emem shared scope(global) export) sfint buffer[BUFFER_SIZE+1];  // 65535+1

    What I want to know is how should I send the data in the emem(buffer) to the host and store them in the host? I have tried the following methods:

  1. I defined the same field in user metadata(P4 pipeline)and use the "callbackapi" to set the data in emem (buffer) to the same field in user metadata in micro-c and the send digest of user metadata to host in p4. After I compile, I can see the api setting the corresponding metadata in pif_plugin_metadata.h, but when I run the program to send digest, an error will be reported: the corresponding api is undefined, and indeed it disappears in pif_plugin_metadata.h.    
  2. I used NFP BSP APIs to read memory directly, but I need to send data to the host in real-time and save it. I haven't thought of a suitable way to achieve real-time reading.

Could you give me some advice and I want to get as fast performance as possible. I am looking forward to your reply. Thank you very much!

Reply all
Reply to author
Forward
0 new messages