kohler / click

The Click modular router: fast modular packet processing and analysis
Other
749 stars 321 forks source link

multiple queue for one device #485

Closed john-smith-77 closed 3 years ago

john-smith-77 commented 3 years ago

hello I'm trying to assign multiple queues to the ToDevice element. my code :

FromDevice(ens33) -> c0 :: Classifier(12/0806 20/0001,
                                     12/0806 20/0002,
                                     12/0800,
                                     -);

out0 :: ToDevice(ens34);
outtcp :: Queue(1024);
outudp :: Queue(1024);
outoth :: Queue(1024);

outtcp, outudp, outoth -> out0;

// ARP request need to be answered, obviously
c0[0]
    -> ARPResponder(10.0.0.11 00:0c:29:64:45:48)
    -> outoth;

// ARP responses are handed to Linux
c0[1]
    -> ToHost;

// Non-IP packets are dropped
c0[3]
    -> Discard;

// Other IP packets. Split on UDP, TCP and rest
c0[2]
    -> Strip(14)
    -> CheckIPHeader()
    -> c1 :: Classifier(9/17, 9/06, -);

// TCP packets
c1[1] 
    -> Print(TCP)
    -> outtcp;

// UDP packets
c1[0]
    -> Print(UDP)
    -> outudp;

// non-UDP and non-TCP packets
c1[2] 
    -> Print(UNKNOWN)
    -> outoth;

but I got this error

addqueue.click:6: illegal reuse of ‘out0 :: ToDevice’ pull input 0
addqueue.click:6: illegal reuse of ‘out0 :: ToDevice’ pull input 0
Router could not be initialized!

is it possible to use multiple queues on a device? thanks.

tbarbette commented 3 years ago

You need to say how all the ToDevice should orchestrate the query of the 3 paths. For instance with a RoundRobinSched.

john-smith-77 commented 3 years ago

I tried with the dpdk device and add scheduler but I got this error

‘P1 :: PrioSched’ pull output 0 connected to ‘out0 :: ToDPDKDevice’ push input 0

modified code:

FromDPDKDevice(0) -> c0 :: Classifier(12/0806 20/0001,
                                     12/0806 20/0002,
                                     12/0800,
                                     -);

out0 :: ToDPDKDevice(1);

outtcp :: Queue(1024);
outudp :: Queue(1024);
outoth :: Queue(1024);

P1 :: PrioSched;
outtcp, outoth, outudp -> P1;
P1 -> out0;

// ARP request need to be answered, obviously
c0[0]
    -> Print("ARPResponder")
    -> ARPResponder(10.0.0.11 00:0c:29:64:45:48)
    -> outoth;

// ARP responses are handed to Linux
c0[1]
    -> Print("ToHost")
    -> Discard;
//    -> ToHost();

// Non-IP packets are dropped
c0[3]
    -> Print("Discard")
    -> Discard;

// Other IP packets. Split on UDP, TCP and rest
c0[2]
    -> Print("IP")
    -> Strip(14)
    -> CheckIPHeader()
    -> c1 :: Classifier(9/17, 9/06, -);

// TCP packets
c1[1] -> Print(TCP) -> outtcp;

// UDP packets
c1[0]
    -> Print(UDP)
    -> outudp;

// non-UDP and non-TCP packets
c1[2] -> Print(UNKNOWN) -> outoth;

and also I used round-robin

R1 :: RoundRobinSched;
P1 :: PrioSched;
outtcp, outoth, outudp -> R1;
R1 -> P1;

//outtcp, outudp, outoth -> P1;
P1 -> out0;
tbarbette commented 3 years ago

ToDPDKDevice is not a pull element, it's a push element, so you need push element before. RoundRobinSwitch is the "push" equivalent of RoundRobinSched. See page 18 of http://www-soc.lip6.fr/~genius/kohler-thesis.pdf for more information :)