Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to get MTU of an dpdk interface? #140

Open
JakkuSakura opened this issue Jul 4, 2021 · 2 comments · May be fixed by #141
Open

How to get MTU of an dpdk interface? #140

JakkuSakura opened this issue Jul 4, 2021 · 2 comments · May be fixed by #141
Labels
enhancement New feature or request

Comments

@JakkuSakura
Copy link
Contributor

I'm built an async high level network stack that supports websocket based on capsule(customized, runtime independent)/rawsocket and smoltcp.
Currently the mtu of rawsocket is fetched by pnet, mtu of dpdk device is hard coded. I would like to play around jumbo frames with multiple interfaces at the same time.
This requires getting MTU of a dpdk interface.
How to get MTU of an dpdk interface?

I can use ip a to get ena devices' MTU, but not igb_uio.

@JakkuSakura JakkuSakura added the enhancement New feature or request label Jul 4, 2021
@JakkuSakura
Copy link
Contributor Author

Okay, I got it. Unfunately port_id is not publicly visible

impl PortQueue {
    pub fn get_mtu(&self) -> std::io::Result<u16> {
        let mut result = MaybeUninit::uninit();
        unsafe {
            let errno = ffi::rte_eth_dev_get_mtu(self.port_id.raw(), result.as_mut_ptr());
            if errno == 0 {
                Ok(result.assume_init())
            } else {
                Err(std::io::Error::from_raw_os_error(errno))
            }
        }
    }
}

@JakkuSakura JakkuSakura linked a pull request Jul 4, 2021 that will close this issue
1 task
@harry-van-haaren
Copy link

Hi @qiujiangkun, (I'm a capsule noobie, but know a little about DPDK.. so this answer is mostly from DPDK knowledge.)

Indeed the rte_eth_dev_get_mtu function will get the MTU for the device, however I believe there is a limitation in Capsule at the moment that "multi-segment mbufs" are not supported, which means that the maximum size of any single frame must fit into the DPDK mbuf size (controlled by RTE_MBUF_DEFAULT_DATAROOM).

This is documented in the capsule source in mbuf.rs here; https://github.com/capsule-rs/capsule/blob/master/core/src/dpdk/mbuf.rs#L104

Hope this helps, -Harry

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging a pull request may close this issue.

2 participants