Re: Common hash function for kernel and user space in XDP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Dec 4, 2017 at 6:39 AM, Anmol Panda
<anmol07.visitor@xxxxxxxxxxxxxx> wrote:
> Hello All,
>    We are trying to implement L2 forwarding in xdp and we need to convert
> the mac-address to a hash value. Thus far, we have tried using crc32
> functions from <linux/crc32.h> for kernel space but it can't be used in user
> space. We need a common crc hash function for both kernel and user space.
>
>    The kernel crc function causes the following error:
>
> invalid relo for insn[24].code 0x85
> bpf_load_program() err=22
> 0: (61) r2 = *(u32 *)(r1 +4)
> 1: (61) r1 = *(u32 *)(r1 +0)
> .
> .
> .
> 23: (b7) r3 = 6
> 24: (85) call unknown#-1
> BPF_CALL uses reserved fields

The kernel crc function eventually calls crc32_le_shift or other variants
in lib/crc32.c. BPF program is able to resolve the reference to
crc32_le_shift at verification time, hence you will see the failure above.

You may need to implement one or re-structure an existing implementation
(e.g. the one from linux) into separate header files, so you can include in
both bpf program and your user space application.

>
>
>    Can you please point to some examples or references?
>    We would be highly grateful.
>
> Thanks,
> Sincerely,
>



[Index of Archives]     [Linux Networking Development]     [Fedora Linux Users]     [Linux SCTP]     [DCCP]     [Gimp]     [Yosemite Campsites]

  Powered by Linux