mlxsw: pci: Derive event type from event queue number
authorNir Dotan <nird@mellanox.com>
Thu, 4 Oct 2018 15:48:02 +0000 (15:48 +0000)
committerDavid S. Miller <davem@davemloft.net>
Thu, 4 Oct 2018 16:53:03 +0000 (09:53 -0700)
Due to a hardware issue in Spectrum-2, the field event_type of the event
queue element (EQE) has become reserved. It was used to distinguish between
command interface completion events and completion events.

Use queue number to determine event type, as command interface completion
events are always received on EQ0 and mlxsw driver maps completion events
to EQ1.

Fixes: c3ab435466d5 ("mlxsw: spectrum: Extend to support Spectrum-2 ASIC")
Signed-off-by: Nir Dotan <nird@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/mellanox/mlxsw/pci.c

index 4d271fb3de3d2ba6f556f9869cb3720ce7a8f43c..5890fdfd62c377d9444d04589f0bf455d4ef6229 100644 (file)
@@ -718,14 +718,17 @@ static void mlxsw_pci_eq_tasklet(unsigned long data)
        memset(&active_cqns, 0, sizeof(active_cqns));
 
        while ((eqe = mlxsw_pci_eq_sw_eqe_get(q))) {
-               u8 event_type = mlxsw_pci_eqe_event_type_get(eqe);
 
-               switch (event_type) {
-               case MLXSW_PCI_EQE_EVENT_TYPE_CMD:
+               /* Command interface completion events are always received on
+                * queue MLXSW_PCI_EQ_ASYNC_NUM (EQ0) and completion events
+                * are mapped to queue MLXSW_PCI_EQ_COMP_NUM (EQ1).
+                */
+               switch (q->num) {
+               case MLXSW_PCI_EQ_ASYNC_NUM:
                        mlxsw_pci_eq_cmd_event(mlxsw_pci, eqe);
                        q->u.eq.ev_cmd_count++;
                        break;
-               case MLXSW_PCI_EQE_EVENT_TYPE_COMP:
+               case MLXSW_PCI_EQ_COMP_NUM:
                        cqn = mlxsw_pci_eqe_cqn_get(eqe);
                        set_bit(cqn, active_cqns);
                        cq_handle = true;