Skip to content

Commit ab54aa6

Browse files
committed
Merge: CNB97: devlink: update devlink to the v6.15
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/6888 JIRA: https://issues.redhat.com/browse/RHEL-75600 Driver update to version v6.15 Signed-off-by: Petr Oros <[email protected]> Approved-by: Ivan Vecera <[email protected]> Approved-by: Michal Schmidt <[email protected]> Approved-by: CKI KWF Bot <[email protected]> Merged-by: Augusto Caringi <[email protected]>
2 parents 6ece701 + 4971c25 commit ab54aa6

File tree

16 files changed

+217
-199
lines changed

16 files changed

+217
-199
lines changed

Documentation/netlink/specs/devlink.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1868,6 +1868,7 @@ operations:
18681868
- info-version-fixed
18691869
- info-version-running
18701870
- info-version-stored
1871+
- info-board-serial-number
18711872
dump:
18721873
reply: *info-get-reply
18731874

include/linux/pldmfw.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,17 @@ struct pldmfw_ops;
125125
* a pointer to their own data, used to implement the device specific
126126
* operations.
127127
*/
128+
129+
enum pldmfw_update_mode {
130+
PLDMFW_UPDATE_MODE_FULL,
131+
PLDMFW_UPDATE_MODE_SINGLE_COMPONENT,
132+
};
133+
128134
struct pldmfw {
129135
const struct pldmfw_ops *ops;
130136
struct device *dev;
137+
u16 component_identifier;
138+
enum pldmfw_update_mode mode;
131139
};
132140

133141
bool pldmfw_op_pci_match_record(struct pldmfw *context, struct pldmfw_record *record);

include/net/devlink.h

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ struct devlink_port_phys_attrs {
3737
/**
3838
* struct devlink_port_pci_pf_attrs - devlink port's PCI PF attributes
3939
* @controller: Associated controller number
40-
* @pf: Associated PCI PF number for this port.
40+
* @pf: associated PCI function number for the devlink port instance
4141
* @external: when set, indicates if a port is for an external controller
4242
*/
4343
struct devlink_port_pci_pf_attrs {
@@ -49,8 +49,9 @@ struct devlink_port_pci_pf_attrs {
4949
/**
5050
* struct devlink_port_pci_vf_attrs - devlink port's PCI VF attributes
5151
* @controller: Associated controller number
52-
* @pf: Associated PCI PF number for this port.
53-
* @vf: Associated PCI VF for of the PCI PF for this port.
52+
* @pf: associated PCI function number for the devlink port instance
53+
* @vf: associated PCI VF number of a PF for the devlink port instance;
54+
* VF number starts from 0 for the first PCI virtual function
5455
* @external: when set, indicates if a port is for an external controller
5556
*/
5657
struct devlink_port_pci_vf_attrs {
@@ -63,8 +64,8 @@ struct devlink_port_pci_vf_attrs {
6364
/**
6465
* struct devlink_port_pci_sf_attrs - devlink port's PCI SF attributes
6566
* @controller: Associated controller number
66-
* @sf: Associated PCI SF for of the PCI PF for this port.
67-
* @pf: Associated PCI PF number for this port.
67+
* @sf: associated SF number of a PF for the devlink port instance
68+
* @pf: associated PCI function number for the devlink port instance
6869
* @external: when set, indicates if a port is for an external controller
6970
*/
7071
struct devlink_port_pci_sf_attrs {
@@ -1280,6 +1281,18 @@ enum devlink_trap_group_generic_id {
12801281
.min_burst = _min_burst, \
12811282
}
12821283

1284+
#define devlink_fmsg_put(fmsg, name, value) ( \
1285+
_Generic((value), \
1286+
bool : devlink_fmsg_bool_pair_put, \
1287+
u8 : devlink_fmsg_u8_pair_put, \
1288+
u16 : devlink_fmsg_u32_pair_put, \
1289+
u32 : devlink_fmsg_u32_pair_put, \
1290+
u64 : devlink_fmsg_u64_pair_put, \
1291+
int : devlink_fmsg_u32_pair_put, \
1292+
char * : devlink_fmsg_string_pair_put, \
1293+
const char * : devlink_fmsg_string_pair_put) \
1294+
(fmsg, name, (value)))
1295+
12831296
enum {
12841297
/* device supports reload operations */
12851298
DEVLINK_F_RELOAD = 1UL << 0,
@@ -1550,6 +1563,7 @@ int devl_trylock(struct devlink *devlink);
15501563
void devl_unlock(struct devlink *devlink);
15511564
void devl_assert_locked(struct devlink *devlink);
15521565
bool devl_lock_is_held(struct devlink *devlink);
1566+
DEFINE_GUARD(devl, struct devlink *, devl_lock(_T), devl_unlock(_T));
15531567

15541568
struct ib_device;
15551569

@@ -1807,12 +1821,6 @@ int devl_resource_register(struct devlink *devlink,
18071821
u64 resource_id,
18081822
u64 parent_resource_id,
18091823
const struct devlink_resource_size_params *size_params);
1810-
int devlink_resource_register(struct devlink *devlink,
1811-
const char *resource_name,
1812-
u64 resource_size,
1813-
u64 resource_id,
1814-
u64 parent_resource_id,
1815-
const struct devlink_resource_size_params *size_params);
18161824
void devl_resources_unregister(struct devlink *devlink);
18171825
void devlink_resources_unregister(struct devlink *devlink);
18181826
int devl_resource_size_get(struct devlink *devlink,
@@ -1825,15 +1833,8 @@ void devl_resource_occ_get_register(struct devlink *devlink,
18251833
u64 resource_id,
18261834
devlink_resource_occ_get_t *occ_get,
18271835
void *occ_get_priv);
1828-
void devlink_resource_occ_get_register(struct devlink *devlink,
1829-
u64 resource_id,
1830-
devlink_resource_occ_get_t *occ_get,
1831-
void *occ_get_priv);
18321836
void devl_resource_occ_get_unregister(struct devlink *devlink,
18331837
u64 resource_id);
1834-
1835-
void devlink_resource_occ_get_unregister(struct devlink *devlink,
1836-
u64 resource_id);
18371838
int devl_params_register(struct devlink *devlink,
18381839
const struct devlink_param *params,
18391840
size_t params_count);
@@ -2035,6 +2036,7 @@ int devlink_compat_switch_id_get(struct net_device *dev,
20352036

20362037
int devlink_nl_port_handle_fill(struct sk_buff *msg, struct devlink_port *devlink_port);
20372038
size_t devlink_nl_port_handle_size(struct devlink_port *devlink_port);
2039+
void devlink_fmsg_dump_skb(struct devlink_fmsg *fmsg, const struct sk_buff *skb);
20382040

20392041
#else
20402042

lib/pldmfw/pldmfw.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,9 +481,17 @@ static int pldm_parse_components(struct pldmfw_priv *data)
481481
component->component_data = data->fw->data + offset;
482482
component->component_size = size;
483483

484+
if (data->context->mode == PLDMFW_UPDATE_MODE_SINGLE_COMPONENT &&
485+
data->context->component_identifier != component->identifier)
486+
continue;
487+
484488
list_add_tail(&component->entry, &data->components);
485489
}
486490

491+
if (data->context->mode == PLDMFW_UPDATE_MODE_SINGLE_COMPONENT &&
492+
list_empty(&data->components))
493+
return -ENOENT;
494+
487495
header_crc_ptr = data->fw->data + data->offset;
488496

489497
err = pldm_move_fw_offset(data, sizeof(data->header_crc));

net/core/netdev-genl-gen.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
/* Integer value ranges */
1414
static const struct netlink_range_validation netdev_a_page_pool_id_range = {
1515
.min = 1ULL,
16-
.max = 4294967295ULL,
16+
.max = U32_MAX,
1717
};
1818

1919
static const struct netlink_range_validation netdev_a_page_pool_ifindex_range = {
2020
.min = 1ULL,
21-
.max = 2147483647ULL,
21+
.max = S32_MAX,
2222
};
2323

2424
static const struct netlink_range_validation netdev_a_napi_defer_hard_irqs_range = {
25-
.max = 2147483647ULL,
25+
.max = S32_MAX,
2626
};
2727

2828
/* Common nested types */

net/devlink/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static struct devlink_rel *devlink_rel_alloc(void)
117117

118118
err = xa_alloc_cyclic(&devlink_rels, &rel->index, rel,
119119
xa_limit_32b, &next, GFP_KERNEL);
120-
if (err) {
120+
if (err < 0) {
121121
kfree(rel);
122122
return ERR_PTR(err);
123123
}

net/devlink/dev.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -971,14 +971,14 @@ static int devlink_nl_flash_update_fill(struct sk_buff *msg,
971971
nla_put_string(msg, DEVLINK_ATTR_FLASH_UPDATE_COMPONENT,
972972
params->component))
973973
goto nla_put_failure;
974-
if (nla_put_u64_64bit(msg, DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE,
975-
params->done, DEVLINK_ATTR_PAD))
974+
if (devlink_nl_put_u64(msg, DEVLINK_ATTR_FLASH_UPDATE_STATUS_DONE,
975+
params->done))
976976
goto nla_put_failure;
977-
if (nla_put_u64_64bit(msg, DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL,
978-
params->total, DEVLINK_ATTR_PAD))
977+
if (devlink_nl_put_u64(msg, DEVLINK_ATTR_FLASH_UPDATE_STATUS_TOTAL,
978+
params->total))
979979
goto nla_put_failure;
980-
if (nla_put_u64_64bit(msg, DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT,
981-
params->timeout, DEVLINK_ATTR_PAD))
980+
if (devlink_nl_put_u64(msg, DEVLINK_ATTR_FLASH_UPDATE_STATUS_TIMEOUT,
981+
params->timeout))
982982
goto nla_put_failure;
983983

984984
out:

net/devlink/devl_internal.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ devlink_nl_put_handle(struct sk_buff *msg, struct devlink *devlink)
181181
return 0;
182182
}
183183

184+
static inline int devlink_nl_put_u64(struct sk_buff *msg, int attrtype, u64 val)
185+
{
186+
return nla_put_u64_64bit(msg, attrtype, val, DEVLINK_ATTR_PAD);
187+
}
188+
184189
int devlink_nl_put_nested_handle(struct sk_buff *msg, struct net *net,
185190
struct devlink *devlink, int attrtype);
186191
int devlink_nl_msg_reply_and_new(struct sk_buff **msg, struct genl_info *info);

net/devlink/dpipe.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,18 +165,17 @@ static int devlink_dpipe_table_put(struct sk_buff *skb,
165165
return -EMSGSIZE;
166166

167167
if (nla_put_string(skb, DEVLINK_ATTR_DPIPE_TABLE_NAME, table->name) ||
168-
nla_put_u64_64bit(skb, DEVLINK_ATTR_DPIPE_TABLE_SIZE, table_size,
169-
DEVLINK_ATTR_PAD))
168+
devlink_nl_put_u64(skb, DEVLINK_ATTR_DPIPE_TABLE_SIZE, table_size))
170169
goto nla_put_failure;
171170
if (nla_put_u8(skb, DEVLINK_ATTR_DPIPE_TABLE_COUNTERS_ENABLED,
172171
table->counters_enabled))
173172
goto nla_put_failure;
174173

175174
if (table->resource_valid) {
176-
if (nla_put_u64_64bit(skb, DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID,
177-
table->resource_id, DEVLINK_ATTR_PAD) ||
178-
nla_put_u64_64bit(skb, DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS,
179-
table->resource_units, DEVLINK_ATTR_PAD))
175+
if (devlink_nl_put_u64(skb, DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_ID,
176+
table->resource_id) ||
177+
devlink_nl_put_u64(skb, DEVLINK_ATTR_DPIPE_TABLE_RESOURCE_UNITS,
178+
table->resource_units))
180179
goto nla_put_failure;
181180
}
182181
if (devlink_dpipe_matches_put(table, skb))
@@ -403,12 +402,11 @@ static int devlink_dpipe_entry_put(struct sk_buff *skb,
403402
if (!entry_attr)
404403
return -EMSGSIZE;
405404

406-
if (nla_put_u64_64bit(skb, DEVLINK_ATTR_DPIPE_ENTRY_INDEX, entry->index,
407-
DEVLINK_ATTR_PAD))
405+
if (devlink_nl_put_u64(skb, DEVLINK_ATTR_DPIPE_ENTRY_INDEX, entry->index))
408406
goto nla_put_failure;
409407
if (entry->counter_valid)
410-
if (nla_put_u64_64bit(skb, DEVLINK_ATTR_DPIPE_ENTRY_COUNTER,
411-
entry->counter, DEVLINK_ATTR_PAD))
408+
if (devlink_nl_put_u64(skb, DEVLINK_ATTR_DPIPE_ENTRY_COUNTER,
409+
entry->counter))
412410
goto nla_put_failure;
413411

414412
matches_attr = nla_nest_start_noflag(skb,

net/devlink/health.c

Lines changed: 78 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -287,29 +287,27 @@ devlink_nl_health_reporter_fill(struct sk_buff *msg,
287287
if (nla_put_u8(msg, DEVLINK_ATTR_HEALTH_REPORTER_STATE,
288288
reporter->health_state))
289289
goto reporter_nest_cancel;
290-
if (nla_put_u64_64bit(msg, DEVLINK_ATTR_HEALTH_REPORTER_ERR_COUNT,
291-
reporter->error_count, DEVLINK_ATTR_PAD))
290+
if (devlink_nl_put_u64(msg, DEVLINK_ATTR_HEALTH_REPORTER_ERR_COUNT,
291+
reporter->error_count))
292292
goto reporter_nest_cancel;
293-
if (nla_put_u64_64bit(msg, DEVLINK_ATTR_HEALTH_REPORTER_RECOVER_COUNT,
294-
reporter->recovery_count, DEVLINK_ATTR_PAD))
293+
if (devlink_nl_put_u64(msg, DEVLINK_ATTR_HEALTH_REPORTER_RECOVER_COUNT,
294+
reporter->recovery_count))
295295
goto reporter_nest_cancel;
296296
if (reporter->ops->recover &&
297-
nla_put_u64_64bit(msg, DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD,
298-
reporter->graceful_period,
299-
DEVLINK_ATTR_PAD))
297+
devlink_nl_put_u64(msg, DEVLINK_ATTR_HEALTH_REPORTER_GRACEFUL_PERIOD,
298+
reporter->graceful_period))
300299
goto reporter_nest_cancel;
301300
if (reporter->ops->recover &&
302301
nla_put_u8(msg, DEVLINK_ATTR_HEALTH_REPORTER_AUTO_RECOVER,
303302
reporter->auto_recover))
304303
goto reporter_nest_cancel;
305304
if (reporter->dump_fmsg &&
306-
nla_put_u64_64bit(msg, DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS,
307-
jiffies_to_msecs(reporter->dump_ts),
308-
DEVLINK_ATTR_PAD))
305+
devlink_nl_put_u64(msg, DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS,
306+
jiffies_to_msecs(reporter->dump_ts)))
309307
goto reporter_nest_cancel;
310308
if (reporter->dump_fmsg &&
311-
nla_put_u64_64bit(msg, DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS_NS,
312-
reporter->dump_real_ts, DEVLINK_ATTR_PAD))
309+
devlink_nl_put_u64(msg, DEVLINK_ATTR_HEALTH_REPORTER_DUMP_TS_NS,
310+
reporter->dump_real_ts))
313311
goto reporter_nest_cancel;
314312
if (reporter->ops->dump &&
315313
nla_put_u8(msg, DEVLINK_ATTR_HEALTH_REPORTER_AUTO_DUMP,
@@ -963,8 +961,7 @@ devlink_fmsg_item_fill_data(struct devlink_fmsg_item *msg, struct sk_buff *skb)
963961
case NLA_U32:
964962
return nla_put_u32(skb, attrtype, *(u32 *)msg->value);
965963
case NLA_U64:
966-
return nla_put_u64_64bit(skb, attrtype, *(u64 *)msg->value,
967-
DEVLINK_ATTR_PAD);
964+
return devlink_nl_put_u64(skb, attrtype, *(u64 *)msg->value);
968965
case NLA_NUL_STRING:
969966
return nla_put_string(skb, attrtype, (char *)&msg->value);
970967
case NLA_BINARY:
@@ -1241,3 +1238,70 @@ int devlink_nl_health_reporter_test_doit(struct sk_buff *skb,
12411238

12421239
return reporter->ops->test(reporter, info->extack);
12431240
}
1241+
1242+
/**
1243+
* devlink_fmsg_dump_skb - Dump sk_buffer structure
1244+
* @fmsg: devlink formatted message pointer
1245+
* @skb: pointer to skb
1246+
*
1247+
* Dump diagnostic information about sk_buff structure, like headroom, length,
1248+
* tailroom, MAC, etc.
1249+
*/
1250+
void devlink_fmsg_dump_skb(struct devlink_fmsg *fmsg, const struct sk_buff *skb)
1251+
{
1252+
struct skb_shared_info *sh = skb_shinfo(skb);
1253+
struct sock *sk = skb->sk;
1254+
bool has_mac, has_trans;
1255+
1256+
has_mac = skb_mac_header_was_set(skb);
1257+
has_trans = skb_transport_header_was_set(skb);
1258+
1259+
devlink_fmsg_pair_nest_start(fmsg, "skb");
1260+
devlink_fmsg_obj_nest_start(fmsg);
1261+
devlink_fmsg_put(fmsg, "actual len", skb->len);
1262+
devlink_fmsg_put(fmsg, "head len", skb_headlen(skb));
1263+
devlink_fmsg_put(fmsg, "data len", skb->data_len);
1264+
devlink_fmsg_put(fmsg, "tail len", skb_tailroom(skb));
1265+
devlink_fmsg_put(fmsg, "MAC", has_mac ? skb->mac_header : -1);
1266+
devlink_fmsg_put(fmsg, "MAC len",
1267+
has_mac ? skb_mac_header_len(skb) : -1);
1268+
devlink_fmsg_put(fmsg, "network hdr", skb->network_header);
1269+
devlink_fmsg_put(fmsg, "network hdr len",
1270+
has_trans ? skb_network_header_len(skb) : -1);
1271+
devlink_fmsg_put(fmsg, "transport hdr",
1272+
has_trans ? skb->transport_header : -1);
1273+
devlink_fmsg_put(fmsg, "csum", (__force u32)skb->csum);
1274+
devlink_fmsg_put(fmsg, "csum_ip_summed", (u8)skb->ip_summed);
1275+
devlink_fmsg_put(fmsg, "csum_complete_sw", !!skb->csum_complete_sw);
1276+
devlink_fmsg_put(fmsg, "csum_valid", !!skb->csum_valid);
1277+
devlink_fmsg_put(fmsg, "csum_level", (u8)skb->csum_level);
1278+
devlink_fmsg_put(fmsg, "sw_hash", !!skb->sw_hash);
1279+
devlink_fmsg_put(fmsg, "l4_hash", !!skb->l4_hash);
1280+
devlink_fmsg_put(fmsg, "proto", ntohs(skb->protocol));
1281+
devlink_fmsg_put(fmsg, "pkt_type", (u8)skb->pkt_type);
1282+
devlink_fmsg_put(fmsg, "iif", skb->skb_iif);
1283+
1284+
if (sk) {
1285+
devlink_fmsg_pair_nest_start(fmsg, "sk");
1286+
devlink_fmsg_obj_nest_start(fmsg);
1287+
devlink_fmsg_put(fmsg, "family", sk->sk_type);
1288+
devlink_fmsg_put(fmsg, "type", sk->sk_type);
1289+
devlink_fmsg_put(fmsg, "proto", sk->sk_protocol);
1290+
devlink_fmsg_obj_nest_end(fmsg);
1291+
devlink_fmsg_pair_nest_end(fmsg);
1292+
}
1293+
1294+
devlink_fmsg_obj_nest_end(fmsg);
1295+
devlink_fmsg_pair_nest_end(fmsg);
1296+
1297+
devlink_fmsg_pair_nest_start(fmsg, "shinfo");
1298+
devlink_fmsg_obj_nest_start(fmsg);
1299+
devlink_fmsg_put(fmsg, "tx_flags", sh->tx_flags);
1300+
devlink_fmsg_put(fmsg, "nr_frags", sh->nr_frags);
1301+
devlink_fmsg_put(fmsg, "gso_size", sh->gso_size);
1302+
devlink_fmsg_put(fmsg, "gso_type", sh->gso_type);
1303+
devlink_fmsg_put(fmsg, "gso_segs", sh->gso_segs);
1304+
devlink_fmsg_obj_nest_end(fmsg);
1305+
devlink_fmsg_pair_nest_end(fmsg);
1306+
}
1307+
EXPORT_SYMBOL_GPL(devlink_fmsg_dump_skb);

0 commit comments

Comments
 (0)