Skip to content

Commit

Permalink
txrx-tsn: Add extra flush packets in TX thread
Browse files Browse the repository at this point in the history
Changes:
- Extra flush packets are added in TX thread to ensure
  the original num of packets in TX ring is sent
  (similar to kick_tx()).
- Initiate the packet RX from packet num 1

Signed-off-by: Goh Wei Sheng <wei.sheng.goh@intel.com>
  • Loading branch information
ws-intel committed Aug 22, 2023
1 parent 29021b2 commit dd0fe82
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/txrx-afxdp.c
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ extern uint32_t glob_rx_seq;

/* User Defines */
#define BATCH_SIZE 64 //for l2fwd only
#define DEFAULT_NUM_FLUSH_PACKETS 10 //for socket flushing

/* Signal handler to gracefully shutdown */
void afxdp_sigint_handler(int signum)
Expand Down Expand Up @@ -349,7 +350,7 @@ void *afxdp_send_thread(void *arg)
struct timespec ts;

struct xsk_info *xsk = opt->xsk;
uint64_t seq_num = 1;
uint64_t seq_num = 0;
uint64_t i = 0;

/* Create packet template */
Expand All @@ -366,7 +367,7 @@ void *afxdp_send_thread(void *arg)
tx_timestamp += opt->offset_ns;
tx_timestamp += 2 * NSEC_PER_SEC;

while(!halt_tx_sig && (i < opt->frames_to_send) ) {
while(!halt_tx_sig && (i < opt->frames_to_send + DEFAULT_NUM_FLUSH_PACKETS) ) {

sleep_timestamp = tx_timestamp - opt->early_offset_ns;
ts.tv_sec = sleep_timestamp / NSEC_PER_SEC;
Expand Down

0 comments on commit dd0fe82

Please sign in to comment.