Skip to content

Commit

Permalink
[API break] link: Remove LinkAttribute::Weight as not used
Browse files Browse the repository at this point in the history
The linux kernel 6.5.8 has no code using IFLA_WEIGHT, only has type
definition there, no dump or set function for it. Hence removing.

Signed-off-by: Gris Ge <[email protected]>
  • Loading branch information
cathay4t committed Dec 3, 2023
1 parent b3574e2 commit 14a4bb7
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/link/attribute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,17 @@ const IFLA_MTU: u16 = 4;
const IFLA_LINK: u16 = 5;
const IFLA_QDISC: u16 = 6;
const IFLA_STATS: u16 = 7;
// No kernel is using IFLA_COST
// No kernel code is using IFLA_COST
// const IFLA_COST: u16 = 8;
// No kernel is using IFLA_PRIORITY
// No kernel code is using IFLA_PRIORITY
// const IFLA_PRIORITY: u16 = 9;
const IFLA_MASTER: u16 = 10;
const IFLA_WIRELESS: u16 = 11;
const IFLA_PROTINFO: u16 = 12;
const IFLA_TXQLEN: u16 = 13;
const IFLA_MAP: u16 = 14;
const IFLA_WEIGHT: u16 = 15;
// No kernel code is using IFLA_WEIGHT
// const IFLA_WEIGHT: u16 = 15;
const IFLA_OPERSTATE: u16 = 16;
const IFLA_LINKMODE: u16 = 17;
const IFLA_LINKINFO: u16 = 18;
Expand Down Expand Up @@ -91,7 +92,6 @@ const IFLA_DEVLINK_PORT: u16 = 62;
#[derive(Debug, PartialEq, Eq, Clone)]
#[non_exhaustive]
pub enum LinkAttribute {
Weight(Vec<u8>),
VfInfoList(Vec<u8>),
VfPorts(Vec<u8>),
PortSelf(Vec<u8>),
Expand Down Expand Up @@ -157,8 +157,7 @@ pub enum LinkAttribute {
impl Nla for LinkAttribute {
fn value_len(&self) -> usize {
match self {
Self::Weight(bytes)
| Self::VfInfoList(bytes)
Self::VfInfoList(bytes)
| Self::VfPorts(bytes)
| Self::PortSelf(bytes)
| Self::PhysPortId(bytes)
Expand Down Expand Up @@ -219,8 +218,7 @@ impl Nla for LinkAttribute {

fn emit_value(&self, buffer: &mut [u8]) {
match self {
Self::Weight(bytes)
| Self::VfInfoList(bytes)
Self::VfInfoList(bytes)
| Self::VfPorts(bytes)
| Self::PortSelf(bytes)
| Self::PhysPortId(bytes)
Expand Down Expand Up @@ -289,7 +287,6 @@ impl Nla for LinkAttribute {

fn kind(&self) -> u16 {
match self {
Self::Weight(_) => IFLA_WEIGHT,
Self::VfInfoList(_) => IFLA_VFINFO_LIST,
Self::VfPorts(_) => IFLA_VF_PORTS,
Self::PortSelf(_) => IFLA_PORT_SELF,
Expand Down Expand Up @@ -357,7 +354,6 @@ impl<'a, T: AsRef<[u8]> + ?Sized>
) -> Result<Self, DecodeError> {
let payload = buf.value();
Ok(match buf.kind() {
IFLA_WEIGHT => Self::Weight(payload.to_vec()),
IFLA_VFINFO_LIST => Self::VfInfoList(payload.to_vec()),
IFLA_VF_PORTS => Self::VfPorts(payload.to_vec()),
IFLA_PORT_SELF => Self::PortSelf(payload.to_vec()),
Expand Down

0 comments on commit 14a4bb7

Please sign in to comment.