Skip to content

Commit ba73e97

Browse files
Arkadi Sharshevskydavem330
authored andcommitted
mlxsw: reg: Add Router Interface Counter Register
The RICNT register retrieves per port performance counter. It will be used to query the router interfaces statistics. Signed-off-by: Arkadi Sharshevsky <arkadis@mellanox.com> Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent d54b70f commit ba73e97

1 file changed

Lines changed: 124 additions & 0 deletions

File tree

  • drivers/net/ethernet/mellanox/mlxsw

‎drivers/net/ethernet/mellanox/mlxsw/reg.h‎

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4341,6 +4341,129 @@ static inline void mlxsw_reg_ratr_eth_entry_pack(char *payload,
43414341
mlxsw_reg_ratr_eth_destination_mac_memcpy_to(payload, dest_mac);
43424342
}
43434343

4344+
/* RICNT - Router Interface Counter Register
4345+
* -----------------------------------------
4346+
* The RICNT register retrieves per port performance counters
4347+
*/
4348+
#define MLXSW_REG_RICNT_ID 0x800B
4349+
#define MLXSW_REG_RICNT_LEN 0x100
4350+
4351+
MLXSW_REG_DEFINE(ricnt, MLXSW_REG_RICNT_ID, MLXSW_REG_RICNT_LEN);
4352+
4353+
/* reg_ricnt_counter_index
4354+
* Counter index
4355+
* Access: RW
4356+
*/
4357+
MLXSW_ITEM32(reg, ricnt, counter_index, 0x04, 0, 24);
4358+
4359+
enum mlxsw_reg_ricnt_counter_set_type {
4360+
/* No Count. */
4361+
MLXSW_REG_RICNT_COUNTER_SET_TYPE_NO_COUNT = 0x00,
4362+
/* Basic. Used for router interfaces, counting the following:
4363+
* - Error and Discard counters.
4364+
* - Unicast, Multicast and Broadcast counters. Sharing the
4365+
* same set of counters for the different type of traffic
4366+
* (IPv4, IPv6 and mpls).
4367+
*/
4368+
MLXSW_REG_RICNT_COUNTER_SET_TYPE_BASIC = 0x09,
4369+
};
4370+
4371+
/* reg_ricnt_counter_set_type
4372+
* Counter Set Type for router interface counter
4373+
* Access: RW
4374+
*/
4375+
MLXSW_ITEM32(reg, ricnt, counter_set_type, 0x04, 24, 8);
4376+
4377+
enum mlxsw_reg_ricnt_opcode {
4378+
/* Nop. Supported only for read access*/
4379+
MLXSW_REG_RICNT_OPCODE_NOP = 0x00,
4380+
/* Clear. Setting the clr bit will reset the counter value for
4381+
* all counters of the specified Router Interface.
4382+
*/
4383+
MLXSW_REG_RICNT_OPCODE_CLEAR = 0x08,
4384+
};
4385+
4386+
/* reg_ricnt_opcode
4387+
* Opcode
4388+
* Access: RW
4389+
*/
4390+
MLXSW_ITEM32(reg, ricnt, op, 0x00, 28, 4);
4391+
4392+
/* reg_ricnt_good_unicast_packets
4393+
* good unicast packets.
4394+
* Access: RW
4395+
*/
4396+
MLXSW_ITEM64(reg, ricnt, good_unicast_packets, 0x08, 0, 64);
4397+
4398+
/* reg_ricnt_good_multicast_packets
4399+
* good multicast packets.
4400+
* Access: RW
4401+
*/
4402+
MLXSW_ITEM64(reg, ricnt, good_multicast_packets, 0x10, 0, 64);
4403+
4404+
/* reg_ricnt_good_broadcast_packets
4405+
* good broadcast packets
4406+
* Access: RW
4407+
*/
4408+
MLXSW_ITEM64(reg, ricnt, good_broadcast_packets, 0x18, 0, 64);
4409+
4410+
/* reg_ricnt_good_unicast_bytes
4411+
* A count of L3 data and padding octets not including L2 headers
4412+
* for good unicast frames.
4413+
* Access: RW
4414+
*/
4415+
MLXSW_ITEM64(reg, ricnt, good_unicast_bytes, 0x20, 0, 64);
4416+
4417+
/* reg_ricnt_good_multicast_bytes
4418+
* A count of L3 data and padding octets not including L2 headers
4419+
* for good multicast frames.
4420+
* Access: RW
4421+
*/
4422+
MLXSW_ITEM64(reg, ricnt, good_multicast_bytes, 0x28, 0, 64);
4423+
4424+
/* reg_ritr_good_broadcast_bytes
4425+
* A count of L3 data and padding octets not including L2 headers
4426+
* for good broadcast frames.
4427+
* Access: RW
4428+
*/
4429+
MLXSW_ITEM64(reg, ricnt, good_broadcast_bytes, 0x30, 0, 64);
4430+
4431+
/* reg_ricnt_error_packets
4432+
* A count of errored frames that do not pass the router checks.
4433+
* Access: RW
4434+
*/
4435+
MLXSW_ITEM64(reg, ricnt, error_packets, 0x38, 0, 64);
4436+
4437+
/* reg_ricnt_discrad_packets
4438+
* A count of non-errored frames that do not pass the router checks.
4439+
* Access: RW
4440+
*/
4441+
MLXSW_ITEM64(reg, ricnt, discard_packets, 0x40, 0, 64);
4442+
4443+
/* reg_ricnt_error_bytes
4444+
* A count of L3 data and padding octets not including L2 headers
4445+
* for errored frames.
4446+
* Access: RW
4447+
*/
4448+
MLXSW_ITEM64(reg, ricnt, error_bytes, 0x48, 0, 64);
4449+
4450+
/* reg_ricnt_discard_bytes
4451+
* A count of L3 data and padding octets not including L2 headers
4452+
* for non-errored frames that do not pass the router checks.
4453+
* Access: RW
4454+
*/
4455+
MLXSW_ITEM64(reg, ricnt, discard_bytes, 0x50, 0, 64);
4456+
4457+
static inline void mlxsw_reg_ricnt_pack(char *payload, u32 index,
4458+
enum mlxsw_reg_ricnt_opcode op)
4459+
{
4460+
MLXSW_REG_ZERO(ricnt, payload);
4461+
mlxsw_reg_ricnt_op_set(payload, op);
4462+
mlxsw_reg_ricnt_counter_index_set(payload, index);
4463+
mlxsw_reg_ricnt_counter_set_type_set(payload,
4464+
MLXSW_REG_RICNT_COUNTER_SET_TYPE_BASIC);
4465+
}
4466+
43444467
/* RALTA - Router Algorithmic LPM Tree Allocation Register
43454468
* -------------------------------------------------------
43464469
* RALTA is used to allocate the LPM trees of the SHSPM method.
@@ -6080,6 +6203,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {
60806203
MLXSW_REG(rgcr),
60816204
MLXSW_REG(ritr),
60826205
MLXSW_REG(ratr),
6206+
MLXSW_REG(ricnt),
60836207
MLXSW_REG(ralta),
60846208
MLXSW_REG(ralst),
60856209
MLXSW_REG(raltb),

0 commit comments

Comments
 (0)