aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJiri Pirko <jiri@mellanox.com>2015-10-16 08:01:29 -0400
committerDavid S. Miller <davem@davemloft.net>2015-10-16 10:15:17 -0400
commitf5d88f589297a9b5fb110bf01d621d8c09fb7512 (patch)
tree3496e368a64fcdf2380aaa0d6263d2bf1dc57c92
parent236033b33c09ea9e34ce320d5cf9ef527077d7d5 (diff)
mlxsw: reg: Add Switch FDB Notification register definition
Add SFN register which is used to poll for newly added and aged-out FDB entries. Signed-off-by: Jiri Pirko <jiri@mellanox.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/mellanox/mlxsw/reg.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/drivers/net/ethernet/mellanox/mlxsw/reg.h b/drivers/net/ethernet/mellanox/mlxsw/reg.h
index c0cc5f102189..8afa2b6706c6 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/reg.h
+++ b/drivers/net/ethernet/mellanox/mlxsw/reg.h
@@ -371,6 +371,105 @@ mlxsw_reg_sfd_uc_unpack(char *payload, int rec_index,
371 *p_local_port = mlxsw_reg_sfd_uc_system_port_get(payload, rec_index); 371 *p_local_port = mlxsw_reg_sfd_uc_system_port_get(payload, rec_index);
372} 372}
373 373
374/* SFN - Switch FDB Notification Register
375 * -------------------------------------------
376 * The switch provides notifications on newly learned FDB entries and
377 * aged out entries. The notifications can be polled by software.
378 */
379#define MLXSW_REG_SFN_ID 0x200B
380#define MLXSW_REG_SFN_BASE_LEN 0x10 /* base length, without records */
381#define MLXSW_REG_SFN_REC_LEN 0x10 /* record length */
382#define MLXSW_REG_SFN_REC_MAX_COUNT 64
383#define MLXSW_REG_SFN_LEN (MLXSW_REG_SFN_BASE_LEN + \
384 MLXSW_REG_SFN_REC_LEN * MLXSW_REG_SFN_REC_MAX_COUNT)
385
386static const struct mlxsw_reg_info mlxsw_reg_sfn = {
387 .id = MLXSW_REG_SFN_ID,
388 .len = MLXSW_REG_SFN_LEN,
389};
390
391/* reg_sfn_swid
392 * Switch partition ID.
393 * Access: Index
394 */
395MLXSW_ITEM32(reg, sfn, swid, 0x00, 24, 8);
396
397/* reg_sfn_num_rec
398 * Request: Number of learned notifications and aged-out notification
399 * records requested.
400 * Response: Number of notification records returned (must be smaller
401 * than or equal to the value requested)
402 * Ranges 0..64
403 * Access: OP
404 */
405MLXSW_ITEM32(reg, sfn, num_rec, 0x04, 0, 8);
406
407static inline void mlxsw_reg_sfn_pack(char *payload)
408{
409 MLXSW_REG_ZERO(sfn, payload);
410 mlxsw_reg_sfn_swid_set(payload, 0);
411 mlxsw_reg_sfn_num_rec_set(payload, MLXSW_REG_SFN_REC_MAX_COUNT);
412}
413
414/* reg_sfn_rec_swid
415 * Switch partition ID.
416 * Access: RO
417 */
418MLXSW_ITEM32_INDEXED(reg, sfn, rec_swid, MLXSW_REG_SFN_BASE_LEN, 24, 8,
419 MLXSW_REG_SFN_REC_LEN, 0x00, false);
420
421enum mlxsw_reg_sfn_rec_type {
422 /* MAC addresses learned on a regular port. */
423 MLXSW_REG_SFN_REC_TYPE_LEARNED_MAC = 0x5,
424 /* Aged-out MAC address on a regular port */
425 MLXSW_REG_SFN_REC_TYPE_AGED_OUT_MAC = 0x7,
426};
427
428/* reg_sfn_rec_type
429 * Notification record type.
430 * Access: RO
431 */
432MLXSW_ITEM32_INDEXED(reg, sfn, rec_type, MLXSW_REG_SFN_BASE_LEN, 20, 4,
433 MLXSW_REG_SFN_REC_LEN, 0x00, false);
434
435/* reg_sfn_rec_mac
436 * MAC address.
437 * Access: RO
438 */
439MLXSW_ITEM_BUF_INDEXED(reg, sfn, rec_mac, MLXSW_REG_SFN_BASE_LEN, 6,
440 MLXSW_REG_SFN_REC_LEN, 0x02);
441
442/* reg_sfd_mac_sub_port
443 * VEPA channel on the local port.
444 * 0 if multichannel VEPA is not enabled.
445 * Access: RO
446 */
447MLXSW_ITEM32_INDEXED(reg, sfn, mac_sub_port, MLXSW_REG_SFN_BASE_LEN, 16, 8,
448 MLXSW_REG_SFN_REC_LEN, 0x08, false);
449
450/* reg_sfd_mac_fid
451 * Filtering identifier.
452 * Access: RO
453 */
454MLXSW_ITEM32_INDEXED(reg, sfn, mac_fid, MLXSW_REG_SFN_BASE_LEN, 0, 16,
455 MLXSW_REG_SFN_REC_LEN, 0x08, false);
456
457/* reg_sfd_mac_system_port
458 * Unique port identifier for the final destination of the packet.
459 * Access: RO
460 */
461MLXSW_ITEM32_INDEXED(reg, sfn, mac_system_port, MLXSW_REG_SFN_BASE_LEN, 0, 16,
462 MLXSW_REG_SFN_REC_LEN, 0x0C, false);
463
464static inline void mlxsw_reg_sfn_mac_unpack(char *payload, int rec_index,
465 char *mac, u16 *p_vid,
466 u8 *p_local_port)
467{
468 mlxsw_reg_sfn_rec_mac_memcpy_from(payload, rec_index, mac);
469 *p_vid = mlxsw_reg_sfn_mac_fid_get(payload, rec_index);
470 *p_local_port = mlxsw_reg_sfn_mac_system_port_get(payload, rec_index);
471}
472
374/* SPMS - Switch Port MSTP/RSTP State Register 473/* SPMS - Switch Port MSTP/RSTP State Register
375 * ------------------------------------------- 474 * -------------------------------------------
376 * Configures the spanning tree state of a physical port. 475 * Configures the spanning tree state of a physical port.
@@ -1467,6 +1566,8 @@ static inline const char *mlxsw_reg_id_str(u16 reg_id)
1467 return "SSPR"; 1566 return "SSPR";
1468 case MLXSW_REG_SFD_ID: 1567 case MLXSW_REG_SFD_ID:
1469 return "SFD"; 1568 return "SFD";
1569 case MLXSW_REG_SFN_ID:
1570 return "SFN";
1470 case MLXSW_REG_SPMS_ID: 1571 case MLXSW_REG_SPMS_ID:
1471 return "SPMS"; 1572 return "SPMS";
1472 case MLXSW_REG_SFGC_ID: 1573 case MLXSW_REG_SFGC_ID: