Commit b2492d50 authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'dpaa2-switch-add-mirroring-support'



Ioana Ciornei says:

====================
dpaa2-switch: add mirroring support

This patch set adds per port and per VLAN mirroring in dpaa2-switch.

The first 4 patches are just cosmetic changes. We renamed the
dpaa2_switch_acl_tbl structure into dpaa2_switch_filter_block so that we
can reuse it for filters that do not use the ACL table and reorganized
the addition of trap, redirect and drop filters into a separate
function. All this just to make for a more streamlined addition of the
support for mirroring.

The next 4 patches are actually adding the advertised support. Mirroring
rules can be added in shared blocks, the driver will replicate the same
configuration on all the switch ports part of the same block.

The last patch documents the feature, presents its behavior and
limitations and gives a couple of examples.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 88ea96f8 d1626a1c
Loading
Loading
Loading
Loading
+43 −0
Original line number Diff line number Diff line
@@ -172,3 +172,46 @@ Example 4: Use a single shared filter block on both eth5 and eth6::
                action trap
        $ tc filter add block 1 ingress protocol ipv4 flower src_ip 192.168.1.1 skip_sw \
                action mirred egress redirect dev eth3

Mirroring
~~~~~~~~~

The DPAA2 switch supports only per port mirroring and per VLAN mirroring.
Adding mirroring filters in shared blocks is also supported.

When using the tc-flower classifier with the 802.1q protocol, only the
''vlan_id'' key will be accepted. Mirroring based on any other fields from the
802.1q protocol will be rejected::

        $ tc qdisc add dev eth8 ingress_block 1 clsact
        $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_prio 3 action mirred egress mirror dev eth6
        Error: fsl_dpaa2_switch: Only matching on VLAN ID supported.
        We have an error talking to the kernel

If a mirroring VLAN filter is requested on a port, the VLAN must to be
installed on the switch port in question either using ''bridge'' or by creating
a VLAN upper device if the switch port is used as a standalone interface::

        $ tc qdisc add dev eth8 ingress_block 1 clsact
        $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 200 action mirred egress mirror dev eth6
        Error: VLAN must be installed on the switch port.
        We have an error talking to the kernel

        $ bridge vlan add vid 200 dev eth8
        $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 200 action mirred egress mirror dev eth6

        $ ip link add link eth8 name eth8.200 type vlan id 200
        $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 200 action mirred egress mirror dev eth6

Also, it should be noted that the mirrored traffic will be subject to the same
egress restrictions as any other traffic. This means that when a mirrored
packet will reach the mirror port, if the VLAN found in the packet is not
installed on the port it will get dropped.

The DPAA2 switch supports only a single mirroring destination, thus multiple
mirror rules can be installed but their ''to'' port has to be the same::

        $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 200 action mirred egress mirror dev eth6
        $ tc filter add block 1 ingress protocol 802.1q flower skip_sw vlan_id 100 action mirred egress mirror dev eth7
        Error: fsl_dpaa2_switch: Multiple mirror ports not supported.
        We have an error talking to the kernel
+458 −72

File changed.

Preview size limit exceeded, changes collapsed.

+86 −63

File changed.

Preview size limit exceeded, changes collapsed.

+30 −14

File changed.

Preview size limit exceeded, changes collapsed.

+19 −0
Original line number Diff line number Diff line
@@ -39,11 +39,16 @@
#define DPSW_CMDID_GET_IRQ_STATUS           DPSW_CMD_ID(0x016)
#define DPSW_CMDID_CLEAR_IRQ_STATUS         DPSW_CMD_ID(0x017)

#define DPSW_CMDID_SET_REFLECTION_IF        DPSW_CMD_ID(0x022)

#define DPSW_CMDID_IF_SET_TCI               DPSW_CMD_ID(0x030)
#define DPSW_CMDID_IF_SET_STP               DPSW_CMD_ID(0x031)

#define DPSW_CMDID_IF_GET_COUNTER           DPSW_CMD_V2(0x034)

#define DPSW_CMDID_IF_ADD_REFLECTION        DPSW_CMD_ID(0x037)
#define DPSW_CMDID_IF_REMOVE_REFLECTION     DPSW_CMD_ID(0x038)

#define DPSW_CMDID_IF_ENABLE                DPSW_CMD_ID(0x03D)
#define DPSW_CMDID_IF_DISABLE               DPSW_CMD_ID(0x03E)

@@ -533,5 +538,19 @@ struct dpsw_cmd_acl_entry {
	__le64 pad2[4];
	__le64 key_iova;
};

struct dpsw_cmd_set_reflection_if {
	__le16 if_id;
};

#define DPSW_FILTER_SHIFT	0
#define DPSW_FILTER_SIZE	2

struct dpsw_cmd_if_reflection {
	__le16 if_id;
	__le16 vlan_id;
	/* only 2 bits from the LSB */
	u8 filter;
};
#pragma pack(pop)
#endif /* __FSL_DPSW_CMD_H */
Loading