Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
dc0b98a1
Commit
dc0b98a1
authored
Jan 23, 2023
by
David S. Miller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ethtool: Add and use ethnl_update_bool.
Signed-off-by:
David S. Miller
<
davem@davemloft.net
>
parent
7a981431
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
net/ethtool/mm.c
net/ethtool/mm.c
+1
-1
net/ethtool/netlink.h
net/ethtool/netlink.h
+26
-0
No files found.
net/ethtool/mm.c
View file @
dc0b98a1
...
...
@@ -225,7 +225,7 @@ int ethnl_set_mm(struct sk_buff *skb, struct genl_info *info)
ethnl_update_u32
(
&
cfg
.
verify_time
,
tb
[
ETHTOOL_A_MM_VERIFY_TIME
],
&
mod
);
ethnl_update_bool
(
&
cfg
.
tx_enabled
,
tb
[
ETHTOOL_A_MM_TX_ENABLED
],
&
mod
);
ethnl_update_bool
(
&
cfg
.
pmac_enabled
,
tb
[
ETHTOOL_A_MM_PMAC_ENABLED
],
&
mod
);
&
mod
);
ethnl_update_u32
(
&
cfg
.
tx_min_frag_size
,
tb
[
ETHTOOL_A_MM_TX_MIN_FRAG_SIZE
],
&
mod
);
...
...
net/ethtool/netlink.h
View file @
dc0b98a1
...
...
@@ -137,6 +137,32 @@ static inline void ethnl_update_bool32(u32 *dst, const struct nlattr *attr,
*
mod
=
true
;
}
/**
* ethnl_update_bool() - updateb bool used as bool from NLA_U8 attribute
* @dst: value to update
* @attr: netlink attribute with new value or null
* @mod: pointer to bool for modification tracking
*
* Use the bool value from NLA_U8 netlink attribute @attr to set bool variable
* pointed to by @dst to 0 (if zero) or 1 (if not); do nothing if @attr is
* null. Bool pointed to by @mod is set to true if this function changed the
* logical value of *dst, otherwise it is left as is.
*/
static
inline
void
ethnl_update_bool
(
bool
*
dst
,
const
struct
nlattr
*
attr
,
bool
*
mod
)
{
u8
val
;
if
(
!
attr
)
return
;
val
=
!!
nla_get_u8
(
attr
);
if
(
!!*
dst
==
val
)
return
;
*
dst
=
val
;
*
mod
=
true
;
}
/**
* ethnl_update_binary() - update binary data from NLA_BINARY attribute
* @dst: value to update
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment