NetSys / bess

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

Cannot start vhost port - Ubuntu 20.04 5.8.0-63 kernel #1032

Closed manojmpanicker closed 3 years ago

manojmpanicker commented 3 years ago

I'm trying to get a create a vhost interface as shown below following the example semantics provided in the documentation: VhostUser0::PMDPort(name='VhostUser0',vdev='vhost0,iface=/tmp/vhost_user0.sock,queues=1')

but I run into a failure: _localhost:10514 $ run samples/mysample Error: Unhandled exception in the configuration script (most recent call last) File "/home/amd/BESS/bess/bessctl/conf/samples/mysample.bess", line 5, in VhostUser0::PMDPort(name='VhostUser_0',vdev='vhost0,iface=/tmp/vhost_user0.sock,queues=1') File "/home/amd/BESS/bess/bessctl/commands.py", line 139, in __bess_module__ return make_modules([module_names])[0] File "/home/amd/BESS/bess/bessctl/commands.py", line 119, in make_modules obj = mclass_obj(args, name=module, kwargs) TypeError: type object got multiple values for keyword argument 'name'_

Another simple test using a basic forwarding conf script shown below worked fine: _dpdkp0::PMDPort(port_id=0, num_inc_q=1, num_out_q=1) dpdkp1::PMDPort(port_id=1, num_inc_q=1, num_out_q=1)

InDpdkP0::QueueInc(port=dpdkp0, qid=0) InDpdkP1::QueueInc(port=dpdkp1, qid=0)

OutDpdkP0::QueueOut(port=dpdkp0, qid=0) OutDpdkP1::QueueOut(port=dpdkp1, qid=0)

InDpdkP0 -> OutDpdkP0 InDpdkP1 -> OutDpdkP1_

I just added the line to create the vhost interface when I ran into this failure.

The git commit for the BESS sources is commit ae52fc5804290fc3116daf2aef52226fafcedf5d

Python version is Python 3.8.10.

krsna1729 commented 3 years ago
TypeError: type object got multiple values for keyword argument 'name'

You are sending the name explicitly as well as implicitly by using the syntactic sugar

VhostUser0::PMDPort(name='VhostUser0',vdev='vhost0,iface=/tmp/vhost_user0.sock,queues=1')

Instead, do this

VhostUser0::PMDPort(vdev='vhost0,iface=/tmp/vhost_user0.sock,queues=1')
manojmpanicker commented 3 years ago

I had tried that as well but that ran into another error:

Error: Unhandled exception in the configuration script (most recent call last) File "/home/amd/BESS/bess/bessctl/conf/samples/mysample.bess", line 7, in VhostUser0::PMDPort(vdev='vhost0,iface=/tmp/vhost_user0.sock,queues=1') File "/home/amd/BESS/bess/bessctl/commands.py", line 139, in __bess_module__ return make_modules([module_names])[0] File "/home/amd/BESS/bess/bessctl/commands.py", line 119, in make_modules obj = mclass_obj(args, name=module, kwargs) File "/home/amd/BESS/bess/bessctl/../pybess/port.py", line 41, in init ret = self.bess.create_port(self.driver, name, File "/home/amd/BESS/bess/bessctl/../pybess/bess.py", line 389, in create_port return self._request('CreatePort', request) File "/home/amd/BESS/bess/bessctl/../pybess/bess.py", line 278, in _request raise self.Error(code, errmsg, query=name, query_arg=req_dict) *** Error: Cannot attach vdev vhost0,iface=/tmp/vhost_user0.sock,queues=1 BESS daemon response - errno=19 (ENODEV: No such device) query: CreatePort query_arg: {'name': 'VhostUser0', 'driver': 'PMDPort', 'arg': {'type_url': 'type.googleapis.com/bess.pb.PMDPortArg', 'value': b'"+vhost0,iface=/tmp/vhost_user0.sock,queues=1'}}

krsna1729 commented 3 years ago

@manojmpanicker net_ prefix is required when conveying vdev names as per DPDK. These errors are reported by DPDK. BESS simply passes the args.

https://github.com/DPDK/dpdk/blob/v20.11/drivers/net/vhost/rte_eth_vhost.c#L1663-L1673

Try this

VhostUser0::PMDPort(vdev='net_vhost0,iface=/tmp/vhost_user0.sock,queues=1')
manojmpanicker commented 3 years ago

Thanks @krsna1729. With the change you suggested, I am able to create the vhost interfaces and create a pipeline with them.