hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/include/net/devlink.h
....@@ -1,12 +1,8 @@
1
+/* SPDX-License-Identifier: GPL-2.0-or-later */
12 /*
23 * include/net/devlink.h - Network physical device Netlink interface
34 * Copyright (c) 2016 Mellanox Technologies. All rights reserved.
45 * Copyright (c) 2016 Jiri Pirko <jiri@mellanox.com>
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License as published by
8
- * the Free Software Foundation; either version 2 of the License, or
9
- * (at your option) any later version.
106 */
117 #ifndef _NET_DEVLINK_H_
128 #define _NET_DEVLINK_H_
....@@ -16,8 +12,21 @@
1612 #include <linux/gfp.h>
1713 #include <linux/list.h>
1814 #include <linux/netdevice.h>
15
+#include <linux/spinlock.h>
16
+#include <linux/workqueue.h>
17
+#include <linux/refcount.h>
1918 #include <net/net_namespace.h>
19
+#include <net/flow_offload.h>
2020 #include <uapi/linux/devlink.h>
21
+#include <linux/xarray.h>
22
+
23
+#define DEVLINK_RELOAD_STATS_ARRAY_SIZE \
24
+ (__DEVLINK_RELOAD_LIMIT_MAX * __DEVLINK_RELOAD_ACTION_MAX)
25
+
26
+struct devlink_dev_stats {
27
+ u32 reload_stats[DEVLINK_RELOAD_STATS_ARRAY_SIZE];
28
+ u32 remote_reload_stats[DEVLINK_RELOAD_STATS_ARRAY_SIZE];
29
+};
2130
2231 struct devlink_ops;
2332
....@@ -29,38 +38,110 @@
2938 struct list_head resource_list;
3039 struct list_head param_list;
3140 struct list_head region_list;
32
- u32 snapshot_id;
41
+ struct list_head reporter_list;
42
+ struct mutex reporters_lock; /* protects reporter_list */
3343 struct devlink_dpipe_headers *dpipe_headers;
44
+ struct list_head trap_list;
45
+ struct list_head trap_group_list;
46
+ struct list_head trap_policer_list;
3447 const struct devlink_ops *ops;
48
+ struct xarray snapshot_ids;
49
+ struct devlink_dev_stats stats;
3550 struct device *dev;
3651 possible_net_t _net;
37
- struct mutex lock;
52
+ struct mutex lock; /* Serializes access to devlink instance specific objects such as
53
+ * port, sb, dpipe, resource, params, region, traps and more.
54
+ */
55
+ u8 reload_failed:1,
56
+ reload_enabled:1,
57
+ registered:1;
3858 char priv[0] __aligned(NETDEV_ALIGN);
3959 };
4060
61
+struct devlink_port_phys_attrs {
62
+ u32 port_number; /* Same value as "split group".
63
+ * A physical port which is visible to the user
64
+ * for a given port flavour.
65
+ */
66
+ u32 split_subport_number; /* If the port is split, this is the number of subport. */
67
+};
68
+
69
+/**
70
+ * struct devlink_port_pci_pf_attrs - devlink port's PCI PF attributes
71
+ * @controller: Associated controller number
72
+ * @pf: Associated PCI PF number for this port.
73
+ * @external: when set, indicates if a port is for an external controller
74
+ */
75
+struct devlink_port_pci_pf_attrs {
76
+ u32 controller;
77
+ u16 pf;
78
+ u8 external:1;
79
+};
80
+
81
+/**
82
+ * struct devlink_port_pci_vf_attrs - devlink port's PCI VF attributes
83
+ * @controller: Associated controller number
84
+ * @pf: Associated PCI PF number for this port.
85
+ * @vf: Associated PCI VF for of the PCI PF for this port.
86
+ * @external: when set, indicates if a port is for an external controller
87
+ */
88
+struct devlink_port_pci_vf_attrs {
89
+ u32 controller;
90
+ u16 pf;
91
+ u16 vf;
92
+ u8 external:1;
93
+};
94
+
95
+/**
96
+ * struct devlink_port_attrs - devlink port object
97
+ * @flavour: flavour of the port
98
+ * @split: indicates if this is split port
99
+ * @splittable: indicates if the port can be split.
100
+ * @lanes: maximum number of lanes the port supports. 0 value is not passed to netlink.
101
+ * @switch_id: if the port is part of switch, this is buffer with ID, otherwise this is NULL
102
+ * @phys: physical port attributes
103
+ * @pci_pf: PCI PF port attributes
104
+ * @pci_vf: PCI VF port attributes
105
+ */
41106 struct devlink_port_attrs {
42
- bool set;
107
+ u8 split:1,
108
+ splittable:1;
109
+ u32 lanes;
43110 enum devlink_port_flavour flavour;
44
- u32 port_number; /* same value as "split group" */
45
- bool split;
46
- u32 split_subport_number;
111
+ struct netdev_phys_item_id switch_id;
112
+ union {
113
+ struct devlink_port_phys_attrs phys;
114
+ struct devlink_port_pci_pf_attrs pci_pf;
115
+ struct devlink_port_pci_vf_attrs pci_vf;
116
+ };
47117 };
48118
49119 struct devlink_port {
50120 struct list_head list;
121
+ struct list_head param_list;
122
+ struct list_head region_list;
51123 struct devlink *devlink;
52
- unsigned index;
124
+ unsigned int index;
53125 bool registered;
126
+ spinlock_t type_lock; /* Protects type and type_dev
127
+ * pointer consistency.
128
+ */
54129 enum devlink_port_type type;
55130 enum devlink_port_type desired_type;
56131 void *type_dev;
57132 struct devlink_port_attrs attrs;
133
+ u8 attrs_set:1,
134
+ switch_port:1;
135
+ struct delayed_work type_warn_dw;
136
+ struct list_head reporter_list;
137
+ struct mutex reporters_lock; /* Protects reporter_list */
58138 };
59139
60140 struct devlink_sb_pool_info {
61141 enum devlink_sb_pool_type pool_type;
62142 u32 size;
63143 enum devlink_sb_threshold_type threshold_type;
144
+ u32 cell_size;
64145 };
65146
66147 /**
....@@ -321,6 +402,25 @@
321402 };
322403
323404 /**
405
+ * struct devlink_flash_notify - devlink dev flash notify data
406
+ * @status_msg: current status string
407
+ * @component: firmware component being updated
408
+ * @done: amount of work completed of total amount
409
+ * @total: amount of work expected to be done
410
+ * @timeout: expected max timeout in seconds
411
+ *
412
+ * These are values to be given to userland to be displayed in order
413
+ * to show current activity in a firmware update process.
414
+ */
415
+struct devlink_flash_notify {
416
+ const char *status_msg;
417
+ const char *component;
418
+ unsigned long done;
419
+ unsigned long total;
420
+ unsigned long timeout;
421
+};
422
+
423
+/**
324424 * struct devlink_param - devlink configuration parameter data
325425 * @name: name of the parameter
326426 * @generic: indicates if the parameter is generic or driver specific
....@@ -355,6 +455,7 @@
355455 const struct devlink_param *param;
356456 union devlink_param_value driverinit_value;
357457 bool driverinit_value_valid;
458
+ bool published;
358459 };
359460
360461 enum devlink_param_generic_id {
....@@ -362,6 +463,13 @@
362463 DEVLINK_PARAM_GENERIC_ID_MAX_MACS,
363464 DEVLINK_PARAM_GENERIC_ID_ENABLE_SRIOV,
364465 DEVLINK_PARAM_GENERIC_ID_REGION_SNAPSHOT,
466
+ DEVLINK_PARAM_GENERIC_ID_IGNORE_ARI,
467
+ DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MAX,
468
+ DEVLINK_PARAM_GENERIC_ID_MSIX_VEC_PER_PF_MIN,
469
+ DEVLINK_PARAM_GENERIC_ID_FW_LOAD_POLICY,
470
+ DEVLINK_PARAM_GENERIC_ID_RESET_DEV_ON_DRV_PROBE,
471
+ DEVLINK_PARAM_GENERIC_ID_ENABLE_ROCE,
472
+ DEVLINK_PARAM_GENERIC_ID_ENABLE_REMOTE_DEV_RESET,
365473
366474 /* add new param generic ids above here*/
367475 __DEVLINK_PARAM_GENERIC_ID_MAX,
....@@ -379,6 +487,28 @@
379487
380488 #define DEVLINK_PARAM_GENERIC_REGION_SNAPSHOT_NAME "region_snapshot_enable"
381489 #define DEVLINK_PARAM_GENERIC_REGION_SNAPSHOT_TYPE DEVLINK_PARAM_TYPE_BOOL
490
+
491
+#define DEVLINK_PARAM_GENERIC_IGNORE_ARI_NAME "ignore_ari"
492
+#define DEVLINK_PARAM_GENERIC_IGNORE_ARI_TYPE DEVLINK_PARAM_TYPE_BOOL
493
+
494
+#define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MAX_NAME "msix_vec_per_pf_max"
495
+#define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MAX_TYPE DEVLINK_PARAM_TYPE_U32
496
+
497
+#define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MIN_NAME "msix_vec_per_pf_min"
498
+#define DEVLINK_PARAM_GENERIC_MSIX_VEC_PER_PF_MIN_TYPE DEVLINK_PARAM_TYPE_U32
499
+
500
+#define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_NAME "fw_load_policy"
501
+#define DEVLINK_PARAM_GENERIC_FW_LOAD_POLICY_TYPE DEVLINK_PARAM_TYPE_U8
502
+
503
+#define DEVLINK_PARAM_GENERIC_RESET_DEV_ON_DRV_PROBE_NAME \
504
+ "reset_dev_on_drv_probe"
505
+#define DEVLINK_PARAM_GENERIC_RESET_DEV_ON_DRV_PROBE_TYPE DEVLINK_PARAM_TYPE_U8
506
+
507
+#define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_NAME "enable_roce"
508
+#define DEVLINK_PARAM_GENERIC_ENABLE_ROCE_TYPE DEVLINK_PARAM_TYPE_BOOL
509
+
510
+#define DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_NAME "enable_remote_dev_reset"
511
+#define DEVLINK_PARAM_GENERIC_ENABLE_REMOTE_DEV_RESET_TYPE DEVLINK_PARAM_TYPE_BOOL
382512
383513 #define DEVLINK_PARAM_GENERIC(_id, _cmodes, _get, _set, _validate) \
384514 { \
....@@ -403,12 +533,645 @@
403533 .validate = _validate, \
404534 }
405535
406
-struct devlink_region;
536
+/* Part number, identifier of board design */
537
+#define DEVLINK_INFO_VERSION_GENERIC_BOARD_ID "board.id"
538
+/* Revision of board design */
539
+#define DEVLINK_INFO_VERSION_GENERIC_BOARD_REV "board.rev"
540
+/* Maker of the board */
541
+#define DEVLINK_INFO_VERSION_GENERIC_BOARD_MANUFACTURE "board.manufacture"
407542
408
-typedef void devlink_snapshot_data_dest_t(const void *data);
543
+/* Part number, identifier of asic design */
544
+#define DEVLINK_INFO_VERSION_GENERIC_ASIC_ID "asic.id"
545
+/* Revision of asic design */
546
+#define DEVLINK_INFO_VERSION_GENERIC_ASIC_REV "asic.rev"
547
+
548
+/* Overall FW version */
549
+#define DEVLINK_INFO_VERSION_GENERIC_FW "fw"
550
+/* Control processor FW version */
551
+#define DEVLINK_INFO_VERSION_GENERIC_FW_MGMT "fw.mgmt"
552
+/* FW interface specification version */
553
+#define DEVLINK_INFO_VERSION_GENERIC_FW_MGMT_API "fw.mgmt.api"
554
+/* Data path microcode controlling high-speed packet processing */
555
+#define DEVLINK_INFO_VERSION_GENERIC_FW_APP "fw.app"
556
+/* UNDI software version */
557
+#define DEVLINK_INFO_VERSION_GENERIC_FW_UNDI "fw.undi"
558
+/* NCSI support/handler version */
559
+#define DEVLINK_INFO_VERSION_GENERIC_FW_NCSI "fw.ncsi"
560
+/* FW parameter set id */
561
+#define DEVLINK_INFO_VERSION_GENERIC_FW_PSID "fw.psid"
562
+/* RoCE FW version */
563
+#define DEVLINK_INFO_VERSION_GENERIC_FW_ROCE "fw.roce"
564
+/* Firmware bundle identifier */
565
+#define DEVLINK_INFO_VERSION_GENERIC_FW_BUNDLE_ID "fw.bundle_id"
566
+
567
+/**
568
+ * struct devlink_flash_update_params - Flash Update parameters
569
+ * @file_name: the name of the flash firmware file to update from
570
+ * @component: the flash component to update
571
+ *
572
+ * With the exception of file_name, drivers must opt-in to parameters by
573
+ * setting the appropriate bit in the supported_flash_update_params field in
574
+ * their devlink_ops structure.
575
+ */
576
+struct devlink_flash_update_params {
577
+ const char *file_name;
578
+ const char *component;
579
+ u32 overwrite_mask;
580
+};
581
+
582
+#define DEVLINK_SUPPORT_FLASH_UPDATE_COMPONENT BIT(0)
583
+#define DEVLINK_SUPPORT_FLASH_UPDATE_OVERWRITE_MASK BIT(1)
584
+
585
+struct devlink_region;
586
+struct devlink_info_req;
587
+
588
+/**
589
+ * struct devlink_region_ops - Region operations
590
+ * @name: region name
591
+ * @destructor: callback used to free snapshot memory when deleting
592
+ * @snapshot: callback to request an immediate snapshot. On success,
593
+ * the data variable must be updated to point to the snapshot data.
594
+ * The function will be called while the devlink instance lock is
595
+ * held.
596
+ * @priv: Pointer to driver private data for the region operation
597
+ */
598
+struct devlink_region_ops {
599
+ const char *name;
600
+ void (*destructor)(const void *data);
601
+ int (*snapshot)(struct devlink *devlink,
602
+ const struct devlink_region_ops *ops,
603
+ struct netlink_ext_ack *extack,
604
+ u8 **data);
605
+ void *priv;
606
+};
607
+
608
+/**
609
+ * struct devlink_port_region_ops - Region operations for a port
610
+ * @name: region name
611
+ * @destructor: callback used to free snapshot memory when deleting
612
+ * @snapshot: callback to request an immediate snapshot. On success,
613
+ * the data variable must be updated to point to the snapshot data.
614
+ * The function will be called while the devlink instance lock is
615
+ * held.
616
+ * @priv: Pointer to driver private data for the region operation
617
+ */
618
+struct devlink_port_region_ops {
619
+ const char *name;
620
+ void (*destructor)(const void *data);
621
+ int (*snapshot)(struct devlink_port *port,
622
+ const struct devlink_port_region_ops *ops,
623
+ struct netlink_ext_ack *extack,
624
+ u8 **data);
625
+ void *priv;
626
+};
627
+
628
+struct devlink_fmsg;
629
+struct devlink_health_reporter;
630
+
631
+enum devlink_health_reporter_state {
632
+ DEVLINK_HEALTH_REPORTER_STATE_HEALTHY,
633
+ DEVLINK_HEALTH_REPORTER_STATE_ERROR,
634
+};
635
+
636
+/**
637
+ * struct devlink_health_reporter_ops - Reporter operations
638
+ * @name: reporter name
639
+ * @recover: callback to recover from reported error
640
+ * if priv_ctx is NULL, run a full recover
641
+ * @dump: callback to dump an object
642
+ * if priv_ctx is NULL, run a full dump
643
+ * @diagnose: callback to diagnose the current status
644
+ * @test: callback to trigger a test event
645
+ */
646
+
647
+struct devlink_health_reporter_ops {
648
+ char *name;
649
+ int (*recover)(struct devlink_health_reporter *reporter,
650
+ void *priv_ctx, struct netlink_ext_ack *extack);
651
+ int (*dump)(struct devlink_health_reporter *reporter,
652
+ struct devlink_fmsg *fmsg, void *priv_ctx,
653
+ struct netlink_ext_ack *extack);
654
+ int (*diagnose)(struct devlink_health_reporter *reporter,
655
+ struct devlink_fmsg *fmsg,
656
+ struct netlink_ext_ack *extack);
657
+ int (*test)(struct devlink_health_reporter *reporter,
658
+ struct netlink_ext_ack *extack);
659
+};
660
+
661
+/**
662
+ * struct devlink_trap_metadata - Packet trap metadata.
663
+ * @trap_name: Trap name.
664
+ * @trap_group_name: Trap group name.
665
+ * @input_dev: Input netdevice.
666
+ * @fa_cookie: Flow action user cookie.
667
+ * @trap_type: Trap type.
668
+ */
669
+struct devlink_trap_metadata {
670
+ const char *trap_name;
671
+ const char *trap_group_name;
672
+ struct net_device *input_dev;
673
+ const struct flow_action_cookie *fa_cookie;
674
+ enum devlink_trap_type trap_type;
675
+};
676
+
677
+/**
678
+ * struct devlink_trap_policer - Immutable packet trap policer attributes.
679
+ * @id: Policer identifier.
680
+ * @init_rate: Initial rate in packets / sec.
681
+ * @init_burst: Initial burst size in packets.
682
+ * @max_rate: Maximum rate.
683
+ * @min_rate: Minimum rate.
684
+ * @max_burst: Maximum burst size.
685
+ * @min_burst: Minimum burst size.
686
+ *
687
+ * Describes immutable attributes of packet trap policers that drivers register
688
+ * with devlink.
689
+ */
690
+struct devlink_trap_policer {
691
+ u32 id;
692
+ u64 init_rate;
693
+ u64 init_burst;
694
+ u64 max_rate;
695
+ u64 min_rate;
696
+ u64 max_burst;
697
+ u64 min_burst;
698
+};
699
+
700
+/**
701
+ * struct devlink_trap_group - Immutable packet trap group attributes.
702
+ * @name: Trap group name.
703
+ * @id: Trap group identifier.
704
+ * @generic: Whether the trap group is generic or not.
705
+ * @init_policer_id: Initial policer identifier.
706
+ *
707
+ * Describes immutable attributes of packet trap groups that drivers register
708
+ * with devlink.
709
+ */
710
+struct devlink_trap_group {
711
+ const char *name;
712
+ u16 id;
713
+ bool generic;
714
+ u32 init_policer_id;
715
+};
716
+
717
+#define DEVLINK_TRAP_METADATA_TYPE_F_IN_PORT BIT(0)
718
+#define DEVLINK_TRAP_METADATA_TYPE_F_FA_COOKIE BIT(1)
719
+
720
+/**
721
+ * struct devlink_trap - Immutable packet trap attributes.
722
+ * @type: Trap type.
723
+ * @init_action: Initial trap action.
724
+ * @generic: Whether the trap is generic or not.
725
+ * @id: Trap identifier.
726
+ * @name: Trap name.
727
+ * @init_group_id: Initial group identifier.
728
+ * @metadata_cap: Metadata types that can be provided by the trap.
729
+ *
730
+ * Describes immutable attributes of packet traps that drivers register with
731
+ * devlink.
732
+ */
733
+struct devlink_trap {
734
+ enum devlink_trap_type type;
735
+ enum devlink_trap_action init_action;
736
+ bool generic;
737
+ u16 id;
738
+ const char *name;
739
+ u16 init_group_id;
740
+ u32 metadata_cap;
741
+};
742
+
743
+/* All traps must be documented in
744
+ * Documentation/networking/devlink/devlink-trap.rst
745
+ */
746
+enum devlink_trap_generic_id {
747
+ DEVLINK_TRAP_GENERIC_ID_SMAC_MC,
748
+ DEVLINK_TRAP_GENERIC_ID_VLAN_TAG_MISMATCH,
749
+ DEVLINK_TRAP_GENERIC_ID_INGRESS_VLAN_FILTER,
750
+ DEVLINK_TRAP_GENERIC_ID_INGRESS_STP_FILTER,
751
+ DEVLINK_TRAP_GENERIC_ID_EMPTY_TX_LIST,
752
+ DEVLINK_TRAP_GENERIC_ID_PORT_LOOPBACK_FILTER,
753
+ DEVLINK_TRAP_GENERIC_ID_BLACKHOLE_ROUTE,
754
+ DEVLINK_TRAP_GENERIC_ID_TTL_ERROR,
755
+ DEVLINK_TRAP_GENERIC_ID_TAIL_DROP,
756
+ DEVLINK_TRAP_GENERIC_ID_NON_IP_PACKET,
757
+ DEVLINK_TRAP_GENERIC_ID_UC_DIP_MC_DMAC,
758
+ DEVLINK_TRAP_GENERIC_ID_DIP_LB,
759
+ DEVLINK_TRAP_GENERIC_ID_SIP_MC,
760
+ DEVLINK_TRAP_GENERIC_ID_SIP_LB,
761
+ DEVLINK_TRAP_GENERIC_ID_CORRUPTED_IP_HDR,
762
+ DEVLINK_TRAP_GENERIC_ID_IPV4_SIP_BC,
763
+ DEVLINK_TRAP_GENERIC_ID_IPV6_MC_DIP_RESERVED_SCOPE,
764
+ DEVLINK_TRAP_GENERIC_ID_IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE,
765
+ DEVLINK_TRAP_GENERIC_ID_MTU_ERROR,
766
+ DEVLINK_TRAP_GENERIC_ID_UNRESOLVED_NEIGH,
767
+ DEVLINK_TRAP_GENERIC_ID_RPF,
768
+ DEVLINK_TRAP_GENERIC_ID_REJECT_ROUTE,
769
+ DEVLINK_TRAP_GENERIC_ID_IPV4_LPM_UNICAST_MISS,
770
+ DEVLINK_TRAP_GENERIC_ID_IPV6_LPM_UNICAST_MISS,
771
+ DEVLINK_TRAP_GENERIC_ID_NON_ROUTABLE,
772
+ DEVLINK_TRAP_GENERIC_ID_DECAP_ERROR,
773
+ DEVLINK_TRAP_GENERIC_ID_OVERLAY_SMAC_MC,
774
+ DEVLINK_TRAP_GENERIC_ID_INGRESS_FLOW_ACTION_DROP,
775
+ DEVLINK_TRAP_GENERIC_ID_EGRESS_FLOW_ACTION_DROP,
776
+ DEVLINK_TRAP_GENERIC_ID_STP,
777
+ DEVLINK_TRAP_GENERIC_ID_LACP,
778
+ DEVLINK_TRAP_GENERIC_ID_LLDP,
779
+ DEVLINK_TRAP_GENERIC_ID_IGMP_QUERY,
780
+ DEVLINK_TRAP_GENERIC_ID_IGMP_V1_REPORT,
781
+ DEVLINK_TRAP_GENERIC_ID_IGMP_V2_REPORT,
782
+ DEVLINK_TRAP_GENERIC_ID_IGMP_V3_REPORT,
783
+ DEVLINK_TRAP_GENERIC_ID_IGMP_V2_LEAVE,
784
+ DEVLINK_TRAP_GENERIC_ID_MLD_QUERY,
785
+ DEVLINK_TRAP_GENERIC_ID_MLD_V1_REPORT,
786
+ DEVLINK_TRAP_GENERIC_ID_MLD_V2_REPORT,
787
+ DEVLINK_TRAP_GENERIC_ID_MLD_V1_DONE,
788
+ DEVLINK_TRAP_GENERIC_ID_IPV4_DHCP,
789
+ DEVLINK_TRAP_GENERIC_ID_IPV6_DHCP,
790
+ DEVLINK_TRAP_GENERIC_ID_ARP_REQUEST,
791
+ DEVLINK_TRAP_GENERIC_ID_ARP_RESPONSE,
792
+ DEVLINK_TRAP_GENERIC_ID_ARP_OVERLAY,
793
+ DEVLINK_TRAP_GENERIC_ID_IPV6_NEIGH_SOLICIT,
794
+ DEVLINK_TRAP_GENERIC_ID_IPV6_NEIGH_ADVERT,
795
+ DEVLINK_TRAP_GENERIC_ID_IPV4_BFD,
796
+ DEVLINK_TRAP_GENERIC_ID_IPV6_BFD,
797
+ DEVLINK_TRAP_GENERIC_ID_IPV4_OSPF,
798
+ DEVLINK_TRAP_GENERIC_ID_IPV6_OSPF,
799
+ DEVLINK_TRAP_GENERIC_ID_IPV4_BGP,
800
+ DEVLINK_TRAP_GENERIC_ID_IPV6_BGP,
801
+ DEVLINK_TRAP_GENERIC_ID_IPV4_VRRP,
802
+ DEVLINK_TRAP_GENERIC_ID_IPV6_VRRP,
803
+ DEVLINK_TRAP_GENERIC_ID_IPV4_PIM,
804
+ DEVLINK_TRAP_GENERIC_ID_IPV6_PIM,
805
+ DEVLINK_TRAP_GENERIC_ID_UC_LB,
806
+ DEVLINK_TRAP_GENERIC_ID_LOCAL_ROUTE,
807
+ DEVLINK_TRAP_GENERIC_ID_EXTERNAL_ROUTE,
808
+ DEVLINK_TRAP_GENERIC_ID_IPV6_UC_DIP_LINK_LOCAL_SCOPE,
809
+ DEVLINK_TRAP_GENERIC_ID_IPV6_DIP_ALL_NODES,
810
+ DEVLINK_TRAP_GENERIC_ID_IPV6_DIP_ALL_ROUTERS,
811
+ DEVLINK_TRAP_GENERIC_ID_IPV6_ROUTER_SOLICIT,
812
+ DEVLINK_TRAP_GENERIC_ID_IPV6_ROUTER_ADVERT,
813
+ DEVLINK_TRAP_GENERIC_ID_IPV6_REDIRECT,
814
+ DEVLINK_TRAP_GENERIC_ID_IPV4_ROUTER_ALERT,
815
+ DEVLINK_TRAP_GENERIC_ID_IPV6_ROUTER_ALERT,
816
+ DEVLINK_TRAP_GENERIC_ID_PTP_EVENT,
817
+ DEVLINK_TRAP_GENERIC_ID_PTP_GENERAL,
818
+ DEVLINK_TRAP_GENERIC_ID_FLOW_ACTION_SAMPLE,
819
+ DEVLINK_TRAP_GENERIC_ID_FLOW_ACTION_TRAP,
820
+ DEVLINK_TRAP_GENERIC_ID_EARLY_DROP,
821
+ DEVLINK_TRAP_GENERIC_ID_VXLAN_PARSING,
822
+ DEVLINK_TRAP_GENERIC_ID_LLC_SNAP_PARSING,
823
+ DEVLINK_TRAP_GENERIC_ID_VLAN_PARSING,
824
+ DEVLINK_TRAP_GENERIC_ID_PPPOE_PPP_PARSING,
825
+ DEVLINK_TRAP_GENERIC_ID_MPLS_PARSING,
826
+ DEVLINK_TRAP_GENERIC_ID_ARP_PARSING,
827
+ DEVLINK_TRAP_GENERIC_ID_IP_1_PARSING,
828
+ DEVLINK_TRAP_GENERIC_ID_IP_N_PARSING,
829
+ DEVLINK_TRAP_GENERIC_ID_GRE_PARSING,
830
+ DEVLINK_TRAP_GENERIC_ID_UDP_PARSING,
831
+ DEVLINK_TRAP_GENERIC_ID_TCP_PARSING,
832
+ DEVLINK_TRAP_GENERIC_ID_IPSEC_PARSING,
833
+ DEVLINK_TRAP_GENERIC_ID_SCTP_PARSING,
834
+ DEVLINK_TRAP_GENERIC_ID_DCCP_PARSING,
835
+ DEVLINK_TRAP_GENERIC_ID_GTP_PARSING,
836
+ DEVLINK_TRAP_GENERIC_ID_ESP_PARSING,
837
+
838
+ /* Add new generic trap IDs above */
839
+ __DEVLINK_TRAP_GENERIC_ID_MAX,
840
+ DEVLINK_TRAP_GENERIC_ID_MAX = __DEVLINK_TRAP_GENERIC_ID_MAX - 1,
841
+};
842
+
843
+/* All trap groups must be documented in
844
+ * Documentation/networking/devlink/devlink-trap.rst
845
+ */
846
+enum devlink_trap_group_generic_id {
847
+ DEVLINK_TRAP_GROUP_GENERIC_ID_L2_DROPS,
848
+ DEVLINK_TRAP_GROUP_GENERIC_ID_L3_DROPS,
849
+ DEVLINK_TRAP_GROUP_GENERIC_ID_L3_EXCEPTIONS,
850
+ DEVLINK_TRAP_GROUP_GENERIC_ID_BUFFER_DROPS,
851
+ DEVLINK_TRAP_GROUP_GENERIC_ID_TUNNEL_DROPS,
852
+ DEVLINK_TRAP_GROUP_GENERIC_ID_ACL_DROPS,
853
+ DEVLINK_TRAP_GROUP_GENERIC_ID_STP,
854
+ DEVLINK_TRAP_GROUP_GENERIC_ID_LACP,
855
+ DEVLINK_TRAP_GROUP_GENERIC_ID_LLDP,
856
+ DEVLINK_TRAP_GROUP_GENERIC_ID_MC_SNOOPING,
857
+ DEVLINK_TRAP_GROUP_GENERIC_ID_DHCP,
858
+ DEVLINK_TRAP_GROUP_GENERIC_ID_NEIGH_DISCOVERY,
859
+ DEVLINK_TRAP_GROUP_GENERIC_ID_BFD,
860
+ DEVLINK_TRAP_GROUP_GENERIC_ID_OSPF,
861
+ DEVLINK_TRAP_GROUP_GENERIC_ID_BGP,
862
+ DEVLINK_TRAP_GROUP_GENERIC_ID_VRRP,
863
+ DEVLINK_TRAP_GROUP_GENERIC_ID_PIM,
864
+ DEVLINK_TRAP_GROUP_GENERIC_ID_UC_LB,
865
+ DEVLINK_TRAP_GROUP_GENERIC_ID_LOCAL_DELIVERY,
866
+ DEVLINK_TRAP_GROUP_GENERIC_ID_EXTERNAL_DELIVERY,
867
+ DEVLINK_TRAP_GROUP_GENERIC_ID_IPV6,
868
+ DEVLINK_TRAP_GROUP_GENERIC_ID_PTP_EVENT,
869
+ DEVLINK_TRAP_GROUP_GENERIC_ID_PTP_GENERAL,
870
+ DEVLINK_TRAP_GROUP_GENERIC_ID_ACL_SAMPLE,
871
+ DEVLINK_TRAP_GROUP_GENERIC_ID_ACL_TRAP,
872
+ DEVLINK_TRAP_GROUP_GENERIC_ID_PARSER_ERROR_DROPS,
873
+
874
+ /* Add new generic trap group IDs above */
875
+ __DEVLINK_TRAP_GROUP_GENERIC_ID_MAX,
876
+ DEVLINK_TRAP_GROUP_GENERIC_ID_MAX =
877
+ __DEVLINK_TRAP_GROUP_GENERIC_ID_MAX - 1,
878
+};
879
+
880
+#define DEVLINK_TRAP_GENERIC_NAME_SMAC_MC \
881
+ "source_mac_is_multicast"
882
+#define DEVLINK_TRAP_GENERIC_NAME_VLAN_TAG_MISMATCH \
883
+ "vlan_tag_mismatch"
884
+#define DEVLINK_TRAP_GENERIC_NAME_INGRESS_VLAN_FILTER \
885
+ "ingress_vlan_filter"
886
+#define DEVLINK_TRAP_GENERIC_NAME_INGRESS_STP_FILTER \
887
+ "ingress_spanning_tree_filter"
888
+#define DEVLINK_TRAP_GENERIC_NAME_EMPTY_TX_LIST \
889
+ "port_list_is_empty"
890
+#define DEVLINK_TRAP_GENERIC_NAME_PORT_LOOPBACK_FILTER \
891
+ "port_loopback_filter"
892
+#define DEVLINK_TRAP_GENERIC_NAME_BLACKHOLE_ROUTE \
893
+ "blackhole_route"
894
+#define DEVLINK_TRAP_GENERIC_NAME_TTL_ERROR \
895
+ "ttl_value_is_too_small"
896
+#define DEVLINK_TRAP_GENERIC_NAME_TAIL_DROP \
897
+ "tail_drop"
898
+#define DEVLINK_TRAP_GENERIC_NAME_NON_IP_PACKET \
899
+ "non_ip"
900
+#define DEVLINK_TRAP_GENERIC_NAME_UC_DIP_MC_DMAC \
901
+ "uc_dip_over_mc_dmac"
902
+#define DEVLINK_TRAP_GENERIC_NAME_DIP_LB \
903
+ "dip_is_loopback_address"
904
+#define DEVLINK_TRAP_GENERIC_NAME_SIP_MC \
905
+ "sip_is_mc"
906
+#define DEVLINK_TRAP_GENERIC_NAME_SIP_LB \
907
+ "sip_is_loopback_address"
908
+#define DEVLINK_TRAP_GENERIC_NAME_CORRUPTED_IP_HDR \
909
+ "ip_header_corrupted"
910
+#define DEVLINK_TRAP_GENERIC_NAME_IPV4_SIP_BC \
911
+ "ipv4_sip_is_limited_bc"
912
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_MC_DIP_RESERVED_SCOPE \
913
+ "ipv6_mc_dip_reserved_scope"
914
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_MC_DIP_INTERFACE_LOCAL_SCOPE \
915
+ "ipv6_mc_dip_interface_local_scope"
916
+#define DEVLINK_TRAP_GENERIC_NAME_MTU_ERROR \
917
+ "mtu_value_is_too_small"
918
+#define DEVLINK_TRAP_GENERIC_NAME_UNRESOLVED_NEIGH \
919
+ "unresolved_neigh"
920
+#define DEVLINK_TRAP_GENERIC_NAME_RPF \
921
+ "mc_reverse_path_forwarding"
922
+#define DEVLINK_TRAP_GENERIC_NAME_REJECT_ROUTE \
923
+ "reject_route"
924
+#define DEVLINK_TRAP_GENERIC_NAME_IPV4_LPM_UNICAST_MISS \
925
+ "ipv4_lpm_miss"
926
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_LPM_UNICAST_MISS \
927
+ "ipv6_lpm_miss"
928
+#define DEVLINK_TRAP_GENERIC_NAME_NON_ROUTABLE \
929
+ "non_routable_packet"
930
+#define DEVLINK_TRAP_GENERIC_NAME_DECAP_ERROR \
931
+ "decap_error"
932
+#define DEVLINK_TRAP_GENERIC_NAME_OVERLAY_SMAC_MC \
933
+ "overlay_smac_is_mc"
934
+#define DEVLINK_TRAP_GENERIC_NAME_INGRESS_FLOW_ACTION_DROP \
935
+ "ingress_flow_action_drop"
936
+#define DEVLINK_TRAP_GENERIC_NAME_EGRESS_FLOW_ACTION_DROP \
937
+ "egress_flow_action_drop"
938
+#define DEVLINK_TRAP_GENERIC_NAME_STP \
939
+ "stp"
940
+#define DEVLINK_TRAP_GENERIC_NAME_LACP \
941
+ "lacp"
942
+#define DEVLINK_TRAP_GENERIC_NAME_LLDP \
943
+ "lldp"
944
+#define DEVLINK_TRAP_GENERIC_NAME_IGMP_QUERY \
945
+ "igmp_query"
946
+#define DEVLINK_TRAP_GENERIC_NAME_IGMP_V1_REPORT \
947
+ "igmp_v1_report"
948
+#define DEVLINK_TRAP_GENERIC_NAME_IGMP_V2_REPORT \
949
+ "igmp_v2_report"
950
+#define DEVLINK_TRAP_GENERIC_NAME_IGMP_V3_REPORT \
951
+ "igmp_v3_report"
952
+#define DEVLINK_TRAP_GENERIC_NAME_IGMP_V2_LEAVE \
953
+ "igmp_v2_leave"
954
+#define DEVLINK_TRAP_GENERIC_NAME_MLD_QUERY \
955
+ "mld_query"
956
+#define DEVLINK_TRAP_GENERIC_NAME_MLD_V1_REPORT \
957
+ "mld_v1_report"
958
+#define DEVLINK_TRAP_GENERIC_NAME_MLD_V2_REPORT \
959
+ "mld_v2_report"
960
+#define DEVLINK_TRAP_GENERIC_NAME_MLD_V1_DONE \
961
+ "mld_v1_done"
962
+#define DEVLINK_TRAP_GENERIC_NAME_IPV4_DHCP \
963
+ "ipv4_dhcp"
964
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_DHCP \
965
+ "ipv6_dhcp"
966
+#define DEVLINK_TRAP_GENERIC_NAME_ARP_REQUEST \
967
+ "arp_request"
968
+#define DEVLINK_TRAP_GENERIC_NAME_ARP_RESPONSE \
969
+ "arp_response"
970
+#define DEVLINK_TRAP_GENERIC_NAME_ARP_OVERLAY \
971
+ "arp_overlay"
972
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_NEIGH_SOLICIT \
973
+ "ipv6_neigh_solicit"
974
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_NEIGH_ADVERT \
975
+ "ipv6_neigh_advert"
976
+#define DEVLINK_TRAP_GENERIC_NAME_IPV4_BFD \
977
+ "ipv4_bfd"
978
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_BFD \
979
+ "ipv6_bfd"
980
+#define DEVLINK_TRAP_GENERIC_NAME_IPV4_OSPF \
981
+ "ipv4_ospf"
982
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_OSPF \
983
+ "ipv6_ospf"
984
+#define DEVLINK_TRAP_GENERIC_NAME_IPV4_BGP \
985
+ "ipv4_bgp"
986
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_BGP \
987
+ "ipv6_bgp"
988
+#define DEVLINK_TRAP_GENERIC_NAME_IPV4_VRRP \
989
+ "ipv4_vrrp"
990
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_VRRP \
991
+ "ipv6_vrrp"
992
+#define DEVLINK_TRAP_GENERIC_NAME_IPV4_PIM \
993
+ "ipv4_pim"
994
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_PIM \
995
+ "ipv6_pim"
996
+#define DEVLINK_TRAP_GENERIC_NAME_UC_LB \
997
+ "uc_loopback"
998
+#define DEVLINK_TRAP_GENERIC_NAME_LOCAL_ROUTE \
999
+ "local_route"
1000
+#define DEVLINK_TRAP_GENERIC_NAME_EXTERNAL_ROUTE \
1001
+ "external_route"
1002
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_UC_DIP_LINK_LOCAL_SCOPE \
1003
+ "ipv6_uc_dip_link_local_scope"
1004
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_DIP_ALL_NODES \
1005
+ "ipv6_dip_all_nodes"
1006
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_DIP_ALL_ROUTERS \
1007
+ "ipv6_dip_all_routers"
1008
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_ROUTER_SOLICIT \
1009
+ "ipv6_router_solicit"
1010
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_ROUTER_ADVERT \
1011
+ "ipv6_router_advert"
1012
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_REDIRECT \
1013
+ "ipv6_redirect"
1014
+#define DEVLINK_TRAP_GENERIC_NAME_IPV4_ROUTER_ALERT \
1015
+ "ipv4_router_alert"
1016
+#define DEVLINK_TRAP_GENERIC_NAME_IPV6_ROUTER_ALERT \
1017
+ "ipv6_router_alert"
1018
+#define DEVLINK_TRAP_GENERIC_NAME_PTP_EVENT \
1019
+ "ptp_event"
1020
+#define DEVLINK_TRAP_GENERIC_NAME_PTP_GENERAL \
1021
+ "ptp_general"
1022
+#define DEVLINK_TRAP_GENERIC_NAME_FLOW_ACTION_SAMPLE \
1023
+ "flow_action_sample"
1024
+#define DEVLINK_TRAP_GENERIC_NAME_FLOW_ACTION_TRAP \
1025
+ "flow_action_trap"
1026
+#define DEVLINK_TRAP_GENERIC_NAME_EARLY_DROP \
1027
+ "early_drop"
1028
+#define DEVLINK_TRAP_GENERIC_NAME_VXLAN_PARSING \
1029
+ "vxlan_parsing"
1030
+#define DEVLINK_TRAP_GENERIC_NAME_LLC_SNAP_PARSING \
1031
+ "llc_snap_parsing"
1032
+#define DEVLINK_TRAP_GENERIC_NAME_VLAN_PARSING \
1033
+ "vlan_parsing"
1034
+#define DEVLINK_TRAP_GENERIC_NAME_PPPOE_PPP_PARSING \
1035
+ "pppoe_ppp_parsing"
1036
+#define DEVLINK_TRAP_GENERIC_NAME_MPLS_PARSING \
1037
+ "mpls_parsing"
1038
+#define DEVLINK_TRAP_GENERIC_NAME_ARP_PARSING \
1039
+ "arp_parsing"
1040
+#define DEVLINK_TRAP_GENERIC_NAME_IP_1_PARSING \
1041
+ "ip_1_parsing"
1042
+#define DEVLINK_TRAP_GENERIC_NAME_IP_N_PARSING \
1043
+ "ip_n_parsing"
1044
+#define DEVLINK_TRAP_GENERIC_NAME_GRE_PARSING \
1045
+ "gre_parsing"
1046
+#define DEVLINK_TRAP_GENERIC_NAME_UDP_PARSING \
1047
+ "udp_parsing"
1048
+#define DEVLINK_TRAP_GENERIC_NAME_TCP_PARSING \
1049
+ "tcp_parsing"
1050
+#define DEVLINK_TRAP_GENERIC_NAME_IPSEC_PARSING \
1051
+ "ipsec_parsing"
1052
+#define DEVLINK_TRAP_GENERIC_NAME_SCTP_PARSING \
1053
+ "sctp_parsing"
1054
+#define DEVLINK_TRAP_GENERIC_NAME_DCCP_PARSING \
1055
+ "dccp_parsing"
1056
+#define DEVLINK_TRAP_GENERIC_NAME_GTP_PARSING \
1057
+ "gtp_parsing"
1058
+#define DEVLINK_TRAP_GENERIC_NAME_ESP_PARSING \
1059
+ "esp_parsing"
1060
+
1061
+
1062
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_L2_DROPS \
1063
+ "l2_drops"
1064
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_L3_DROPS \
1065
+ "l3_drops"
1066
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_L3_EXCEPTIONS \
1067
+ "l3_exceptions"
1068
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_BUFFER_DROPS \
1069
+ "buffer_drops"
1070
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_TUNNEL_DROPS \
1071
+ "tunnel_drops"
1072
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_ACL_DROPS \
1073
+ "acl_drops"
1074
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_STP \
1075
+ "stp"
1076
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_LACP \
1077
+ "lacp"
1078
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_LLDP \
1079
+ "lldp"
1080
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_MC_SNOOPING \
1081
+ "mc_snooping"
1082
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_DHCP \
1083
+ "dhcp"
1084
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_NEIGH_DISCOVERY \
1085
+ "neigh_discovery"
1086
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_BFD \
1087
+ "bfd"
1088
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_OSPF \
1089
+ "ospf"
1090
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_BGP \
1091
+ "bgp"
1092
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_VRRP \
1093
+ "vrrp"
1094
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_PIM \
1095
+ "pim"
1096
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_UC_LB \
1097
+ "uc_loopback"
1098
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_LOCAL_DELIVERY \
1099
+ "local_delivery"
1100
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_EXTERNAL_DELIVERY \
1101
+ "external_delivery"
1102
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_IPV6 \
1103
+ "ipv6"
1104
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_PTP_EVENT \
1105
+ "ptp_event"
1106
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_PTP_GENERAL \
1107
+ "ptp_general"
1108
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_ACL_SAMPLE \
1109
+ "acl_sample"
1110
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_ACL_TRAP \
1111
+ "acl_trap"
1112
+#define DEVLINK_TRAP_GROUP_GENERIC_NAME_PARSER_ERROR_DROPS \
1113
+ "parser_error_drops"
1114
+
1115
+#define DEVLINK_TRAP_GENERIC(_type, _init_action, _id, _group_id, \
1116
+ _metadata_cap) \
1117
+ { \
1118
+ .type = DEVLINK_TRAP_TYPE_##_type, \
1119
+ .init_action = DEVLINK_TRAP_ACTION_##_init_action, \
1120
+ .generic = true, \
1121
+ .id = DEVLINK_TRAP_GENERIC_ID_##_id, \
1122
+ .name = DEVLINK_TRAP_GENERIC_NAME_##_id, \
1123
+ .init_group_id = _group_id, \
1124
+ .metadata_cap = _metadata_cap, \
1125
+ }
1126
+
1127
+#define DEVLINK_TRAP_DRIVER(_type, _init_action, _id, _name, _group_id, \
1128
+ _metadata_cap) \
1129
+ { \
1130
+ .type = DEVLINK_TRAP_TYPE_##_type, \
1131
+ .init_action = DEVLINK_TRAP_ACTION_##_init_action, \
1132
+ .generic = false, \
1133
+ .id = _id, \
1134
+ .name = _name, \
1135
+ .init_group_id = _group_id, \
1136
+ .metadata_cap = _metadata_cap, \
1137
+ }
1138
+
1139
+#define DEVLINK_TRAP_GROUP_GENERIC(_id, _policer_id) \
1140
+ { \
1141
+ .name = DEVLINK_TRAP_GROUP_GENERIC_NAME_##_id, \
1142
+ .id = DEVLINK_TRAP_GROUP_GENERIC_ID_##_id, \
1143
+ .generic = true, \
1144
+ .init_policer_id = _policer_id, \
1145
+ }
1146
+
1147
+#define DEVLINK_TRAP_POLICER(_id, _rate, _burst, _max_rate, _min_rate, \
1148
+ _max_burst, _min_burst) \
1149
+ { \
1150
+ .id = _id, \
1151
+ .init_rate = _rate, \
1152
+ .init_burst = _burst, \
1153
+ .max_rate = _max_rate, \
1154
+ .min_rate = _min_rate, \
1155
+ .max_burst = _max_burst, \
1156
+ .min_burst = _min_burst, \
1157
+ }
4091158
4101159 struct devlink_ops {
411
- int (*reload)(struct devlink *devlink, struct netlink_ext_ack *extack);
1160
+ /**
1161
+ * @supported_flash_update_params:
1162
+ * mask of parameters supported by the driver's .flash_update
1163
+ * implemementation.
1164
+ */
1165
+ u32 supported_flash_update_params;
1166
+ unsigned long reload_actions;
1167
+ unsigned long reload_limits;
1168
+ int (*reload_down)(struct devlink *devlink, bool netns_change,
1169
+ enum devlink_reload_action action,
1170
+ enum devlink_reload_limit limit,
1171
+ struct netlink_ext_ack *extack);
1172
+ int (*reload_up)(struct devlink *devlink, enum devlink_reload_action action,
1173
+ enum devlink_reload_limit limit, u32 *actions_performed,
1174
+ struct netlink_ext_ack *extack);
4121175 int (*port_type_set)(struct devlink_port *devlink_port,
4131176 enum devlink_port_type port_type);
4141177 int (*port_split)(struct devlink *devlink, unsigned int port_index,
....@@ -420,13 +1183,14 @@
4201183 struct devlink_sb_pool_info *pool_info);
4211184 int (*sb_pool_set)(struct devlink *devlink, unsigned int sb_index,
4221185 u16 pool_index, u32 size,
423
- enum devlink_sb_threshold_type threshold_type);
1186
+ enum devlink_sb_threshold_type threshold_type,
1187
+ struct netlink_ext_ack *extack);
4241188 int (*sb_port_pool_get)(struct devlink_port *devlink_port,
4251189 unsigned int sb_index, u16 pool_index,
4261190 u32 *p_threshold);
4271191 int (*sb_port_pool_set)(struct devlink_port *devlink_port,
4281192 unsigned int sb_index, u16 pool_index,
429
- u32 threshold);
1193
+ u32 threshold, struct netlink_ext_ack *extack);
4301194 int (*sb_tc_pool_bind_get)(struct devlink_port *devlink_port,
4311195 unsigned int sb_index,
4321196 u16 tc_index,
....@@ -436,7 +1200,8 @@
4361200 unsigned int sb_index,
4371201 u16 tc_index,
4381202 enum devlink_sb_pool_type pool_type,
439
- u16 pool_index, u32 threshold);
1203
+ u16 pool_index, u32 threshold,
1204
+ struct netlink_ext_ack *extack);
4401205 int (*sb_occ_snapshot)(struct devlink *devlink,
4411206 unsigned int sb_index);
4421207 int (*sb_occ_max_clear)(struct devlink *devlink,
....@@ -451,11 +1216,135 @@
4511216 u32 *p_cur, u32 *p_max);
4521217
4531218 int (*eswitch_mode_get)(struct devlink *devlink, u16 *p_mode);
454
- int (*eswitch_mode_set)(struct devlink *devlink, u16 mode);
1219
+ int (*eswitch_mode_set)(struct devlink *devlink, u16 mode,
1220
+ struct netlink_ext_ack *extack);
4551221 int (*eswitch_inline_mode_get)(struct devlink *devlink, u8 *p_inline_mode);
456
- int (*eswitch_inline_mode_set)(struct devlink *devlink, u8 inline_mode);
457
- int (*eswitch_encap_mode_get)(struct devlink *devlink, u8 *p_encap_mode);
458
- int (*eswitch_encap_mode_set)(struct devlink *devlink, u8 encap_mode);
1222
+ int (*eswitch_inline_mode_set)(struct devlink *devlink, u8 inline_mode,
1223
+ struct netlink_ext_ack *extack);
1224
+ int (*eswitch_encap_mode_get)(struct devlink *devlink,
1225
+ enum devlink_eswitch_encap_mode *p_encap_mode);
1226
+ int (*eswitch_encap_mode_set)(struct devlink *devlink,
1227
+ enum devlink_eswitch_encap_mode encap_mode,
1228
+ struct netlink_ext_ack *extack);
1229
+ int (*info_get)(struct devlink *devlink, struct devlink_info_req *req,
1230
+ struct netlink_ext_ack *extack);
1231
+ /**
1232
+ * @flash_update: Device flash update function
1233
+ *
1234
+ * Used to perform a flash update for the device. The set of
1235
+ * parameters supported by the driver should be set in
1236
+ * supported_flash_update_params.
1237
+ */
1238
+ int (*flash_update)(struct devlink *devlink,
1239
+ struct devlink_flash_update_params *params,
1240
+ struct netlink_ext_ack *extack);
1241
+ /**
1242
+ * @trap_init: Trap initialization function.
1243
+ *
1244
+ * Should be used by device drivers to initialize the trap in the
1245
+ * underlying device. Drivers should also store the provided trap
1246
+ * context, so that they could efficiently pass it to
1247
+ * devlink_trap_report() when the trap is triggered.
1248
+ */
1249
+ int (*trap_init)(struct devlink *devlink,
1250
+ const struct devlink_trap *trap, void *trap_ctx);
1251
+ /**
1252
+ * @trap_fini: Trap de-initialization function.
1253
+ *
1254
+ * Should be used by device drivers to de-initialize the trap in the
1255
+ * underlying device.
1256
+ */
1257
+ void (*trap_fini)(struct devlink *devlink,
1258
+ const struct devlink_trap *trap, void *trap_ctx);
1259
+ /**
1260
+ * @trap_action_set: Trap action set function.
1261
+ */
1262
+ int (*trap_action_set)(struct devlink *devlink,
1263
+ const struct devlink_trap *trap,
1264
+ enum devlink_trap_action action,
1265
+ struct netlink_ext_ack *extack);
1266
+ /**
1267
+ * @trap_group_init: Trap group initialization function.
1268
+ *
1269
+ * Should be used by device drivers to initialize the trap group in the
1270
+ * underlying device.
1271
+ */
1272
+ int (*trap_group_init)(struct devlink *devlink,
1273
+ const struct devlink_trap_group *group);
1274
+ /**
1275
+ * @trap_group_set: Trap group parameters set function.
1276
+ *
1277
+ * Note: @policer can be NULL when a policer is being unbound from
1278
+ * @group.
1279
+ */
1280
+ int (*trap_group_set)(struct devlink *devlink,
1281
+ const struct devlink_trap_group *group,
1282
+ const struct devlink_trap_policer *policer,
1283
+ struct netlink_ext_ack *extack);
1284
+ /**
1285
+ * @trap_group_action_set: Trap group action set function.
1286
+ *
1287
+ * If this callback is populated, it will take precedence over looping
1288
+ * over all traps in a group and calling .trap_action_set().
1289
+ */
1290
+ int (*trap_group_action_set)(struct devlink *devlink,
1291
+ const struct devlink_trap_group *group,
1292
+ enum devlink_trap_action action,
1293
+ struct netlink_ext_ack *extack);
1294
+ /**
1295
+ * @trap_policer_init: Trap policer initialization function.
1296
+ *
1297
+ * Should be used by device drivers to initialize the trap policer in
1298
+ * the underlying device.
1299
+ */
1300
+ int (*trap_policer_init)(struct devlink *devlink,
1301
+ const struct devlink_trap_policer *policer);
1302
+ /**
1303
+ * @trap_policer_fini: Trap policer de-initialization function.
1304
+ *
1305
+ * Should be used by device drivers to de-initialize the trap policer
1306
+ * in the underlying device.
1307
+ */
1308
+ void (*trap_policer_fini)(struct devlink *devlink,
1309
+ const struct devlink_trap_policer *policer);
1310
+ /**
1311
+ * @trap_policer_set: Trap policer parameters set function.
1312
+ */
1313
+ int (*trap_policer_set)(struct devlink *devlink,
1314
+ const struct devlink_trap_policer *policer,
1315
+ u64 rate, u64 burst,
1316
+ struct netlink_ext_ack *extack);
1317
+ /**
1318
+ * @trap_policer_counter_get: Trap policer counter get function.
1319
+ *
1320
+ * Should be used by device drivers to report number of packets dropped
1321
+ * by the policer.
1322
+ */
1323
+ int (*trap_policer_counter_get)(struct devlink *devlink,
1324
+ const struct devlink_trap_policer *policer,
1325
+ u64 *p_drops);
1326
+ /**
1327
+ * @port_function_hw_addr_get: Port function's hardware address get function.
1328
+ *
1329
+ * Should be used by device drivers to report the hardware address of a function managed
1330
+ * by the devlink port. Driver should return -EOPNOTSUPP if it doesn't support port
1331
+ * function handling for a particular port.
1332
+ *
1333
+ * Note: @extack can be NULL when port notifier queries the port function.
1334
+ */
1335
+ int (*port_function_hw_addr_get)(struct devlink *devlink, struct devlink_port *port,
1336
+ u8 *hw_addr, int *hw_addr_len,
1337
+ struct netlink_ext_ack *extack);
1338
+ /**
1339
+ * @port_function_hw_addr_set: Port function's hardware address set function.
1340
+ *
1341
+ * Should be used by device drivers to set the hardware address of a function managed
1342
+ * by the devlink port. Driver should return -EOPNOTSUPP if it doesn't support port
1343
+ * function handling for a particular port.
1344
+ */
1345
+ int (*port_function_hw_addr_set)(struct devlink *devlink, struct devlink_port *port,
1346
+ const u8 *hw_addr, int hw_addr_len,
1347
+ struct netlink_ext_ack *extack);
4591348 };
4601349
4611350 static inline void *devlink_priv(struct devlink *devlink)
....@@ -470,13 +1359,32 @@
4701359 return container_of(priv, struct devlink, priv);
4711360 }
4721361
1362
+static inline struct devlink_port *
1363
+netdev_to_devlink_port(struct net_device *dev)
1364
+{
1365
+ if (dev->netdev_ops->ndo_get_devlink_port)
1366
+ return dev->netdev_ops->ndo_get_devlink_port(dev);
1367
+ return NULL;
1368
+}
1369
+
1370
+static inline struct devlink *netdev_to_devlink(struct net_device *dev)
1371
+{
1372
+ struct devlink_port *devlink_port = netdev_to_devlink_port(dev);
1373
+
1374
+ if (devlink_port)
1375
+ return devlink_port->devlink;
1376
+ return NULL;
1377
+}
1378
+
4731379 struct ib_device;
4741380
475
-#if IS_ENABLED(CONFIG_NET_DEVLINK)
476
-
1381
+struct net *devlink_net(const struct devlink *devlink);
1382
+void devlink_net_set(struct devlink *devlink, struct net *net);
4771383 struct devlink *devlink_alloc(const struct devlink_ops *ops, size_t priv_size);
4781384 int devlink_register(struct devlink *devlink, struct device *dev);
4791385 void devlink_unregister(struct devlink *devlink);
1386
+void devlink_reload_enable(struct devlink *devlink);
1387
+void devlink_reload_disable(struct devlink *devlink);
4801388 void devlink_free(struct devlink *devlink);
4811389 int devlink_port_register(struct devlink *devlink,
4821390 struct devlink_port *devlink_port,
....@@ -488,11 +1396,11 @@
4881396 struct ib_device *ibdev);
4891397 void devlink_port_type_clear(struct devlink_port *devlink_port);
4901398 void devlink_port_attrs_set(struct devlink_port *devlink_port,
491
- enum devlink_port_flavour flavour,
492
- u32 port_number, bool split,
493
- u32 split_subport_number);
494
-int devlink_port_get_phys_port_name(struct devlink_port *devlink_port,
495
- char *name, size_t len);
1399
+ struct devlink_port_attrs *devlink_port_attrs);
1400
+void devlink_port_attrs_pci_pf_set(struct devlink_port *devlink_port, u32 controller,
1401
+ u16 pf, bool external);
1402
+void devlink_port_attrs_pci_vf_set(struct devlink_port *devlink_port, u32 controller,
1403
+ u16 pf, u16 vf, bool external);
4961404 int devlink_sb_register(struct devlink *devlink, unsigned int sb_index,
4971405 u32 size, u16 ingress_pools_count,
4981406 u16 egress_pools_count, u16 ingress_tc_count,
....@@ -548,281 +1456,198 @@
5481456 void devlink_params_unregister(struct devlink *devlink,
5491457 const struct devlink_param *params,
5501458 size_t params_count);
1459
+void devlink_params_publish(struct devlink *devlink);
1460
+void devlink_params_unpublish(struct devlink *devlink);
1461
+int devlink_port_params_register(struct devlink_port *devlink_port,
1462
+ const struct devlink_param *params,
1463
+ size_t params_count);
1464
+void devlink_port_params_unregister(struct devlink_port *devlink_port,
1465
+ const struct devlink_param *params,
1466
+ size_t params_count);
5511467 int devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
5521468 union devlink_param_value *init_val);
5531469 int devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
5541470 union devlink_param_value init_val);
1471
+int
1472
+devlink_port_param_driverinit_value_get(struct devlink_port *devlink_port,
1473
+ u32 param_id,
1474
+ union devlink_param_value *init_val);
1475
+int devlink_port_param_driverinit_value_set(struct devlink_port *devlink_port,
1476
+ u32 param_id,
1477
+ union devlink_param_value init_val);
5551478 void devlink_param_value_changed(struct devlink *devlink, u32 param_id);
1479
+void devlink_port_param_value_changed(struct devlink_port *devlink_port,
1480
+ u32 param_id);
5561481 void devlink_param_value_str_fill(union devlink_param_value *dst_val,
5571482 const char *src);
558
-struct devlink_region *devlink_region_create(struct devlink *devlink,
559
- const char *region_name,
560
- u32 region_max_snapshots,
561
- u64 region_size);
1483
+struct devlink_region *
1484
+devlink_region_create(struct devlink *devlink,
1485
+ const struct devlink_region_ops *ops,
1486
+ u32 region_max_snapshots, u64 region_size);
1487
+struct devlink_region *
1488
+devlink_port_region_create(struct devlink_port *port,
1489
+ const struct devlink_port_region_ops *ops,
1490
+ u32 region_max_snapshots, u64 region_size);
5621491 void devlink_region_destroy(struct devlink_region *region);
563
-u32 devlink_region_shapshot_id_get(struct devlink *devlink);
564
-int devlink_region_snapshot_create(struct devlink_region *region, u64 data_len,
565
- u8 *data, u32 snapshot_id,
566
- devlink_snapshot_data_dest_t *data_destructor);
1492
+void devlink_port_region_destroy(struct devlink_region *region);
1493
+
1494
+int devlink_region_snapshot_id_get(struct devlink *devlink, u32 *id);
1495
+void devlink_region_snapshot_id_put(struct devlink *devlink, u32 id);
1496
+int devlink_region_snapshot_create(struct devlink_region *region,
1497
+ u8 *data, u32 snapshot_id);
1498
+int devlink_info_serial_number_put(struct devlink_info_req *req,
1499
+ const char *sn);
1500
+int devlink_info_driver_name_put(struct devlink_info_req *req,
1501
+ const char *name);
1502
+int devlink_info_board_serial_number_put(struct devlink_info_req *req,
1503
+ const char *bsn);
1504
+int devlink_info_version_fixed_put(struct devlink_info_req *req,
1505
+ const char *version_name,
1506
+ const char *version_value);
1507
+int devlink_info_version_stored_put(struct devlink_info_req *req,
1508
+ const char *version_name,
1509
+ const char *version_value);
1510
+int devlink_info_version_running_put(struct devlink_info_req *req,
1511
+ const char *version_name,
1512
+ const char *version_value);
1513
+
1514
+int devlink_fmsg_obj_nest_start(struct devlink_fmsg *fmsg);
1515
+int devlink_fmsg_obj_nest_end(struct devlink_fmsg *fmsg);
1516
+
1517
+int devlink_fmsg_pair_nest_start(struct devlink_fmsg *fmsg, const char *name);
1518
+int devlink_fmsg_pair_nest_end(struct devlink_fmsg *fmsg);
1519
+
1520
+int devlink_fmsg_arr_pair_nest_start(struct devlink_fmsg *fmsg,
1521
+ const char *name);
1522
+int devlink_fmsg_arr_pair_nest_end(struct devlink_fmsg *fmsg);
1523
+int devlink_fmsg_binary_pair_nest_start(struct devlink_fmsg *fmsg,
1524
+ const char *name);
1525
+int devlink_fmsg_binary_pair_nest_end(struct devlink_fmsg *fmsg);
1526
+
1527
+int devlink_fmsg_bool_put(struct devlink_fmsg *fmsg, bool value);
1528
+int devlink_fmsg_u8_put(struct devlink_fmsg *fmsg, u8 value);
1529
+int devlink_fmsg_u32_put(struct devlink_fmsg *fmsg, u32 value);
1530
+int devlink_fmsg_u64_put(struct devlink_fmsg *fmsg, u64 value);
1531
+int devlink_fmsg_string_put(struct devlink_fmsg *fmsg, const char *value);
1532
+int devlink_fmsg_binary_put(struct devlink_fmsg *fmsg, const void *value,
1533
+ u16 value_len);
1534
+
1535
+int devlink_fmsg_bool_pair_put(struct devlink_fmsg *fmsg, const char *name,
1536
+ bool value);
1537
+int devlink_fmsg_u8_pair_put(struct devlink_fmsg *fmsg, const char *name,
1538
+ u8 value);
1539
+int devlink_fmsg_u32_pair_put(struct devlink_fmsg *fmsg, const char *name,
1540
+ u32 value);
1541
+int devlink_fmsg_u64_pair_put(struct devlink_fmsg *fmsg, const char *name,
1542
+ u64 value);
1543
+int devlink_fmsg_string_pair_put(struct devlink_fmsg *fmsg, const char *name,
1544
+ const char *value);
1545
+int devlink_fmsg_binary_pair_put(struct devlink_fmsg *fmsg, const char *name,
1546
+ const void *value, u32 value_len);
1547
+
1548
+struct devlink_health_reporter *
1549
+devlink_health_reporter_create(struct devlink *devlink,
1550
+ const struct devlink_health_reporter_ops *ops,
1551
+ u64 graceful_period, void *priv);
1552
+
1553
+struct devlink_health_reporter *
1554
+devlink_port_health_reporter_create(struct devlink_port *port,
1555
+ const struct devlink_health_reporter_ops *ops,
1556
+ u64 graceful_period, void *priv);
1557
+
1558
+void
1559
+devlink_health_reporter_destroy(struct devlink_health_reporter *reporter);
1560
+
1561
+void
1562
+devlink_port_health_reporter_destroy(struct devlink_health_reporter *reporter);
1563
+
1564
+void *
1565
+devlink_health_reporter_priv(struct devlink_health_reporter *reporter);
1566
+int devlink_health_report(struct devlink_health_reporter *reporter,
1567
+ const char *msg, void *priv_ctx);
1568
+void
1569
+devlink_health_reporter_state_update(struct devlink_health_reporter *reporter,
1570
+ enum devlink_health_reporter_state state);
1571
+void
1572
+devlink_health_reporter_recovery_done(struct devlink_health_reporter *reporter);
1573
+
1574
+bool devlink_is_reload_failed(const struct devlink *devlink);
1575
+void devlink_remote_reload_actions_performed(struct devlink *devlink,
1576
+ enum devlink_reload_limit limit,
1577
+ u32 actions_performed);
1578
+
1579
+void devlink_flash_update_begin_notify(struct devlink *devlink);
1580
+void devlink_flash_update_end_notify(struct devlink *devlink);
1581
+void devlink_flash_update_status_notify(struct devlink *devlink,
1582
+ const char *status_msg,
1583
+ const char *component,
1584
+ unsigned long done,
1585
+ unsigned long total);
1586
+void devlink_flash_update_timeout_notify(struct devlink *devlink,
1587
+ const char *status_msg,
1588
+ const char *component,
1589
+ unsigned long timeout);
1590
+
1591
+int devlink_traps_register(struct devlink *devlink,
1592
+ const struct devlink_trap *traps,
1593
+ size_t traps_count, void *priv);
1594
+void devlink_traps_unregister(struct devlink *devlink,
1595
+ const struct devlink_trap *traps,
1596
+ size_t traps_count);
1597
+void devlink_trap_report(struct devlink *devlink, struct sk_buff *skb,
1598
+ void *trap_ctx, struct devlink_port *in_devlink_port,
1599
+ const struct flow_action_cookie *fa_cookie);
1600
+void *devlink_trap_ctx_priv(void *trap_ctx);
1601
+int devlink_trap_groups_register(struct devlink *devlink,
1602
+ const struct devlink_trap_group *groups,
1603
+ size_t groups_count);
1604
+void devlink_trap_groups_unregister(struct devlink *devlink,
1605
+ const struct devlink_trap_group *groups,
1606
+ size_t groups_count);
1607
+int
1608
+devlink_trap_policers_register(struct devlink *devlink,
1609
+ const struct devlink_trap_policer *policers,
1610
+ size_t policers_count);
1611
+void
1612
+devlink_trap_policers_unregister(struct devlink *devlink,
1613
+ const struct devlink_trap_policer *policers,
1614
+ size_t policers_count);
1615
+
1616
+#if IS_ENABLED(CONFIG_NET_DEVLINK)
1617
+
1618
+void devlink_compat_running_version(struct net_device *dev,
1619
+ char *buf, size_t len);
1620
+int devlink_compat_flash_update(struct net_device *dev, const char *file_name);
1621
+int devlink_compat_phys_port_name_get(struct net_device *dev,
1622
+ char *name, size_t len);
1623
+int devlink_compat_switch_id_get(struct net_device *dev,
1624
+ struct netdev_phys_item_id *ppid);
5671625
5681626 #else
5691627
570
-static inline struct devlink *devlink_alloc(const struct devlink_ops *ops,
571
- size_t priv_size)
572
-{
573
- return kzalloc(sizeof(struct devlink) + priv_size, GFP_KERNEL);
574
-}
575
-
576
-static inline int devlink_register(struct devlink *devlink, struct device *dev)
577
-{
578
- return 0;
579
-}
580
-
581
-static inline void devlink_unregister(struct devlink *devlink)
582
-{
583
-}
584
-
585
-static inline void devlink_free(struct devlink *devlink)
586
-{
587
- kfree(devlink);
588
-}
589
-
590
-static inline int devlink_port_register(struct devlink *devlink,
591
- struct devlink_port *devlink_port,
592
- unsigned int port_index)
593
-{
594
- return 0;
595
-}
596
-
597
-static inline void devlink_port_unregister(struct devlink_port *devlink_port)
598
-{
599
-}
600
-
601
-static inline void devlink_port_type_eth_set(struct devlink_port *devlink_port,
602
- struct net_device *netdev)
603
-{
604
-}
605
-
606
-static inline void devlink_port_type_ib_set(struct devlink_port *devlink_port,
607
- struct ib_device *ibdev)
608
-{
609
-}
610
-
611
-static inline void devlink_port_type_clear(struct devlink_port *devlink_port)
612
-{
613
-}
614
-
615
-static inline void devlink_port_attrs_set(struct devlink_port *devlink_port,
616
- enum devlink_port_flavour flavour,
617
- u32 port_number, bool split,
618
- u32 split_subport_number)
619
-{
620
-}
621
-
622
-static inline int
623
-devlink_port_get_phys_port_name(struct devlink_port *devlink_port,
624
- char *name, size_t len)
625
-{
626
- return -EOPNOTSUPP;
627
-}
628
-
629
-static inline int devlink_sb_register(struct devlink *devlink,
630
- unsigned int sb_index, u32 size,
631
- u16 ingress_pools_count,
632
- u16 egress_pools_count,
633
- u16 ingress_tc_count,
634
- u16 egress_tc_count)
635
-{
636
- return 0;
637
-}
638
-
639
-static inline void devlink_sb_unregister(struct devlink *devlink,
640
- unsigned int sb_index)
641
-{
642
-}
643
-
644
-static inline int
645
-devlink_dpipe_table_register(struct devlink *devlink,
646
- const char *table_name,
647
- struct devlink_dpipe_table_ops *table_ops,
648
- void *priv, bool counter_control_extern)
649
-{
650
- return 0;
651
-}
652
-
653
-static inline void devlink_dpipe_table_unregister(struct devlink *devlink,
654
- const char *table_name)
655
-{
656
-}
657
-
658
-static inline int devlink_dpipe_headers_register(struct devlink *devlink,
659
- struct devlink_dpipe_headers *
660
- dpipe_headers)
661
-{
662
- return 0;
663
-}
664
-
665
-static inline void devlink_dpipe_headers_unregister(struct devlink *devlink)
666
-{
667
-}
668
-
669
-static inline bool devlink_dpipe_table_counter_enabled(struct devlink *devlink,
670
- const char *table_name)
671
-{
672
- return false;
673
-}
674
-
675
-static inline int
676
-devlink_dpipe_entry_ctx_prepare(struct devlink_dpipe_dump_ctx *dump_ctx)
677
-{
678
- return 0;
679
-}
680
-
681
-static inline int
682
-devlink_dpipe_entry_ctx_append(struct devlink_dpipe_dump_ctx *dump_ctx,
683
- struct devlink_dpipe_entry *entry)
684
-{
685
- return 0;
686
-}
687
-
688
-static inline int
689
-devlink_dpipe_entry_ctx_close(struct devlink_dpipe_dump_ctx *dump_ctx)
690
-{
691
- return 0;
692
-}
693
-
6941628 static inline void
695
-devlink_dpipe_entry_clear(struct devlink_dpipe_entry *entry)
1629
+devlink_compat_running_version(struct net_device *dev, char *buf, size_t len)
6961630 {
6971631 }
6981632
6991633 static inline int
700
-devlink_dpipe_action_put(struct sk_buff *skb,
701
- struct devlink_dpipe_action *action)
702
-{
703
- return 0;
704
-}
705
-
706
-static inline int
707
-devlink_dpipe_match_put(struct sk_buff *skb,
708
- struct devlink_dpipe_match *match)
709
-{
710
- return 0;
711
-}
712
-
713
-static inline int
714
-devlink_resource_register(struct devlink *devlink,
715
- const char *resource_name,
716
- u64 resource_size,
717
- u64 resource_id,
718
- u64 parent_resource_id,
719
- const struct devlink_resource_size_params *size_params)
720
-{
721
- return 0;
722
-}
723
-
724
-static inline void
725
-devlink_resources_unregister(struct devlink *devlink,
726
- struct devlink_resource *resource)
727
-{
728
-}
729
-
730
-static inline int
731
-devlink_resource_size_get(struct devlink *devlink, u64 resource_id,
732
- u64 *p_resource_size)
1634
+devlink_compat_flash_update(struct net_device *dev, const char *file_name)
7331635 {
7341636 return -EOPNOTSUPP;
7351637 }
7361638
7371639 static inline int
738
-devlink_dpipe_table_resource_set(struct devlink *devlink,
739
- const char *table_name, u64 resource_id,
740
- u64 resource_units)
741
-{
742
- return -EOPNOTSUPP;
743
-}
744
-
745
-static inline void
746
-devlink_resource_occ_get_register(struct devlink *devlink,
747
- u64 resource_id,
748
- devlink_resource_occ_get_t *occ_get,
749
- void *occ_get_priv)
750
-{
751
-}
752
-
753
-static inline void
754
-devlink_resource_occ_get_unregister(struct devlink *devlink,
755
- u64 resource_id)
756
-{
757
-}
758
-
759
-static inline int
760
-devlink_params_register(struct devlink *devlink,
761
- const struct devlink_param *params,
762
- size_t params_count)
763
-{
764
- return 0;
765
-}
766
-
767
-static inline void
768
-devlink_params_unregister(struct devlink *devlink,
769
- const struct devlink_param *params,
770
- size_t params_count)
771
-{
772
-
773
-}
774
-
775
-static inline int
776
-devlink_param_driverinit_value_get(struct devlink *devlink, u32 param_id,
777
- union devlink_param_value *init_val)
1640
+devlink_compat_phys_port_name_get(struct net_device *dev,
1641
+ char *name, size_t len)
7781642 {
7791643 return -EOPNOTSUPP;
7801644 }
7811645
7821646 static inline int
783
-devlink_param_driverinit_value_set(struct devlink *devlink, u32 param_id,
784
- union devlink_param_value init_val)
1647
+devlink_compat_switch_id_get(struct net_device *dev,
1648
+ struct netdev_phys_item_id *ppid)
7851649 {
7861650 return -EOPNOTSUPP;
787
-}
788
-
789
-static inline void
790
-devlink_param_value_changed(struct devlink *devlink, u32 param_id)
791
-{
792
-}
793
-
794
-static inline void
795
-devlink_param_value_str_fill(union devlink_param_value *dst_val,
796
- const char *src)
797
-{
798
-}
799
-
800
-static inline struct devlink_region *
801
-devlink_region_create(struct devlink *devlink,
802
- const char *region_name,
803
- u32 region_max_snapshots,
804
- u64 region_size)
805
-{
806
- return NULL;
807
-}
808
-
809
-static inline void
810
-devlink_region_destroy(struct devlink_region *region)
811
-{
812
-}
813
-
814
-static inline u32
815
-devlink_region_shapshot_id_get(struct devlink *devlink)
816
-{
817
- return 0;
818
-}
819
-
820
-static inline int
821
-devlink_region_snapshot_create(struct devlink_region *region, u64 data_len,
822
- u8 *data, u32 snapshot_id,
823
- devlink_snapshot_data_dest_t *data_destructor)
824
-{
825
- return 0;
8261651 }
8271652
8281653 #endif