summaryrefslogtreecommitdiff
path: root/lib/route/link/sriov.c
diff options
context:
space:
mode:
authorAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:12:28 +0000
committerAndroid Build Coastguard Worker <android-build-coastguard-worker@google.com>2023-07-07 05:12:28 +0000
commit6b8312f5be79bdf27d8d2623aacc05d3a721f173 (patch)
treec3f5bbb44c1db5edd68bb4db506435012b92eeff /lib/route/link/sriov.c
parent083e67d2c8d40f21df5c05c31eaa350a02822691 (diff)
parent65a8683b07ce5587dd2e3c9d0cdb40c40e6f7687 (diff)
downloadlibnl-6b8312f5be79bdf27d8d2623aacc05d3a721f173.tar.gz
Change-Id: I2fb6ca805434764648bba8429f3fe44f3a2f3275
Diffstat (limited to 'lib/route/link/sriov.c')
-rw-r--r--lib/route/link/sriov.c24
1 files changed, 8 insertions, 16 deletions
diff --git a/lib/route/link/sriov.c b/lib/route/link/sriov.c
index 2a87cfe5..3a728147 100644
--- a/lib/route/link/sriov.c
+++ b/lib/route/link/sriov.c
@@ -1,11 +1,5 @@
+/* SPDX-License-Identifier: LGPL-2.1-only */
/*
- * lib/route/link/sriov.c SRIOV VF Info
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation version 2.1
- * of the License.
- *
* Copyright (c) 2016 Intel Corp. All rights reserved.
* Copyright (c) 2016 Jef Oliver <jef.oliver@intel.com>
*/
@@ -92,7 +86,7 @@ int rtnl_link_sriov_clone(struct rtnl_link *dst, struct rtnl_link *src) {
nl_vf_vlans_t *src_vlans = NULL, *dst_vlans = NULL;
nl_vf_vlan_info_t *src_vlan_info = NULL, *dst_vlan_info = NULL;
- if (!(err = rtnl_link_has_vf_list(src)))
+ if (!rtnl_link_has_vf_list(src))
return 0;
dst->l_vf_list = rtnl_link_vf_alloc();
@@ -129,7 +123,7 @@ int rtnl_link_sriov_clone(struct rtnl_link *dst, struct rtnl_link *src) {
dst_vlan_info = dst_vlans->vlans;
memcpy(dst_vlans, src_vlans, sizeof(nl_vf_vlans_t));
memcpy(dst_vlan_info, src_vlan_info,
- dst_vlans->size * sizeof(dst_vlan_info));
+ dst_vlans->size * sizeof(*dst_vlan_info));
d_vf->vf_vlans = dst_vlans;
}
@@ -213,10 +207,9 @@ static void dump_vf_details(struct rtnl_link_vf *vf_data,
/* Loop through SRIOV VF list dump details */
void rtnl_link_sriov_dump_details(struct rtnl_link *link,
struct nl_dump_params *p) {
- int err;
struct rtnl_link_vf *vf_data, *list, *next;
- if (!(err = rtnl_link_has_vf_list(link)))
+ if (!rtnl_link_has_vf_list(link))
BUG();
nl_dump(p, " SRIOV VF List\n");
@@ -235,7 +228,7 @@ static void dump_vf_stats(struct rtnl_link_vf *vf_data,
char *unit;
float res;
- nl_dump(p, " VF %" PRIu64 " Stats:\n", vf_data->vf_index);
+ nl_dump(p, " VF %u Stats:\n", vf_data->vf_index);
nl_dump_line(p, "\tRX: %-14s %-10s %-10s %-10s\n",
"bytes", "packets", "multicast", "broadcast");
@@ -277,10 +270,9 @@ void rtnl_link_sriov_dump_stats(struct rtnl_link *link,
/* Free stored SRIOV VF data */
void rtnl_link_sriov_free_data(struct rtnl_link *link) {
- int err = 0;
struct rtnl_link_vf *list, *vf, *next;
- if (!(err = rtnl_link_has_vf_list(link)))
+ if (!rtnl_link_has_vf_list(link))
return;
list = link->l_vf_list;
@@ -656,7 +648,7 @@ int rtnl_link_sriov_parse_vflist(struct rtnl_link *link, struct nlattr **tb) {
}
if (t[IFLA_VF_STATS]) {
- err = nla_parse_nested(stb, IFLA_VF_STATS_MAX,
+ err = nla_parse_nested(stb, RTNL_LINK_VF_STATS_MAX,
t[IFLA_VF_STATS],
sriov_stats_policy);
if (err < 0) {
@@ -683,7 +675,7 @@ int rtnl_link_sriov_parse_vflist(struct rtnl_link *link, struct nlattr **tb) {
RTNL_LINK_VF_STATS_MULTICAST,
IFLA_VF_STATS_MULTICAST);
- vf_data->ce_mask |= IFLA_VF_STATS;
+ vf_data->ce_mask |= SRIOV_ATTR_STATS;
}
if (t[IFLA_VF_TRUST]) {