Skip to content

Commit

Permalink
Revert "bpf local list"
Browse files Browse the repository at this point in the history
This reverts commit 314a0c8f07e2f895055823bd5a44346b0657fb7b.
  • Loading branch information
Geliang Tang committed Oct 16, 2024
1 parent b174ee7 commit 8e7fea5
Showing 1 changed file with 0 additions and 48 deletions.
48 changes: 0 additions & 48 deletions tools/testing/selftests/bpf/progs/mptcp_bpf_userspace_pm.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,43 +5,19 @@
#include "mptcp_bpf.h"

char _license[] SEC("license") = "GPL";
int use_bpf_list = 0;

struct {
__uint(type, BPF_MAP_TYPE_ARRAY);
__uint(max_entries, 256);
__type(key, int);
__type(value, struct mptcp_pm_addr_entry);
} mptcp_pm_list SEC(".maps");

extern bool CONFIG_MPTCP_IPV6 __kconfig __weak;

SEC("struct_ops")
void BPF_PROG(mptcp_pm_init, struct mptcp_sock *msk)
{
struct mptcp_pm_addr_entry *entry;
__u32 key = 0;

bpf_printk("BPF userspace PM (%s)",
CONFIG_MPTCP_IPV6 ? "IPv6" : "IPv4");

if (!use_bpf_list)
return;

//for (__u32 i = 0; i < MPTCP_SUBFLOWS_MAX; i++) {
entry = bpf_map_lookup_elem(&mptcp_pm_list, &key);
if (entry)
bpf_printk("id=%u", entry->addr.id);
//}
}

SEC("struct_ops")
void BPF_PROG(mptcp_pm_release, struct mptcp_sock *msk)
{
if (!use_bpf_list)
return;

//bpf_sk_storage_delete(&mptcp_pm_list_map, msk);
}

static int mptcp_userspace_pm_append_new_local_addr(struct mptcp_sock *msk,
Expand Down Expand Up @@ -146,35 +122,11 @@ static int mptcp_pm_remove_id_zero_address(struct mptcp_sock *msk)
return 0;
}

#if 0
static struct mptcp_pm_addr_entry *
bpf_mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_sock *msk, unsigned int id)
{
struct mptcp_pm_list_storage *storage;
struct mptcp_pm_addr_entry *entry;

storage = bpf_sk_storage_get(&mptcp_pm_list_map, msk, 0, 0);
if (!storage)
return NULL;

for (int i = 0; i < storage->nr && i < MPTCP_SUBFLOWS_MAX; i++) {
entry = storage->pm_list[i];
if (entry->addr.id == id)
return entry;
}

return NULL;
}
#endif

static struct mptcp_pm_addr_entry *
mptcp_userspace_pm_lookup_addr_by_id(struct mptcp_sock *msk, unsigned int id)
{
struct mptcp_pm_addr_entry *entry;

//if (use_bpf_list)
// return bpf_mptcp_userspace_pm_lookup_addr_by_id(msk, id);

bpf_for_each(mptcp_address, entry, msk) {
if (entry->addr.id == id)
return entry;
Expand Down

0 comments on commit 8e7fea5

Please sign in to comment.