|
5 | 5 | * Copyright (c) 2015 Elad Raz <[email protected]>
|
6 | 6 | * Copyright (c) 2015-2017 Jiri Pirko <[email protected]>
|
7 | 7 | * Copyright (c) 2016 Yotam Gigi <[email protected]>
|
| 8 | + * Copyright (c) 2017 Petr Machata <[email protected]> |
8 | 9 | *
|
9 | 10 | * Redistribution and use in source and binary forms, with or without
|
10 | 11 | * modification, are permitted provided that the following conditions are met:
|
@@ -5463,6 +5464,133 @@ static inline void mlxsw_reg_rauhtd_ent_ipv6_unpack(char *payload,
|
5463 | 5464 | mlxsw_reg_rauhtd_ipv6_ent_dip_memcpy_from(payload, rec_index, p_dip);
|
5464 | 5465 | }
|
5465 | 5466 |
|
| 5467 | +/* RTDP - Routing Tunnel Decap Properties Register |
| 5468 | + * ----------------------------------------------- |
| 5469 | + * The RTDP register is used for configuring the tunnel decap properties of NVE |
| 5470 | + * and IPinIP. |
| 5471 | + */ |
| 5472 | +#define MLXSW_REG_RTDP_ID 0x8020 |
| 5473 | +#define MLXSW_REG_RTDP_LEN 0x44 |
| 5474 | + |
| 5475 | +MLXSW_REG_DEFINE(rtdp, MLXSW_REG_RTDP_ID, MLXSW_REG_RTDP_LEN); |
| 5476 | + |
| 5477 | +enum mlxsw_reg_rtdp_type { |
| 5478 | + MLXSW_REG_RTDP_TYPE_NVE, |
| 5479 | + MLXSW_REG_RTDP_TYPE_IPIP, |
| 5480 | +}; |
| 5481 | + |
| 5482 | +/* reg_rtdp_type |
| 5483 | + * Type of the RTDP entry as per enum mlxsw_reg_rtdp_type. |
| 5484 | + * Access: RW |
| 5485 | + */ |
| 5486 | +MLXSW_ITEM32(reg, rtdp, type, 0x00, 28, 4); |
| 5487 | + |
| 5488 | +/* reg_rtdp_tunnel_index |
| 5489 | + * Index to the Decap entry. |
| 5490 | + * For Spectrum, Index to KVD Linear. |
| 5491 | + * Access: Index |
| 5492 | + */ |
| 5493 | +MLXSW_ITEM32(reg, rtdp, tunnel_index, 0x00, 0, 24); |
| 5494 | + |
| 5495 | +/* IPinIP */ |
| 5496 | + |
| 5497 | +/* reg_rtdp_ipip_irif |
| 5498 | + * Ingress Router Interface for the overlay router |
| 5499 | + * Access: RW |
| 5500 | + */ |
| 5501 | +MLXSW_ITEM32(reg, rtdp, ipip_irif, 0x04, 16, 16); |
| 5502 | + |
| 5503 | +enum mlxsw_reg_rtdp_ipip_sip_check { |
| 5504 | + /* No sip checks. */ |
| 5505 | + MLXSW_REG_RTDP_IPIP_SIP_CHECK_NO, |
| 5506 | + /* Filter packet if underlay is not IPv4 or if underlay SIP does not |
| 5507 | + * equal ipv4_usip. |
| 5508 | + */ |
| 5509 | + MLXSW_REG_RTDP_IPIP_SIP_CHECK_FILTER_IPV4, |
| 5510 | + /* Filter packet if underlay is not IPv6 or if underlay SIP does not |
| 5511 | + * equal ipv6_usip. |
| 5512 | + */ |
| 5513 | + MLXSW_REG_RTDP_IPIP_SIP_CHECK_FILTER_IPV6 = 3, |
| 5514 | +}; |
| 5515 | + |
| 5516 | +/* reg_rtdp_ipip_sip_check |
| 5517 | + * SIP check to perform. If decapsulation failed due to these configurations |
| 5518 | + * then trap_id is IPIP_DECAP_ERROR. |
| 5519 | + * Access: RW |
| 5520 | + */ |
| 5521 | +MLXSW_ITEM32(reg, rtdp, ipip_sip_check, 0x04, 0, 3); |
| 5522 | + |
| 5523 | +/* If set, allow decapsulation of IPinIP (without GRE). */ |
| 5524 | +#define MLXSW_REG_RTDP_IPIP_TYPE_CHECK_ALLOW_IPIP BIT(0) |
| 5525 | +/* If set, allow decapsulation of IPinGREinIP without a key. */ |
| 5526 | +#define MLXSW_REG_RTDP_IPIP_TYPE_CHECK_ALLOW_GRE BIT(1) |
| 5527 | +/* If set, allow decapsulation of IPinGREinIP with a key. */ |
| 5528 | +#define MLXSW_REG_RTDP_IPIP_TYPE_CHECK_ALLOW_GRE_KEY BIT(2) |
| 5529 | + |
| 5530 | +/* reg_rtdp_ipip_type_check |
| 5531 | + * Flags as per MLXSW_REG_RTDP_IPIP_TYPE_CHECK_*. If decapsulation failed due to |
| 5532 | + * these configurations then trap_id is IPIP_DECAP_ERROR. |
| 5533 | + * Access: RW |
| 5534 | + */ |
| 5535 | +MLXSW_ITEM32(reg, rtdp, ipip_type_check, 0x08, 24, 3); |
| 5536 | + |
| 5537 | +/* reg_rtdp_ipip_gre_key_check |
| 5538 | + * Whether GRE key should be checked. When check is enabled: |
| 5539 | + * - A packet received as IPinIP (without GRE) will always pass. |
| 5540 | + * - A packet received as IPinGREinIP without a key will not pass the check. |
| 5541 | + * - A packet received as IPinGREinIP with a key will pass the check only if the |
| 5542 | + * key in the packet is equal to expected_gre_key. |
| 5543 | + * If decapsulation failed due to GRE key then trap_id is IPIP_DECAP_ERROR. |
| 5544 | + * Access: RW |
| 5545 | + */ |
| 5546 | +MLXSW_ITEM32(reg, rtdp, ipip_gre_key_check, 0x08, 23, 1); |
| 5547 | + |
| 5548 | +/* reg_rtdp_ipip_ipv4_usip |
| 5549 | + * Underlay IPv4 address for ipv4 source address check. |
| 5550 | + * Reserved when sip_check is not '1'. |
| 5551 | + * Access: RW |
| 5552 | + */ |
| 5553 | +MLXSW_ITEM32(reg, rtdp, ipip_ipv4_usip, 0x0C, 0, 32); |
| 5554 | + |
| 5555 | +/* reg_rtdp_ipip_ipv6_usip_ptr |
| 5556 | + * This field is valid when sip_check is "sipv6 check explicitly". This is a |
| 5557 | + * pointer to the IPv6 DIP which is configured by RIPS. For Spectrum, the index |
| 5558 | + * is to the KVD linear. |
| 5559 | + * Reserved when sip_check is not MLXSW_REG_RTDP_IPIP_SIP_CHECK_FILTER_IPV6. |
| 5560 | + * Access: RW |
| 5561 | + */ |
| 5562 | +MLXSW_ITEM32(reg, rtdp, ipip_ipv6_usip_ptr, 0x10, 0, 24); |
| 5563 | + |
| 5564 | +/* reg_rtdp_ipip_expected_gre_key |
| 5565 | + * GRE key for checking. |
| 5566 | + * Reserved when gre_key_check is '0'. |
| 5567 | + * Access: RW |
| 5568 | + */ |
| 5569 | +MLXSW_ITEM32(reg, rtdp, ipip_expected_gre_key, 0x14, 0, 32); |
| 5570 | + |
| 5571 | +static inline void mlxsw_reg_rtdp_pack(char *payload, |
| 5572 | + enum mlxsw_reg_rtdp_type type, |
| 5573 | + u32 tunnel_index) |
| 5574 | +{ |
| 5575 | + MLXSW_REG_ZERO(rtdp, payload); |
| 5576 | + mlxsw_reg_rtdp_type_set(payload, type); |
| 5577 | + mlxsw_reg_rtdp_tunnel_index_set(payload, tunnel_index); |
| 5578 | +} |
| 5579 | + |
| 5580 | +static inline void |
| 5581 | +mlxsw_reg_rtdp_ipip4_pack(char *payload, u16 irif, |
| 5582 | + enum mlxsw_reg_rtdp_ipip_sip_check sip_check, |
| 5583 | + unsigned int type_check, bool gre_key_check, |
| 5584 | + u32 ipv4_usip, u32 expected_gre_key) |
| 5585 | +{ |
| 5586 | + mlxsw_reg_rtdp_ipip_irif_set(payload, irif); |
| 5587 | + mlxsw_reg_rtdp_ipip_sip_check_set(payload, sip_check); |
| 5588 | + mlxsw_reg_rtdp_ipip_type_check_set(payload, type_check); |
| 5589 | + mlxsw_reg_rtdp_ipip_gre_key_check_set(payload, gre_key_check); |
| 5590 | + mlxsw_reg_rtdp_ipip_ipv4_usip_set(payload, ipv4_usip); |
| 5591 | + mlxsw_reg_rtdp_ipip_expected_gre_key_set(payload, expected_gre_key); |
| 5592 | +} |
| 5593 | + |
5466 | 5594 | /* MFCR - Management Fan Control Register
|
5467 | 5595 | * --------------------------------------
|
5468 | 5596 | * This register controls the settings of the Fan Speed PWM mechanism.
|
@@ -6724,6 +6852,7 @@ static const struct mlxsw_reg_info *mlxsw_reg_infos[] = {
|
6724 | 6852 | MLXSW_REG(rgcr),
|
6725 | 6853 | MLXSW_REG(ritr),
|
6726 | 6854 | MLXSW_REG(ratr),
|
| 6855 | + MLXSW_REG(rtdp), |
6727 | 6856 | MLXSW_REG(ricnt),
|
6728 | 6857 | MLXSW_REG(ralta),
|
6729 | 6858 | MLXSW_REG(ralst),
|
|
0 commit comments