xdp-project / xdp-tutorial

XDP tutorial
2.43k stars 574 forks source link

xdp, af_xdp with optical fiber nic #247

Open Adarsh97 opened 2 years ago

Adarsh97 commented 2 years ago

Does xdp, af_xdp work with optical fiber nic like ethernet nic? It seems like I am getting one error, "can't setup af_xdp socket, resource busy". Is there any driver parameter setting required or any other setting ?

chaudron commented 2 years ago

Does the driver support XDP? If not, you need to use skb-mode.

Adarsh97 commented 2 years ago

How to check whether driver support xdp ? If it's not supporting how to use skb mode, which flag I need to set ?

chaudron commented 2 years ago

The af_xdp example has the --skb-mode option to accomplish this. Not sure how up-to-date the below list is, but you can look at the driver code yourself.

https://github.com/iovisor/bcc/blob/master/docs/kernel-versions.md#xdp

Adarsh97 commented 2 years ago

I am able to load xdp and create af_xdp socket, but in fiber optic nic unable to receive packets, I have made ethtool -L interfacename combined 1, what change I have to make to address the above issue

Adarsh97 commented 2 years ago

I am able to load xdp and create af_xdp socket in fiber nic , but unable to receive packets, I have made ethtool -L interfacename combined 1, what change I have to make to address the above issue

On Fri, Oct 1, 2021, 14:17 Eelco Chaudron @.***> wrote:

The af_xdp example has the --skb-mode option to accomplish this. Not sure how up-to-date the below list is, but you can look at the driver code yourself.

https://github.com/iovisor/bcc/blob/master/docs/kernel-versions.md#xdp

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xdp-project/xdp-tutorial/issues/247#issuecomment-932042360, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLUHWPZEXLM55XHIFOOJJ3UEVYTTANCNFSM5FCU65MA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

chaudron commented 2 years ago

I assume you are running the base ./af_xdp_user --skb-mode program which normally eats all packets? If so, when the program is running do you still see the packets reaching the kernel?

To make sure your kernel works correctly, is the ad_xdp_user program working in the testenv.sh?

Adarsh97 commented 2 years ago

I am not using --skb-mode, when I am running with xdp and af_xdp I am unable to see packets in tcpdump, but no packet is received in user space program, but when xdp is not running tcpdump showing the packets,

On Fri, Oct 1, 2021, 20:33 Eelco Chaudron @.***> wrote:

I assume you are running the base ./af_xdp_user --skb-mode program which normally eats all packets? If so, when the program is running do you still see the packets reaching the kernel?

To make sure your kernel works correctly, is the ad_xdp_user program working in the testenv.sh?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xdp-project/xdp-tutorial/issues/247#issuecomment-932308303, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLUHWKLBX7UFCHI5DRZZQDUEXES5ANCNFSM5FCU65MA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

chaudron commented 2 years ago

To make sure your kernel works correctly, is the af_xdp_user program working in the testenv.sh?

In addition, can you try with --skb-mode?

Adarsh97 commented 2 years ago

How to use skb-mode in xdp ? Any flag I need to use?

On Fri, Oct 1, 2021, 20:41 Eelco Chaudron @.***> wrote:

To make sure your kernel works correctly, is the af_xdp_user program working in the testenv.sh?

In addition, can you try with --skb-mode?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xdp-project/xdp-tutorial/issues/247#issuecomment-932316208, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLUHWLNRCTYSR3U7MLTJU3UEXFTNANCNFSM5FCU65MA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Adarsh97 commented 2 years ago

The interesting thing is the same xdp code working with ethernet nic (copper) not working with optical fiber nic. What magic is this ?? I am following the af_xdp sample code present in the xdp tutorial

On Fri, Oct 1, 2021, 21:07 Adarsh Sunilkumar @.***> wrote:

How to use skb-mode in xdp ? Any flag I need to use?

On Fri, Oct 1, 2021, 20:41 Eelco Chaudron @.***> wrote:

To make sure your kernel works correctly, is the af_xdp_user program working in the testenv.sh?

In addition, can you try with --skb-mode?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xdp-project/xdp-tutorial/issues/247#issuecomment-932316208, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLUHWLNRCTYSR3U7MLTJU3UEXFTNANCNFSM5FCU65MA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Adarsh97 commented 2 years ago

any observation or hint ?

chaudron commented 2 years ago

How to use skb-mode in xdp ? Any flag I need to use?

Use the --skb-mode flag with the tutorial program

The interesting thing is the same xdp code working with ethernet nic (copper) not working with optical fiber nic.

Is this on the same kernel/machine? Is this the same type of nic (same driver)? What NICs are you using?

Adarsh97 commented 2 years ago

The program is working in fiber nic, if I am using a sleep or poll function while calling handle_packet function like below. While (1) { usleep(1) or poll(fd) Handle_receive_packet() } If I am using an infinite loop for calling handle_packet like below it's not working While (1) { Handle_receive_packet() } But both the cases working in copper. The difference I am seeing is in fiber nic, I am unable to edit rx-usecs with ethtool, it's default value is 50. But in copper it's editable, I am making 0. The driver is i40e for fiber, I am running in rhel 8.4

On Mon, Oct 4, 2021, 13:39 Eelco Chaudron @.***> wrote:

How to use skb-mode in xdp ? Any flag I need to use?

Use the --skb-mode flag with the tutorial program

The interesting thing is the same xdp code working with ethernet nic (copper) not working with optical fiber nic.

Is this on the same kernel/machine? Is this the same type of nic (same driver)? What NICs are you using?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/xdp-project/xdp-tutorial/issues/247#issuecomment-933246314, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFLUHWPLZCUHFB33WWZF7ATUFFOKBANCNFSM5FCU65MA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Adarsh97 commented 2 years ago

The above case iw working with fiber also if i am doing polling from user space, initially i was doing run to completion model. I am not getting why it is not working in run to completion model.