net/dpaa2: add support for MAC address filtering
[dpdk.git] / drivers / net / dpaa2 / mc / fsl_dpni_cmd.h
index 383649e..1ae734a 100644 (file)
@@ -69,6 +69,9 @@
 #define DPNI_CMDID_GET_UNICAST_PROMISC                 ((0x223 << 4) | (0x1))
 #define DPNI_CMDID_SET_PRIM_MAC                        ((0x224 << 4) | (0x1))
 #define DPNI_CMDID_GET_PRIM_MAC                        ((0x225 << 4) | (0x1))
+#define DPNI_CMDID_ADD_MAC_ADDR                        ((0x226 << 4) | (0x1))
+#define DPNI_CMDID_REMOVE_MAC_ADDR                     ((0x227 << 4) | (0x1))
+#define DPNI_CMDID_CLR_MAC_FILTERS                     ((0x228 << 4) | (0x1))
 
 #define DPNI_CMDID_SET_RX_TC_DIST                      ((0x235 << 4) | (0x1))
 
@@ -76,6 +79,8 @@
 #define DPNI_CMDID_RESET_STATISTICS                    ((0x25E << 4) | (0x1))
 #define DPNI_CMDID_GET_QUEUE                           ((0x25F << 4) | (0x1))
 #define DPNI_CMDID_SET_QUEUE                           ((0x260 << 4) | (0x1))
+#define DPNI_CMDID_GET_TAILDROP                        ((0x261 << 4) | (0x1))
+#define DPNI_CMDID_SET_TAILDROP                        ((0x262 << 4) | (0x1))
 
 #define DPNI_CMDID_GET_PORT_MAC_ADDR                   ((0x263 << 4) | (0x1))
 
@@ -271,6 +276,45 @@ do { \
        MC_RSP_OP(cmd, 0, 56, 8,  uint8_t,  mac_addr[0]); \
 } while (0)
 
+#define DPNI_RSP_GET_PORT_MAC_ADDR(cmd, mac_addr) \
+do { \
+       MC_RSP_OP(cmd, 0, 16, 8,  uint8_t,  mac_addr[5]); \
+       MC_RSP_OP(cmd, 0, 24, 8,  uint8_t,  mac_addr[4]); \
+       MC_RSP_OP(cmd, 0, 32, 8,  uint8_t,  mac_addr[3]); \
+       MC_RSP_OP(cmd, 0, 40, 8,  uint8_t,  mac_addr[2]); \
+       MC_RSP_OP(cmd, 0, 48, 8,  uint8_t,  mac_addr[1]); \
+       MC_RSP_OP(cmd, 0, 56, 8,  uint8_t,  mac_addr[0]); \
+} while (0)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPNI_CMD_ADD_MAC_ADDR(cmd, mac_addr) \
+do { \
+       MC_CMD_OP(cmd, 0, 16, 8,  uint8_t,  mac_addr[5]); \
+       MC_CMD_OP(cmd, 0, 24, 8,  uint8_t,  mac_addr[4]); \
+       MC_CMD_OP(cmd, 0, 32, 8,  uint8_t,  mac_addr[3]); \
+       MC_CMD_OP(cmd, 0, 40, 8,  uint8_t,  mac_addr[2]); \
+       MC_CMD_OP(cmd, 0, 48, 8,  uint8_t,  mac_addr[1]); \
+       MC_CMD_OP(cmd, 0, 56, 8,  uint8_t,  mac_addr[0]); \
+} while (0)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPNI_CMD_REMOVE_MAC_ADDR(cmd, mac_addr) \
+do { \
+       MC_CMD_OP(cmd, 0, 16, 8,  uint8_t,  mac_addr[5]); \
+       MC_CMD_OP(cmd, 0, 24, 8,  uint8_t,  mac_addr[4]); \
+       MC_CMD_OP(cmd, 0, 32, 8,  uint8_t,  mac_addr[3]); \
+       MC_CMD_OP(cmd, 0, 40, 8,  uint8_t,  mac_addr[2]); \
+       MC_CMD_OP(cmd, 0, 48, 8,  uint8_t,  mac_addr[1]); \
+       MC_CMD_OP(cmd, 0, 56, 8,  uint8_t,  mac_addr[0]); \
+} while (0)
+
+/*                cmd, param, offset, width, type, arg_name */
+#define DPNI_CMD_CLEAR_MAC_FILTERS(cmd, unicast, multicast) \
+do { \
+       MC_CMD_OP(cmd, 0, 0,  1,  int,      unicast); \
+       MC_CMD_OP(cmd, 0, 1,  1,  int,      multicast); \
+} while (0)
+
 
 /*                cmd, param, offset, width, type, arg_name */
 #define DPNI_CMD_SET_RX_TC_DIST(cmd, tc_id, cfg) \
@@ -326,6 +370,33 @@ do { \
        MC_RSP_OP(cmd, 0, 16, 16, uint16_t, minor);\
 } while (0)
 
+#define DPNI_CMD_GET_TAILDROP(cmd, cp, q_type, tc, q_index) \
+do { \
+       MC_CMD_OP(cmd, 0,  0,  8, enum dpni_congestion_point, cp); \
+       MC_CMD_OP(cmd, 0,  8,  8, enum dpni_queue_type, q_type); \
+       MC_CMD_OP(cmd, 0, 16,  8, uint8_t, tc); \
+       MC_CMD_OP(cmd, 0, 24,  8, uint8_t, q_index); \
+} while (0)
+
+#define DPNI_RSP_GET_TAILDROP(cmd, taildrop) \
+do { \
+       MC_RSP_OP(cmd, 1,  0,  1, char, (taildrop)->enable); \
+       MC_RSP_OP(cmd, 1, 16,  8, enum dpni_congestion_unit, \
+                               (taildrop)->units); \
+       MC_RSP_OP(cmd, 1, 32, 32, uint32_t, (taildrop)->threshold); \
+} while (0)
+
+#define DPNI_CMD_SET_TAILDROP(cmd, cp, q_type, tc, q_index, taildrop) \
+do { \
+       MC_CMD_OP(cmd, 0,  0,  8, enum dpni_congestion_point, cp); \
+       MC_CMD_OP(cmd, 0,  8,  8, enum dpni_queue_type, q_type); \
+       MC_CMD_OP(cmd, 0, 16,  8, uint8_t, tc); \
+       MC_CMD_OP(cmd, 0, 24,  8, uint8_t, q_index); \
+       MC_CMD_OP(cmd, 1,  0,  1, char, (taildrop)->enable); \
+       MC_CMD_OP(cmd, 1, 16,  8, enum dpni_congestion_unit, \
+                               (taildrop)->units); \
+       MC_CMD_OP(cmd, 1, 32, 32, uint32_t, (taildrop)->threshold); \
+} while (0)
 
 #define DPNI_CMD_SET_TX_CONFIRMATION_MODE(cmd, mode) \
        MC_CMD_OP(cmd, 0, 32, 8, enum dpni_confirmation_mode, mode)