+#define HINIC_MAX_Q_FILTERS 64 /* hinic just support 64 filter types */
+#define HINIC_PKT_TYPE_FIND_ID(pkt_type) ((pkt_type) - HINIC_MAX_Q_FILTERS)
+
+/* 5tuple filter info */
+struct hinic_5tuple_filter_info {
+ uint32_t dst_ip;
+ uint32_t src_ip;
+ uint16_t dst_port;
+ uint16_t src_port;
+ uint8_t proto; /* l4 protocol. */
+ /*
+ * seven levels (001b-111b), 111b is highest,
+ * used when more than one filter matches.
+ */
+ uint8_t priority;
+ uint8_t dst_ip_mask:1, /* if mask is 1b, do not compare dst ip. */
+ src_ip_mask:1, /* if mask is 1b, do not compare src ip. */
+ dst_port_mask:1, /* if mask is 1b, do not compare dst port. */
+ src_port_mask:1, /* if mask is 1b, do not compare src port. */
+ proto_mask:1; /* if mask is 1b, do not compare protocol. */
+};
+
+/* 5tuple filter structure */
+struct hinic_5tuple_filter {
+ TAILQ_ENTRY(hinic_5tuple_filter) entries;
+ uint16_t index; /* the index of 5tuple filter */
+ struct hinic_5tuple_filter_info filter_info;
+ uint16_t queue; /* rx queue assigned to */
+};
+
+TAILQ_HEAD(hinic_5tuple_filter_list, hinic_5tuple_filter);
+
+/*
+ * If this filter is added by configuration,
+ * it should not be removed.
+ */
+struct hinic_pkt_filter {
+ uint16_t pkt_proto;
+ uint8_t qid;
+ bool enable;
+};
+
+/* Structure to store filters' info. */
+struct hinic_filter_info {
+ uint8_t pkt_type;
+ uint8_t qid;
+ uint64_t type_mask; /* Bit mask for every used filter */
+ struct hinic_5tuple_filter_list fivetuple_list;
+ struct hinic_pkt_filter pkt_filters[HINIC_MAX_Q_FILTERS];
+};
+