Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

init flow steering even when autoscale is disabled #14

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tas/fast/fast_kernel.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ void fast_kernel_packet(struct dataplane_context *ctx,
len = network_buf_len(nbh);
dma_write(krx->addr, len, network_buf_bufoff(nbh));

if (network_buf_flowgroup(nbh, &krx->msg.packet.flow_group)) {
if (network_buf_flowgroup(nbh, &krx->msg.packet.flow_group, ctx->id)) {
fprintf(stderr, "fast_kernel_packet: network_buf_flowgroup failed\n");
abort();
}
Expand Down
33 changes: 19 additions & 14 deletions tas/fast/network.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ int network_init(unsigned n_threads)
goto error_exit;
}


/* workaround for mlx5. */
if (config.fp_autoscale) {
if (reta_mlx5_resize() != 0) {
Expand Down Expand Up @@ -270,11 +269,9 @@ int network_thread_init(struct dataplane_context *ctx)
}

/* setting up RETA failed */
if (config.fp_autoscale) {
if (reta_setup() != 0) {
fprintf(stderr, "RETA setup failed\n");
goto error_tx_queue;
}
if (reta_setup() != 0) {
fprintf(stderr, "RETA setup failed\n");
goto error_tx_queue;
}
start_done = 1;
}
Expand Down Expand Up @@ -438,6 +435,20 @@ static int reta_setup()

/* allocate RSS redirection table and core-bucket count table */
rss_reta_size = eth_devinfo.reta_size;
if (rss_reta_size == 0) {
fprintf(stderr, "Warning: NIC does not expose reta size\n");
rss_reta_size = rte_align32pow2(fp_cores_cur); /* map groups to fp cores in this case */
}
if (rss_reta_size > FLEXNIC_PL_MAX_FLOWGROUPS) {
fprintf(stderr, "reta_setup: reta size (%u) greater than maximum supported"
" (%u)\n", rss_reta_size, FLEXNIC_PL_MAX_FLOWGROUPS);
abort();
}
if (!rte_is_power_of_2(rss_reta_size)) {
fprintf(stderr, "reta_setup: reta size (%u) is not a power of 2\n", rss_reta_size);
abort();
}

rss_reta = rte_calloc("rss reta", ((rss_reta_size + RTE_RETA_GROUP_SIZE - 1) /
RTE_RETA_GROUP_SIZE), sizeof(*rss_reta), 0);
rss_core_buckets = rte_calloc("rss core buckets", fp_cores_max,
Expand All @@ -448,12 +459,6 @@ static int reta_setup()
goto error_exit;
}

if (rss_reta_size > FLEXNIC_PL_MAX_FLOWGROUPS) {
fprintf(stderr, "reta_setup: reta size (%u) greater than maximum supported"
" (%u)\n", rss_reta_size, FLEXNIC_PL_MAX_FLOWGROUPS);
abort();
}

/* initialize reta */
for (i = 0, c = 0; i < rss_reta_size; i++) {
rss_core_buckets[c]++;
Expand All @@ -463,9 +468,9 @@ static int reta_setup()
c = (c + 1) % fp_cores_cur;
}

if (rte_eth_dev_rss_reta_update(net_port_id, rss_reta, rss_reta_size) != 0) {
if (rte_eth_dev_rss_reta_update(net_port_id, rss_reta, rss_reta_size) != 0 && config.fp_autoscale) {
fprintf(stderr, "reta_setup: rte_eth_dev_rss_reta_update failed\n");
return -1;
goto error_exit;
}

return 0;
Expand Down
6 changes: 3 additions & 3 deletions tas/fast/network.h
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ static inline uint16_t network_buf_tcpxsums(struct network_buf_handle *bh, uint8
}

static inline int network_buf_flowgroup(struct network_buf_handle *bh,
uint16_t *fg)
uint16_t *fg, uint16_t core)
{
struct rte_mbuf *mb = (struct rte_mbuf *) bh;
if (!(mb->ol_flags & PKT_RX_RSS_HASH)) {
*fg = 0;
*fg = core;
return 0;
}

*fg = mb->hash.rss & (rss_reta_size - 1);
*fg = mb->hash.rss & (rss_reta_size - 1); // NOTE: assume rte_is_power_of_2(rss_reta_size)
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion tas/tas.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ int main(int argc, char *argv[])
res = EXIT_FAILURE;
goto error_exit;
}
fp_cores_max = config.fp_cores_max;
fp_cores_max = fp_cores_cur = config.fp_cores_max;

/* allocate shared memory before dpdk grabs all huge pages */
if (shm_preinit() != 0) {
Expand Down