Skip to content

Commit ae9cd31

Browse files
committed
copy rtnetlink fn signature for EthtoolChannelSetRequest::execute
1 parent b2e84b7 commit ae9cd31

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

src/channel/set.rs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
// SPDX-License-Identifier: MIT
22

3-
use futures::TryStream;
3+
use futures::StreamExt;
4+
use netlink_packet_core::{NetlinkMessage, NLM_F_ACK, NLM_F_REQUEST};
45
use netlink_packet_generic::GenlMessage;
56

67
use crate::{
7-
ethtool_execute, EthtoolAttr, EthtoolChannelAttr, EthtoolError,
8-
EthtoolHandle, EthtoolMessage,
8+
try_ethtool, EthtoolAttr, EthtoolChannelAttr, EthtoolError, EthtoolHandle,
9+
EthtoolMessage,
910
};
1011

1112
pub struct EthtoolChannelSetRequest {
@@ -49,10 +50,7 @@ impl EthtoolChannelSetRequest {
4950
self
5051
}
5152

52-
pub async fn execute(
53-
self,
54-
) -> impl TryStream<Ok = GenlMessage<EthtoolMessage>, Error = EthtoolError>
55-
{
53+
pub async fn execute(self) -> Result<(), EthtoolError> {
5654
let EthtoolChannelSetRequest {
5755
mut handle,
5856
mut message,
@@ -83,6 +81,17 @@ impl EthtoolChannelSetRequest {
8381
));
8482
}
8583

86-
ethtool_execute(&mut handle, false, message).await
84+
let mut nl_msg =
85+
NetlinkMessage::from(GenlMessage::from_payload(message));
86+
87+
nl_msg.header.flags = NLM_F_REQUEST | NLM_F_ACK;
88+
89+
let mut response = handle.request(nl_msg).await?;
90+
91+
while let Some(message) = response.next().await {
92+
try_ethtool!(message);
93+
}
94+
95+
Ok(())
8796
}
8897
}

0 commit comments

Comments
 (0)