Skip to content

Commit

Permalink
Update comments and disable some test logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mozzieongit committed Aug 19, 2024
1 parent 1079aa8 commit 31f4c2b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
9 changes: 2 additions & 7 deletions xdp-server.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,6 @@ xsk_configure_socket(struct xdp_server *xdp, struct xsk_socket_info *xsk_info,
int i, ret;

xsk_info->umem = umem;
/* TODO: maybe move rx/tx sizes to xdp_config too? */
xsk_cfg.rx_size = XSK_RING_CONS__NUM_DESCS;
xsk_cfg.tx_size = XSK_RING_PROD__NUM_DESCS;
xsk_cfg.xdp_flags = cfg.xdp_flags;
Expand Down Expand Up @@ -340,24 +339,20 @@ xsk_configure_socket(struct xdp_server *xdp, struct xsk_socket_info *xsk_info,

xsk_info->umem->umem_frame_free = XDP_NUM_FRAMES;

/* TODO: maybe move this ring size to xdp_config too? */
ret = xsk_ring_prod__reserve(&xsk_info->umem->fq,
XSK_RING_PROD__NUM_DESCS,
&idx);

/* TODO: maybe move this ring size to xdp_config too? */
if (ret != XSK_RING_PROD__NUM_DESCS) {
log_msg(LOG_ERR, "xdp: amount of reserved addr not as expected");
goto error_exit;
}

/* TODO: maybe move this ring size to xdp_config too? */
for (i = 0; i < XSK_RING_PROD__NUM_DESCS; ++i) {
*xsk_ring_prod__fill_addr(&xsk_info->umem->fq, idx++) =
xsk_alloc_umem_frame(xsk_info);
}

/* TODO: maybe move this ring size to xdp_config too? */
xsk_ring_prod__submit(&xsk_info->umem->fq, XSK_RING_PROD__NUM_DESCS);

return 0;
Expand Down Expand Up @@ -670,7 +665,7 @@ static int parse_dns(struct nsd* nsd, void *dnshdr, uint32_t dnslen, struct quer
static int
process_packet(struct xdp_server *xdp, uint8_t *pkt, uint64_t addr,
uint32_t *len, struct query *query) {
log_msg(LOG_INFO, "xdp: received packet with len %d", *len);
/* log_msg(LOG_INFO, "xdp: received packet with len %d", *len); */

uint32_t dnslen = *len;
uint32_t data_before_dnshdr_len = 0;
Expand Down Expand Up @@ -780,7 +775,7 @@ process_packet(struct xdp_server *xdp, uint8_t *pkt, uint64_t addr,
return 0;
}

log_msg(LOG_INFO, "xdp: done with processing the packet");
/* log_msg(LOG_INFO, "xdp: done with processing the packet"); */

*len = data_before_dnshdr_len + dnslen;
return 1;
Expand Down
1 change: 1 addition & 0 deletions xdp-server.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
/* TODO: check if number is sensible */
#define XDP_RX_BATCH_SIZE 64
#define XDP_INVALID_UMEM_FRAME UINT64_MAX
/* TODO: maybe make these ring sizes configurable? */
#define XSK_RING_PROD__NUM_DESCS XSK_RING_PROD__DEFAULT_NUM_DESCS
#define XSK_RING_CONS__NUM_DESCS XSK_RING_CONS__DEFAULT_NUM_DESCS

Expand Down

0 comments on commit 31f4c2b

Please sign in to comment.