net/cxgbe: support to offload flows to HASH region
[dpdk.git] / drivers / net / cxgbe / cxgbe_ofld.h
index e97c424..798e398 100644 (file)
 
 #include "cxgbe_filter.h"
 
+#define INIT_TP_WR(w, tid) do { \
+       (w)->wr.wr_hi = cpu_to_be32(V_FW_WR_OP(FW_TP_WR) | \
+                               V_FW_WR_IMMDLEN(sizeof(*w) - sizeof(w->wr))); \
+       (w)->wr.wr_mid = cpu_to_be32( \
+                               V_FW_WR_LEN16(DIV_ROUND_UP(sizeof(*w), 16)) | \
+                               V_FW_WR_FLOWID(tid)); \
+       (w)->wr.wr_lo = cpu_to_be64(0); \
+} while (0)
+
 /*
  * Max # of ATIDs.  The absolute HW max is 16K but we keep it lower.
  */
@@ -46,4 +55,20 @@ struct tid_info {
        rte_spinlock_t atid_lock __rte_cache_aligned;
        rte_spinlock_t ftid_lock;
 };
+
+static inline void *lookup_tid(const struct tid_info *t, unsigned int tid)
+{
+       return tid < t->ntids ? t->tid_tab[tid] : NULL;
+}
+
+static inline void *lookup_atid(const struct tid_info *t, unsigned int atid)
+{
+       return atid < t->natids ? t->atid_tab[atid].data : NULL;
+}
+
+int cxgbe_alloc_atid(struct tid_info *t, void *data);
+void cxgbe_free_atid(struct tid_info *t, unsigned int atid);
+void cxgbe_insert_tid(struct tid_info *t, void *data, unsigned int tid,
+                     unsigned short family);
+
 #endif /* _CXGBE_OFLD_H_ */