NetSys / bess

BESS: Berkeley Extensible Software Switch
Other
313 stars 156 forks source link

add NIC to BESS in promiscous mode #777

Closed ppnaik1890 closed 6 years ago

ppnaik1890 commented 6 years ago

Hi,

I have made my enp7s0f1 a DPDK NIC

Network devices using DPDK-compatible driver
============================================
0000:07:00.1 'I350 Gigabit Network Connection' drv=igb_uio unused=igb,uio_pci_generic

Network devices using kernel driver
===================================
0000:07:00.0 'I350 Gigabit Network Connection' if=enp7s0f0 drv=igb unused=igb_uio,uio_pci_generic *Active*

I have attached this NIC to BESS as below:

myport::PMDPort(port_id=0, num_inc_q=1, num_out_q=1)
input0::QueueInc(port=myport, qid=0)
output0::QueueOut(port=myport, qid=0)

How can I run the interface in promiscous mode so that it is able to forward all packets it gets to the forwader?

My BESS script is as follows:

#nic
myport::PMDPort(port_id=0, num_inc_q=1, num_out_q=1)
input0::QueueInc(port=myport, qid=0)
output0::QueueOut(port=myport, qid=0)

my_vhost0::PMDPort(vdev='eth_vhost0,iface=/tmp/my_vhost0.sock,queues=1') #vm1
my_vhost1::PMDPort(vdev='eth_vhost1,iface=/tmp/my_vhost1.sock,queues=1') #vm2

i0::QueueInc(port=my_vhost0, qid=0) #This module will read from my_vhost0 on queue 0
i1::QueueInc(port=my_vhost1, qid=0) #This module will read from my_vhost1 on queue 0

o0::QueueOut(port=my_vhost0, qid=0) #This module will write to my_vhost0 on queue 0
o1::QueueOut(port=my_vhost1, qid=0) #This module will write to my_vhost1 on queue 0

fib = L2Forward()
fib.add(entries=[{'addr':'02:00:00:00:00:01', 'gate':0}]) #vm1
fib.add(entries=[{'addr':'02:00:00:00:00:02', 'gate':1}]) #vm2

fib.add(entries=[{'addr':'00:1e:67:49:7b:a4', 'gate':2}]) #for nic

fib.add(entries=[{'addr':'ff:ff:ff:ff:ff:ff', 'gate':10}]) #arp request (need broadcasting)

i0 -> fib
i1 -> fib
input0 -> fib

fib:0 -> o0
fib:1 -> o1
fib:2 -> output0

fib:10 -> repl::Replicate(gates=[0,1,2])

repl:0 -> o0
repl:1 -> o1
repl:2 -> output0

Thanks, Priyanka

sangjinhan commented 6 years ago

Hi,

By default for all PMDPort ports promiscuous should be enabled: https://github.com/NetSys/bess/blob/master/core/drivers/pmd.cc#L267

Please let me know if you find this is not the case.