Skip to content

Commit 5f847ee

Browse files
gnitkakuba-moo
authored andcommitted
ice: Add NAC Topology device capability parser
Add new device capability ICE_AQC_CAPS_NAC_TOPOLOGY which allows to determine the mode of operation (1 or 2 NAC). Define a new structure to store data from new capability and corresponding parser code. Co-developed-by: Prathisna Padmasanan <[email protected]> Signed-off-by: Prathisna Padmasanan <[email protected]> Signed-off-by: Grzegorz Nitka <[email protected]> Reviewed-by: Pawel Kaminski <[email protected]> Reviewed-by: Mateusz Polchlopek <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Reviewed-by: Arkadiusz Kubalewski <[email protected]> Signed-off-by: Karol Kolacinski <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> Signed-off-by: Jacob Keller <[email protected]> Link: https://lore.kernel.org/r/20240528-next-2024-05-28-ptp-refactors-v1-10-c082739bb6f6@intel.com Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 713dcad commit 5f847ee

File tree

3 files changed

+42
-0
lines changed

3 files changed

+42
-0
lines changed

drivers/net/ethernet/intel/ice/ice_adminq_cmd.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ struct ice_aqc_list_caps_elem {
122122
#define ICE_AQC_CAPS_POST_UPDATE_RESET_RESTRICT 0x0077
123123
#define ICE_AQC_CAPS_NVM_MGMT 0x0080
124124
#define ICE_AQC_CAPS_TX_SCHED_TOPO_COMP_MODE 0x0085
125+
#define ICE_AQC_CAPS_NAC_TOPOLOGY 0x0087
125126
#define ICE_AQC_CAPS_FW_LAG_SUPPORT 0x0092
126127
#define ICE_AQC_BIT_ROCEV2_LAG 0x01
127128
#define ICE_AQC_BIT_SRIOV_LAG 0x02

drivers/net/ethernet/intel/ice/ice_common.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2593,6 +2593,34 @@ ice_parse_sensor_reading_cap(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
25932593
dev_p->supported_sensors);
25942594
}
25952595

2596+
/**
2597+
* ice_parse_nac_topo_dev_caps - Parse ICE_AQC_CAPS_NAC_TOPOLOGY cap
2598+
* @hw: pointer to the HW struct
2599+
* @dev_p: pointer to device capabilities structure
2600+
* @cap: capability element to parse
2601+
*
2602+
* Parse ICE_AQC_CAPS_NAC_TOPOLOGY for device capabilities.
2603+
*/
2604+
static void ice_parse_nac_topo_dev_caps(struct ice_hw *hw,
2605+
struct ice_hw_dev_caps *dev_p,
2606+
struct ice_aqc_list_caps_elem *cap)
2607+
{
2608+
dev_p->nac_topo.mode = le32_to_cpu(cap->number);
2609+
dev_p->nac_topo.id = le32_to_cpu(cap->phys_id) & ICE_NAC_TOPO_ID_M;
2610+
2611+
dev_info(ice_hw_to_dev(hw),
2612+
"PF is configured in %s mode with IP instance ID %d\n",
2613+
(dev_p->nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M) ?
2614+
"primary" : "secondary", dev_p->nac_topo.id);
2615+
2616+
ice_debug(hw, ICE_DBG_INIT, "dev caps: nac topology is_primary = %d\n",
2617+
!!(dev_p->nac_topo.mode & ICE_NAC_TOPO_PRIMARY_M));
2618+
ice_debug(hw, ICE_DBG_INIT, "dev caps: nac topology is_dual = %d\n",
2619+
!!(dev_p->nac_topo.mode & ICE_NAC_TOPO_DUAL_M));
2620+
ice_debug(hw, ICE_DBG_INIT, "dev caps: nac topology id = %d\n",
2621+
dev_p->nac_topo.id);
2622+
}
2623+
25962624
/**
25972625
* ice_parse_dev_caps - Parse device capabilities
25982626
* @hw: pointer to the HW struct
@@ -2644,6 +2672,9 @@ ice_parse_dev_caps(struct ice_hw *hw, struct ice_hw_dev_caps *dev_p,
26442672
case ICE_AQC_CAPS_SENSOR_READING:
26452673
ice_parse_sensor_reading_cap(hw, dev_p, &cap_resp[i]);
26462674
break;
2675+
case ICE_AQC_CAPS_NAC_TOPOLOGY:
2676+
ice_parse_nac_topo_dev_caps(hw, dev_p, &cap_resp[i]);
2677+
break;
26472678
default:
26482679
/* Don't list common capabilities as unknown */
26492680
if (!found)

drivers/net/ethernet/intel/ice/ice_type.h

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,15 @@ struct ice_ts_dev_info {
374374
u8 ts_ll_int_read;
375375
};
376376

377+
#define ICE_NAC_TOPO_PRIMARY_M BIT(0)
378+
#define ICE_NAC_TOPO_DUAL_M BIT(1)
379+
#define ICE_NAC_TOPO_ID_M GENMASK(0xF, 0)
380+
381+
struct ice_nac_topology {
382+
u32 mode;
383+
u8 id;
384+
};
385+
377386
/* Function specific capabilities */
378387
struct ice_hw_func_caps {
379388
struct ice_hw_common_caps common_cap;
@@ -395,6 +404,7 @@ struct ice_hw_dev_caps {
395404
u32 num_flow_director_fltr; /* Number of FD filters available */
396405
struct ice_ts_dev_info ts_dev_info;
397406
u32 num_funcs;
407+
struct ice_nac_topology nac_topo;
398408
/* bitmap of supported sensors
399409
* bit 0 - internal temperature sensor
400410
* bit 31:1 - Reserved

0 commit comments

Comments
 (0)