Git Product home page Git Product logo

Comments (6)

ynkjm avatar ynkjm commented on May 30, 2024

Thank you for suggestion.

We are going to fix this pkt-> cache code in next release.

The current implementation of raw-socket mode uses single thread for all packet processing, so the issue you mentioned is not critical for usual usecase now. But we need to fix it for the future version, which more flexible dataplane for various type of network I/O.

Thanks,

from lagopus.

ynkjm avatar ynkjm commented on May 30, 2024

Hi @eugene-che,

We have fixed the issue you mentioned and modified cache-related code to be more general as follows:
This patch is to be included at lagopu version 0.2.6.

---
 src/dataplane/mgr/sock_io.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/dataplane/mgr/sock_io.c b/src/dataplane/mgr/sock_io.c
index b18620d..c6074e3 100644
--- a/src/dataplane/mgr/sock_io.c
+++ b/src/dataplane/mgr/sock_io.c
@@ -39,6 +39,10 @@
 #include "thread.h"
 #include "lock.h"

+#ifdef HAVE_DPDK
+#include "dpdk.h"
+#endif /* HAVE_DPDK */
+
 static struct port_stats *rawsock_port_stats(struct port *port);

 #define NUM_PORTID 256
@@ -46,12 +50,10 @@ static struct port_stats *rawsock_port_stats(struct port *port);
 static struct pollfd pollfd[NUM_PORTID];
 static int ifindex[NUM_PORTID];

-#ifndef HAVE_DPDK
 static bool no_cache = true;
 static int kvs_type = FLOWCACHE_HASHMAP_NOLOCK;
 static int hashtype = HASH_TYPE_INTEL64;
 static struct flowcache *flowcache;
-#endif /* HAVE_DPDK */

 static bool volatile clear_cache = false;

@@ -636,13 +638,11 @@ dp_rawsock_thread_loop(__UNUSED const lagopus_thread_t *selfptr,
     return rv;
   }

-#ifndef HAVE_DPDK
   if (no_cache == false) {
     flowcache = init_flowcache(kvs_type);
   } else {
     flowcache = NULL;
   }
-#endif /* HAVE_DPDK */

   dparg = arg;
   running = dparg->running;
@@ -655,12 +655,10 @@ dp_rawsock_thread_loop(__UNUSED const lagopus_thread_t *selfptr,
       err(errno, "poll");
     }
     for (i = 0; i < portidx; i++) {
-#ifndef HAVE_DPDK
       if (clear_cache == true && flowcache != NULL) {
         clear_all_cache(flowcache);
         clear_cache = false;
       }
-#endif /* HAVE_DPDK */
       flowdb_rdlock(NULL);
       port = dp_port_lookup(DATASTORE_INTERFACE_TYPE_ETHERNET_RAWSOCK,
                             (uint32_t)i);
@@ -681,11 +679,8 @@ dp_rawsock_thread_loop(__UNUSED const lagopus_thread_t *selfptr,
       if (port->bridge != NULL &&
           (port->ofp_port.config & OFPPC_NO_RECV) == 0) {
         pkt = alloc_lagopus_packet();
-#ifndef HAVE_DPDK
-        if (flowcache != NULL) {
-          pkt->cache = flowcache;
-        }
-#endif /* HAVE_DPDK */
+        pkt->cache = flowcache;
+
         /* not enough? */
         (void)OS_M_APPEND(pkt->mbuf, MAX_PACKET_SZ);
         len = read_packet(pollfd[i].fd, OS_MTOD(pkt->mbuf, uint8_t *),
@@ -769,6 +764,11 @@ dp_rawsock_thread_init(int argc,

 lagopus_result_t
 dp_rawsock_thread_start(void) {
+#ifdef HAVE_DPDK
+  no_cache = app.no_cache;
+  kvs_type = app.kvs_type;
+  hashtype = app.hashtype;
+#endif /* HAVE_DPDK */
   return dp_thread_start(&rawsock_thread, &rawsock_lock, &rawsock_run);
 }

Could you check it on your environment?

from lagopus.

eugene-che avatar eugene-che commented on May 30, 2024

Hi @ynkjm,

The patch works as expected. Thank you!
The only thing that bothers me, the patched code does not handle failures of alloc_lagopus_packet.
I have encountered a crush at this site, while debugging my patch to fix the queue handling.

Eugene

from lagopus.

eugene-che avatar eugene-che commented on May 30, 2024

I have inserted the patched switch into another testbed. Unfortunately, it crashes.
The problem seems to be somewhere in cache:

  • gdb show instructions extracted from the cache point to a wrong piece of memory.
  • if I reapply my modification pkt->cache = NULL (which practically disables caching for rawsock interfaces) the switch stops crashing

I do not have any guesses for the source of error right now.

from lagopus.

ynkjm avatar ynkjm commented on May 30, 2024

Hi @eugene-che,

Thank you for your detail report. We are going to fix this segfault issue by reference to your patch.

from lagopus.

ynkjm avatar ynkjm commented on May 30, 2024

HI @eugene-che,

We have submitted a series of bug fix patch to the Lagopus 0.2.8 release.
We have fixed this issues by reference of your patch code.

Thanks,
Yoshi

from lagopus.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.