net/octeontx2: add flow MCAM utility functions
[dpdk.git] / drivers / net / octeontx2 / otx2_ethdev.h
index 03ecd32..e8a22b6 100644 (file)
 #include <rte_mbuf.h>
 #include <rte_mempool.h>
 #include <rte_string_fns.h>
+#include <rte_time.h>
 
 #include "otx2_common.h"
 #include "otx2_dev.h"
+#include "otx2_flow.h"
 #include "otx2_irq.h"
 #include "otx2_mempool.h"
 #include "otx2_rx.h"
 #define NIX_DEFAULT_RSS_CTX_GROUP  0
 #define NIX_DEFAULT_RSS_MCAM_IDX  -1
 
+#define otx2_ethdev_is_ptp_en(dev)     ((dev)->ptp_en)
+
+#define NIX_TIMESYNC_TX_CMD_LEN                8
+/* Additional timesync values. */
+#define OTX2_CYCLECOUNTER_MASK   0xffffffffffffffffULL
+
 enum nix_q_size_e {
        nix_q_size_16,  /* 16 entries */
        nix_q_size_64,  /* 64 entries */
@@ -166,12 +174,6 @@ struct otx2_eth_qconf {
        uint16_t nb_desc;
 };
 
-struct otx2_npc_flow_info {
-       uint16_t channel; /*rx channel */
-       uint16_t flow_prealloc_size;
-       uint16_t flow_max_priority;
-};
-
 struct otx2_fc_info {
        enum rte_eth_fc_mode mode;  /**< Link flow control mode */
        uint8_t rx_pause;
@@ -234,6 +236,12 @@ struct otx2_eth_dev {
        struct otx2_eth_qconf *tx_qconf;
        struct otx2_eth_qconf *rx_qconf;
        struct rte_eth_dev *eth_dev;
+       /* PTP counters */
+       bool ptp_en;
+       struct otx2_timesync_info tstamp;
+       struct rte_timecounter  systime_tc;
+       struct rte_timecounter  rx_tstamp_tc;
+       struct rte_timecounter  tx_tstamp_tc;
 } __rte_cache_aligned;
 
 struct otx2_eth_txq {
@@ -414,4 +422,19 @@ int otx2_ethdev_parse_devargs(struct rte_devargs *devargs,
 /* Rx and Tx routines */
 void otx2_nix_form_default_desc(struct otx2_eth_txq *txq);
 
+/* Timesync - PTP routines */
+int otx2_nix_timesync_enable(struct rte_eth_dev *eth_dev);
+int otx2_nix_timesync_disable(struct rte_eth_dev *eth_dev);
+int otx2_nix_timesync_read_rx_timestamp(struct rte_eth_dev *eth_dev,
+                                       struct timespec *timestamp,
+                                       uint32_t flags);
+int otx2_nix_timesync_read_tx_timestamp(struct rte_eth_dev *eth_dev,
+                                       struct timespec *timestamp);
+int otx2_nix_timesync_adjust_time(struct rte_eth_dev *eth_dev, int64_t delta);
+int otx2_nix_timesync_write_time(struct rte_eth_dev *eth_dev,
+                                const struct timespec *ts);
+int otx2_nix_timesync_read_time(struct rte_eth_dev *eth_dev,
+                               struct timespec *ts);
+int otx2_eth_dev_ptp_info_update(struct otx2_dev *dev, bool ptp_en);
+
 #endif /* __OTX2_ETHDEV_H__ */