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

seawreck does not work with DPDK with smp #30

Open
slivne opened this issue Feb 15, 2015 · 1 comment
Open

seawreck does not work with DPDK with smp #30

slivne opened this issue Feb 15, 2015 · 1 comment

Comments

@slivne
Copy link
Contributor

slivne commented Feb 15, 2015

sudo build/release/apps/seawreck/seawreck --server 19268.20.101:10000 --host-ipv4-addr 192.168.20.185 --dhcp 0 --gw-ipv4-addr 192.168.20.101  --netmask-ipv4-addr 255.255.255.0 --smp 2 --conn 4 --network-stack native --dpdk-pmd  --collectd 0  --duration 1

with 8ca0f21

this works on the same server with posix stack (--network-stack posix)

I get at times

[shlomi@dpdk1 ~]$ sudo tshark -i enp129s0
Running as user "root" and group "root". This could be dangerous.
Capturing on 'enp129s0'
1 0.000000 IntelCor_2d:3a:00 -> Broadcast ARP 60 Who has 192.168.20.101? Tell 192.168.20.185
2 0.000343 IntelCor_2d:3a:00 -> Broadcast ARP 60 Who has 192.168.20.101? Tell 192.168.20.185
3 1.000410 IntelCor_2d:3a:00 -> Broadcast ARP 60 Who has 192.168.20.101? Tell 192.168.20.185
4 1.000416 IntelCor_27:d3:ea -> IntelCor_2d:3a:00 ARP 42 192.168.20.101 is at 68:05:ca:27:d3:ea
5 1.000471 IntelCor_2d:3a:00 -> Broadcast ARP 60 Who has 192.168.20.101? Tell 192.168.20.185
6 1.000475 IntelCor_27:d3:ea -> IntelCor_2d:3a:00 ARP 42 192.168.20.101 is at 68:05:ca:27:d3:ea

and at times (after 4,5 restarts)

29 56.363824 192.168.20.185 -> 192.168.20.101 TCP 62 47476→10000 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 WS=128
30 56.363829 192.168.20.185 -> 192.168.20.101 TCP 62 46368→10000 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 WS=128
31 56.363858 192.168.20.101 -> 192.168.20.185 TCP 62 10000→47476 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1460 WS=128
32 56.363864 192.168.20.185 -> 192.168.20.101 TCP 62 46786→10000 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 WS=128
33 56.363871 192.168.20.101 -> 192.168.20.185 TCP 62 10000→46368 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1460 WS=128
34 56.363873 192.168.20.101 -> 192.168.20.185 TCP 62 10000→46786 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1460 WS=128
35 56.363878 192.168.20.185 -> 192.168.20.101 TCP 62 54821→10000 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 WS=128
36 56.363887 192.168.20.101 -> 192.168.20.185 TCP 62 10000→54821 [SYN, ACK] Seq=0 Ack=1 Win=29200 Len=0 MSS=1460 WS=128
37 56.363891 192.168.20.185 -> 192.168.20.101 TCP 60 47476→10000 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
38 56.363898 192.168.20.185 -> 192.168.20.101 TCP 60 46368→10000 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
39 56.363916 192.168.20.185 -> 192.168.20.101 TCP 60 46786→10000 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
40 56.363921 192.168.20.185 -> 192.168.20.101 TCP 60 54821→10000 [RST, ACK] Seq=1 Ack=1 Win=0 Len=0
41 57.374729 192.168.20.185 -> 192.168.20.101 TCP 62 [TCP Spurious Retransmission] 46786→10000 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 WS=128
42 57.374750 192.168.20.101 -> 192.168.20.185 TCP 62 [TCP Previous segment not captured] 10000→46786 [SYN, ACK] Seq=15794908 Ack=1 Win=29200 Len=0 MSS=1460 WS=128
43 57.374753 192.168.20.185 -> 192.168.20.101 TCP 62 [TCP Spurious Retransmission] 46368→10000 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 WS=128
44 57.374763 192.168.20.101 -> 192.168.20.185 TCP 62 [TCP Previous segment not captured] 10000→46368 [SYN, ACK] Seq=15795290 Ack=1 Win=29200 Len=0 MSS=1460 WS=128
45 57.374767 192.168.20.185 -> 192.168.20.101 TCP 62 [TCP Spurious Retransmission] 54821→10000 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 WS=128
46 57.374774 192.168.20.101 -> 192.168.20.185 TCP 62 [TCP Previous segment not captured] 10000→54821 [SYN, ACK] Seq=15795110 Ack=1 Win=29200 Len=0 MSS=1460 WS=128
47 57.374776 192.168.20.185 -> 192.168.20.101 TCP 62 [TCP Spurious Retransmission] 47476→10000 [SYN] Seq=0 Win=29200 Len=0 MSS=1460 WS=128
48 57.374783 192.168.20.101 -> 192.168.20.185 TCP 62 [TCP Previous segment not captured] 10000→47476 [SYN, ACK] Seq=15795830 Ack=1 Win=29200 Len=0 MSS=1460 WS=128
49 57.374784 192.168.20.185 -> 192.168.20.101 TCP 60 [TCP ACKed unseen segment] 46786→10000 [RST, ACK] Seq=1 Ack=15794909 Win=0 Len=0
50 57.374788 192.168.20.185 -> 192.168.20.101 TCP 60 [TCP ACKed unseen segment] 46368→10000 [RST, ACK] Seq=1 Ack=15795291 Win=0 Len=0
51 57.374791 192.168.20.185 -> 192.168.20.101 TCP 60 [TCP ACKed unseen segment] 54821→10000 [RST, ACK] Seq=1 Ack=15795111 Win=0 Len=0
52 57.374820 192.168.20.185 -> 192.168.20.101 TCP 60 [TCP ACKed unseen segment] 47476→10000 [RST, ACK] Seq=1 Ack=15795831 Win=0 Len=0

this is simlar to the issue reported for tcp_client with dpdk (#23)

@ljluestc
Copy link

#include <rte_eal.h>
#include <rte_ethdev.h>

#define NUM_MBUFS 8191
#define MBUF_CACHE_SIZE 250

// Global mutex for managing TCP connections if needed
pthread_mutex_t tcp_conn_mutex = PTHREAD_MUTEX_INITIALIZER;

int main(int argc, char **argv) {
    int ret, lcore_id;
    uint16_t nb_ports;

    // Initialize EAL
    ret = rte_eal_init(argc, argv);
    if (ret < 0) rte_exit(EXIT_FAILURE, "Error with EAL initialization\n");

    nb_ports = rte_eth_dev_count_avail();
    if (nb_ports == 0) rte_exit(EXIT_FAILURE, "No Ethernet ports found\n");

    for (uint8_t portid = 0; portid < nb_ports; portid++) {
        // Configure each port for multi-core use
        struct rte_eth_conf port_conf = {0};
        port_conf.rxmode.mq_mode = ETH_MQ_RX_RSS; // RSS for multi-queue
        port_conf.rx_adv_conf.rss_conf.rss_hf = ETH_RSS_IP | ETH_RSS_TCP; // Enable RSS for TCP and IP

        ret = rte_eth_dev_configure(portid, rte_lcore_count(), 1, &port_conf);
        if (ret < 0) rte_exit(EXIT_FAILURE, "Port configuration failed\n");

        // Setup RX and TX queues for each core
        for (lcore_id = 0; lcore_id < rte_lcore_count(); lcore_id++) {
            ret = rte_eth_rx_queue_setup(portid, lcore_id, 128, rte_eth_dev_socket_id(portid), NULL, mbuf_pool);
            if (ret < 0) rte_exit(EXIT_FAILURE, "RX queue setup failed\n");

            ret = rte_eth_tx_queue_setup(portid, lcore_id, 512, rte_eth_dev_socket_id(portid), NULL);
            if (ret < 0) rte_exit(EXIT_FAILURE, "TX queue setup failed\n");
        }

        // Start the device
        ret = rte_eth_dev_start(portid);
        if (ret < 0) rte_exit(EXIT_FAILURE, "Device start failed\n");
    }

    // Example of handling TCP connections in an SMP-safe manner
    RTE_LCORE_FOREACH(lcore_id) {
        if (lcore_id == rte_get_master_lcore()) continue; // Skip master core if you only use worker cores

        rte_eal_remote_launch(handle_tcp_connections, NULL, lcore_id);
    }

    rte_eal_mp_wait_lcore();

    return 0;
}

void* handle_tcp_connections(void *arg) {
    // Implement TCP connection handling here, ensuring thread safety
    // Lock mutex before modifying shared TCP connection data
    pthread_mutex_lock(&tcp_conn_mutex);
    // ... TCP connection logic, potentially involving DPDK functions for packet processing ...
    pthread_mutex_unlock(&tcp_conn_mutex);
    return NULL;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants