Commit Graph

105 Commits

Author SHA1 Message Date
Pim van Pelt
a4006ec5da Backport https://gerrit.fd.io/r/c/vpp/+/37026 2022-10-04 13:13:57 +00:00
Pim van Pelt
623973dc1f Backport https://gerrit.fd.io/r/c/vpp/+/36961 2022-10-04 13:11:53 +00:00
Pim van Pelt
a0ad5cc5cf Merge Gerrit 36176 from upstream 2022-06-03 20:33:48 +00:00
Pim van Pelt
786530701d Backport https://gerrit.fd.io/r/c/vpp/+/35719 2022-03-31 23:23:36 +00:00
Pim van Pelt
0bc3e01c9b Backport https://gerrit.fd.io/r/c/vpp/+/35528 2022-03-08 14:45:35 +00:00
Pim van Pelt
a68a6e89e5 Backport https://gerrit.fd.io/r/c/vpp/+/35519 2022-03-08 13:55:28 +00:00
Pim van Pelt
e6e6c11c78 Only signal NL_EVENT_READ once per read cycle, not once per netlink message - from https://gerrit.fd.io/r/c/vpp/+/35525 2022-03-08 13:50:37 +00:00
Pim van Pelt
a27fdb9911 Backport https://gerrit.fd.io/r/c/vpp/+/35523 2022-03-08 13:42:56 +00:00
Pim van Pelt
554988ebf6 Fix API errors - convert int32 to host order and null terminate vectors in the response 2022-03-08 10:08:59 +00:00
Pim van Pelt
f9441c5e03 bugfix - return in host order 2022-02-27 23:05:34 +00:00
Pim van Pelt
8a1c031ea9 backport https://gerrit.fd.io/r/c/vpp/+/35411 2022-02-22 20:42:11 +00:00
Pim van Pelt
5f3eb62be9 Reduce resource usage on virtio polling, also avoid potential (undiagnosed) dataplane lockup when running multiple threads: just poll with one RX queue per TAP 2022-02-20 19:19:58 +00:00
Pim van Pelt
ccd4b393e9 Roll back carrier set
-- it works fine for phy's that are carrier-up, but crashes if they are
   carrier-down.

0: /home/pim/src/vpp/src/vnet/interface_funcs.h:46 (vnet_get_hw_interface) assertion `! pool_is_free (vnm->interface_main.hw_interfaces, _e)' fails

    at /home/pim/src/vpp/src/vppinfra/error.c:143
    ns=0x7fff98774e80 "dataplane", host_sw_if_indexp=0x0) at /home/pim/src/vpp/src/plugins/lcpng/lcpng_interface.c:998
    at /home/pim/src/vpp/src/plugins/lcpng/lcpng_if_cli.c:96
    parent_command_index=371) at /home/pim/src/vpp/src/vlib/cli.c:591
    parent_command_index=0) at /home/pim/src/vpp/src/vlib/cli.c:548
    at /home/pim/src/vpp/src/vlib/cli.c:694
2021-12-24 21:12:24 +00:00
Pim van Pelt
ddd3ad372a Only set carrier up when hw is up 2021-12-24 21:04:15 +00:00
Pim van Pelt
1bbe17d586 Merge branch 'main' of github.com:pimvanpelt/lcpng into main 2021-12-24 20:05:57 +00:00
Pim van Pelt
b659de9266 When creating a sub-int from Linux, ensure that the tap subint is set admin-up 2021-12-24 20:05:39 +00:00
Pim van Pelt
fffb1e892a After fixing the feflags/frpflags bug, install specials again 2021-12-24 20:05:08 +00:00
Pim van Pelt
22e907555d Initialize the TAP carrier based on the (hardware) phy 2021-12-24 20:04:08 +00:00
Pim van Pelt
37300abf84 Update README.md
Add a hint about libmnl
2021-12-20 12:46:16 +01:00
Pim van Pelt
65fa49f30b Fix crash if netns is not set at startup 2021-12-19 21:46:00 +00:00
Pim van Pelt
d36f34b91d Fix type issue with route_path flags 2021-12-19 21:32:05 +00:00
Pim van Pelt
cd86f17454 Copy forward neale's improvement from upstream gerrit 33948 2021-11-29 22:26:44 +00:00
Pim van Pelt
a8879bfc54 Merge branch 'main' of github.com:pimvanpelt/lcpng into main 2021-11-29 20:19:46 +00:00
Pim van Pelt
cdf07cce34 Merge review feedback from mgsmith on upstream gerrit 33709 ps8..10 2021-11-29 20:19:34 +00:00
Pim van Pelt
cc2d6908a2 Merge review feedback from mgsmith on upstream gerrit 33709 ps8..10 2021-11-29 20:04:54 +00:00
Pim van Pelt
6caa5e8386 Followup of upstream 8e2b1b129815d3e631aa425ed37899c78ea24e65 addition of MFIB_ENTRY_FLAG_NONE 2021-11-07 18:21:58 +00:00
Pim van Pelt
852a590cf6 Update README.md 2021-10-08 07:56:54 +02:00
Pim van Pelt
bd8d8b40d6 Merge pull request #2 from theraphim/main
Don't crash when adding second interface to default namespace.
2021-10-08 07:52:19 +02:00
Paul Komkoff
b72707d560 Don't crash when adding second interface to default namespace.
Namespace members used to be char[], now they are vectors. Using
strlen on a default value for these vectors results in a segmentation
fault.

Use vec_cmp instead. While at it, fix the output format to be %v.
2021-10-08 01:27:45 +04:00
Pim van Pelt
92e3835cbe Merge pull request #1 from jin13417/main
Update README.md
2021-09-18 17:01:57 +02:00
jinshaohui
311dba085a Update README.md
I think ln -s soruce_dir. link_dir,this is wrong.
2021-09-18 22:00:25 +08:00
Pim van Pelt
4ed9d02693 Fix non NULL terminated strings (namespace and hostname are vectors) 2021-09-09 20:04:15 +00:00
Pim van Pelt
e2ac348759 'ns' is now a vector, don't memcpy it, but vec_dup() instead 2021-09-08 21:38:45 +00:00
Pim van Pelt
043fecb0e0 Only find the parent tap if it's necessary (ie. doesn't already exist in vif_index; change by mgsmith@ 2021-09-08 21:15:42 +00:00
Pim van Pelt
2c390ae512 Also set TAP carrier on netlink messages 2021-09-08 21:14:25 +00:00
Pim van Pelt
45cb9b4afc Cleanup interface sync
- move tap_set_carrier() upstream to lcp_itf_set_link_state()
- refuse to set admin-up on sub-int if parent is down
- no need to switch namespaces, lcp_itf_set_link_state() already does
- in change_mtu and change_admin_state, if the interface is a sub,
  we only have to sync that one interface. Otherwise, walk the parent
  interface and all sub-ints with lcp_itf_pair_sync_state_hw() and
  make note of this in the (DBG) log
2021-09-08 20:53:02 +00:00
Pim van Pelt
ba4d9d1a3c Add lcp_itf_pair_sync_state_hw() and only walk relevant int+subints, not all interfaces 2021-09-08 19:50:50 +00:00
Pim van Pelt
8b3356cd86 if sub_interface fails to create, return error and don't continue (fixes a crash) 2021-09-08 19:50:27 +00:00
Pim van Pelt
3c806d586d Accommodate Netgate's usecase, they create the linux netlink device first, and then call the pair_create; in that case, linux_parent_if_index already exists; simplify the call path here, h/t mgsmith@ 2021-09-08 18:41:35 +00:00
Pim van Pelt
36f1ebfdae Move check for parent_if_index up
copy review change from mgsmith@
2021-09-07 22:10:54 +00:00
Pim van Pelt
fdab236755 backport fix from mgsmith@ in VPP main repo 2021-09-07 21:13:55 +00:00
Pim van Pelt
15efc4efc2 Copy review notes from mgsmith@ from https://gerrit.fd.io/r/c/vpp/+/33481/12..13 2021-08-30 20:37:05 +00:00
Pim van Pelt
98a84d0fa7 Turn lip_namespace into a vector 2021-08-30 20:31:53 +00:00
Pim van Pelt
aa9158e1a2 Add logline in case setting rx/tx size fails 2021-08-29 22:02:57 +00:00
Pim van Pelt
9f7286d285 Update INFO logline 2021-08-29 19:10:03 +00:00
Pim van Pelt
fe5b52504f Restore insertion of connected routes 2021-08-29 18:50:28 +00:00
Pim van Pelt
82aa1bbc74 Merge from upstream 2021-08-29 17:52:22 +02:00
Pim van Pelt
6d86d2b075 Allow larger fraction of CPU to be used by netlink
Instead of doing BATCH_DELAY_MS work and BATCH_DELAY_MS sleep, add
a BATCH_WORK_MS (40) and lower BATCH_DELAY_MS (10), so we'll work
80% of the time, and consume netlink messages 20% of the time.

Also raise the total batch size to 8K because on my test machine
we run 2K in 13ms or 8K in ~50ms.
2021-08-29 17:47:33 +02:00
Pim van Pelt
7c864ed099 Temporary fix
Stop adding paths with add_special(); there is a scenario with Bird2
that makes this crash:
- Assume a VPP which has its fib fully synced
- Kill VPP
- Bird will see network devices remove, and mark all routes 'unreach'
- Start VPP
- Bird will see the devices come back, and issue netlink messages for
  each route that is unreach
- these become add_special() because they have no nexthop and are
  of type UNREACHABLE
- adding these to the FIB sometimes crashes in dpo handling

To avoid this, no longer add_special() -- as a caveat, manually inserted
routes to unreach/blackhole will not be explicitly added, however most
will be caught by fib-entry for default-route (which is a 'drop'). This
behavior should be fixed, but it's at the moment not obvious to me how
and I'd prefer this behavior over SIGABORT/SIGSEGV deeper in the code.
2021-08-29 17:07:40 +02:00
Pim van Pelt
8a57300b4c Tidy up locking
This is a little bit of a performance hit (consuming 2K msgs was 11ms, is now 18ms)
but putting the barrier locks inline is fragile and will eventually
cause an issue. As with Matt's pending plugin, sync and release the
barrier lock around the entire handler, rather than in-line.

Contrary to Matt's implementation, I am also going to lock route_add()
and route_del() because without the locking, I get spurious crashes.
2021-08-29 16:59:18 +02:00