This patch adds to the initialization flow by getting switch
configuration, scheduler configuration and device capabilities.
Switch configuration:
On boot, an L2 switch element is created in the firmware per physical
function. Each physical function is also mapped to a port, to which its
switch element is connected. In other words, this switch can be visualized
as an embedded vSwitch that can connect a physical functions's virtual
station interfaces (VSIs) to the egress/ingress port. Egress/ingress
filters will be eventually created and applied on this switch element.
As part of the initialization flow, the driver gets configuration data
from this switch element and stores it.
Scheduler configuration:
The Tx scheduler is a subsystem responsible for setting and enforcing QoS.
As part of the initialization flow, the driver queries and stores the
default scheduler configuration for the given physical function.
Device capabilities:
As part of initialization, the driver has to determine what the device is
capable of (ex. max queues, VSIs, etc). This information is obtained from
the firmware and stored by the driver.
CC: Shannon Nelson
Signed-off-by: Anirudh Venkataramanan
---
v2: Addressed Shannon Nelson's review comment by changing retry count value
to 2.
---
drivers/net/ethernet/intel/ice/Makefile | 4 +-
drivers/net/ethernet/intel/ice/ice.h| 2 +
drivers/net/ethernet/intel/ice/ice_adminq_cmd.h | 209 ++
drivers/net/ethernet/intel/ice/ice_common.c | 231
drivers/net/ethernet/intel/ice/ice_common.h | 2 +
drivers/net/ethernet/intel/ice/ice_sched.c | 354
drivers/net/ethernet/intel/ice/ice_sched.h | 42 +++
drivers/net/ethernet/intel/ice/ice_switch.c | 158 +++
drivers/net/ethernet/intel/ice/ice_switch.h | 28 ++
drivers/net/ethernet/intel/ice/ice_type.h | 109
10 files changed, 1138 insertions(+), 1 deletion(-)
create mode 100644 drivers/net/ethernet/intel/ice/ice_sched.c
create mode 100644 drivers/net/ethernet/intel/ice/ice_sched.h
create mode 100644 drivers/net/ethernet/intel/ice/ice_switch.c
create mode 100644 drivers/net/ethernet/intel/ice/ice_switch.h
diff --git a/drivers/net/ethernet/intel/ice/Makefile
b/drivers/net/ethernet/intel/ice/Makefile
index 373d481dbb25..809d85c04398 100644
--- a/drivers/net/ethernet/intel/ice/Makefile
+++ b/drivers/net/ethernet/intel/ice/Makefile
@@ -27,4 +27,6 @@ obj-$(CONFIG_ICE) += ice.o
ice-y := ice_main.o\
ice_controlq.o \
ice_common.o \
-ice_nvm.o
+ice_nvm.o \
+ice_switch.o \
+ice_sched.o
diff --git a/drivers/net/ethernet/intel/ice/ice.h
b/drivers/net/ethernet/intel/ice/ice.h
index ab2800c31906..f6e3339591bb 100644
--- a/drivers/net/ethernet/intel/ice/ice.h
+++ b/drivers/net/ethernet/intel/ice/ice.h
@@ -30,7 +30,9 @@
#include
#include "ice_devids.h"
#include "ice_type.h"
+#include "ice_switch.h"
#include "ice_common.h"
+#include "ice_sched.h"
#define ICE_BAR0 0
#define ICE_AQ_LEN 64
diff --git a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
index 05b22a1ffd70..66a3f41df673 100644
--- a/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
+++ b/drivers/net/ethernet/intel/ice/ice_adminq_cmd.h
@@ -22,6 +22,8 @@
* descriptor format. It is shared between Firmware and Software.
*/
+#define ICE_AQC_TOPO_MAX_LEVEL_NUM 0x9
+
struct ice_aqc_generic {
__le32 param0;
__le32 param1;
@@ -82,6 +84,40 @@ struct ice_aqc_req_res {
u8 reserved[2];
};
+/* Get function capabilities (indirect 0x000A)
+ * Get device capabilities (indirect 0x000B)
+ */
+struct ice_aqc_list_caps {
+ u8 cmd_flags;
+ u8 pf_index;
+ u8 reserved[2];
+ __le32 count;
+ __le32 addr_high;
+ __le32 addr_low;
+};
+
+/* Device/Function buffer entry, repeated per reported capability */
+struct ice_aqc_list_caps_elem {
+ __le16 cap;
+#define ICE_AQC_CAPS_VSI 0x0017
+#define ICE_AQC_CAPS_RSS 0x0040
+#define ICE_AQC_CAPS_RXQS 0x0041
+#define ICE_AQC_CAPS_TXQS 0x0042
+#define ICE_AQC_CAPS_MSIX 0x0043
+#define ICE_AQC_CAPS_MAX_MTU 0x0047
+
+ u8 major_ver;
+ u8 minor_ver;
+ /* Number of resources described by this capability */
+ __le32 number;
+ /* Only meaningful for some types of resources */
+ __le32 logical_id;
+ /* Only meaningful for some types of resources */
+ __le32 phys_id;
+ __le64 rsvd1;
+ __le64 rsvd2;
+};
+
/* Clear PXE Command and response (direct 0x0110) */
struct ice_aqc_clear_pxe {
u8 rx_cnt;
@@ -89,6 +125,161 @@ struct ice_aqc_clear_pxe {