net/bnxt: check resource reservation in TRUFLOW
[dpdk.git] / drivers / net / bnxt / bnxt.h
index bf3459e..e93a7eb 100644 (file)
@@ -306,9 +306,11 @@ struct rte_flow {
        struct bnxt_vnic_info   *vnic;
 };
 
+#define BNXT_PTP_RX_PND_CNT            10
 #define BNXT_PTP_FLAGS_PATH_TX         0x0
 #define BNXT_PTP_FLAGS_PATH_RX         0x1
 #define BNXT_PTP_FLAGS_CURRENT_TIME    0x2
+#define BNXT_PTP_CURRENT_TIME_MASK     0xFFFF00000000ULL
 
 struct bnxt_ptp_cfg {
 #define BNXT_GRCPF_REG_WINDOW_BASE_OUT  0x400
@@ -358,6 +360,7 @@ struct bnxt_ptp_cfg {
 
        /* On Thor, the Rx timestamp is present in the Rx completion record */
        uint64_t                        rx_timestamp;
+       uint64_t                        current_time;
 };
 
 struct bnxt_coal {
@@ -595,13 +598,6 @@ struct bnxt_rep_info {
                                     DEV_RX_OFFLOAD_SCATTER | \
                                     DEV_RX_OFFLOAD_RSS_HASH)
 
-#define  MAX_TABLE_SUPPORT 4
-#define  MAX_DIR_SUPPORT   2
-struct bnxt_dmabuf_info {
-       uint32_t entry_num;
-       int      fd[MAX_DIR_SUPPORT][MAX_TABLE_SUPPORT];
-};
-
 #define BNXT_HWRM_SHORT_REQ_LEN                sizeof(struct hwrm_short_input)
 
 struct bnxt_flow_stat_info {
@@ -613,6 +609,49 @@ struct bnxt_flow_stat_info {
        struct bnxt_ctx_mem_buf_info tx_fc_out_tbl;
 };
 
+struct bnxt_ring_stats {
+       /* Number of transmitted unicast packets */
+       uint64_t        tx_ucast_pkts;
+       /* Number of transmitted multicast packets */
+       uint64_t        tx_mcast_pkts;
+       /* Number of transmitted broadcast packets */
+       uint64_t        tx_bcast_pkts;
+       /* Number of packets discarded in transmit path */
+       uint64_t        tx_discard_pkts;
+       /* Number of packets in transmit path with error */
+       uint64_t        tx_error_pkts;
+       /* Number of transmitted bytes for unicast traffic */
+       uint64_t        tx_ucast_bytes;
+       /* Number of transmitted bytes for multicast traffic */
+       uint64_t        tx_mcast_bytes;
+       /* Number of transmitted bytes for broadcast traffic */
+       uint64_t        tx_bcast_bytes;
+       /* Number of received unicast packets */
+       uint64_t        rx_ucast_pkts;
+       /* Number of received multicast packets */
+       uint64_t        rx_mcast_pkts;
+       /* Number of received broadcast packets */
+       uint64_t        rx_bcast_pkts;
+       /* Number of packets discarded in receive path */
+       uint64_t        rx_discard_pkts;
+       /* Number of packets in receive path with errors */
+       uint64_t        rx_error_pkts;
+       /* Number of received bytes for unicast traffic */
+       uint64_t        rx_ucast_bytes;
+       /* Number of received bytes for multicast traffic */
+       uint64_t        rx_mcast_bytes;
+       /* Number of received bytes for broadcast traffic */
+       uint64_t        rx_bcast_bytes;
+       /* Number of aggregated unicast packets */
+       uint64_t        rx_agg_pkts;
+       /* Number of aggregated unicast bytes */
+       uint64_t        rx_agg_bytes;
+       /* Number of aggregation events */
+       uint64_t        rx_agg_events;
+       /* Number of aborted aggregations */
+       uint64_t        rx_agg_aborts;
+};
+
 struct bnxt {
        void                            *bar0;
 
@@ -671,6 +710,12 @@ struct bnxt {
 #define BNXT_TRUFLOW_EN(bp)    ((bp)->flags & BNXT_FLAG_TRUFLOW_EN)
 #define BNXT_GFID_ENABLED(bp)  ((bp)->flags & BNXT_FLAG_GFID_ENABLE)
 
+       uint32_t                        flags2;
+#define BNXT_FLAGS2_PTP_TIMESYNC_ENABLED       BIT(0)
+#define BNXT_FLAGS2_PTP_ALARM_SCHEDULED                BIT(1)
+#define BNXT_P5_PTP_TIMESYNC_ENABLED(bp)       \
+       ((bp)->flags2 & BNXT_FLAGS2_PTP_TIMESYNC_ENABLED)
+
        uint16_t                chip_num;
 #define CHIP_NUM_58818         0xd818
 #define BNXT_CHIP_SR2(bp)      ((bp)->chip_num == CHIP_NUM_58818)
@@ -718,7 +763,7 @@ struct bnxt {
        uint32_t                max_ring_grps;
        struct bnxt_ring_grp_info       *grp_info;
 
-       unsigned int            nr_vnics;
+       uint16_t                        nr_vnics;
 
 #define BNXT_GET_DEFAULT_VNIC(bp)      (&(bp)->vnic_info[0])
        struct bnxt_vnic_info   *vnic_info;
@@ -826,11 +871,12 @@ struct bnxt {
        uint16_t                port_svif;
 
        struct tf               tfp;
-       struct bnxt_dmabuf_info dmabuf;
        struct bnxt_ulp_context *ulp_ctx;
        struct bnxt_flow_stat_info *flow_stat;
        uint16_t                max_num_kflows;
        uint16_t                tx_cfa_action;
+       struct bnxt_ring_stats  *prev_rx_ring_stats;
+       struct bnxt_ring_stats  *prev_tx_ring_stats;
 };
 
 static
@@ -853,6 +899,13 @@ inline uint16_t bnxt_max_rings(struct bnxt *bp)
                                       bp->max_stat_ctx / 2U);
        }
 
+       /*
+        * RSS table size in Thor is 512.
+        * Cap max Rx rings to the same value for RSS.
+        */
+       if (BNXT_CHIP_P5(bp))
+               max_rx_rings = RTE_MIN(max_rx_rings, BNXT_RSS_TBL_SIZE_P5);
+
        max_tx_rings = RTE_MIN(max_tx_rings, max_rx_rings);
        if (max_cp_rings > BNXT_NUM_ASYNC_CPR(bp))
                max_cp_rings -= BNXT_NUM_ASYNC_CPR(bp);
@@ -989,9 +1042,7 @@ void bnxt_flow_cnt_alarm_cb(void *arg);
 int bnxt_flow_stats_req(struct bnxt *bp);
 int bnxt_flow_stats_cnt(struct bnxt *bp);
 uint32_t bnxt_get_speed_capabilities(struct bnxt *bp);
+int bnxt_flow_ops_get_op(struct rte_eth_dev *dev,
+                        const struct rte_flow_ops **ops);
 
-int
-bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
-                   enum rte_filter_type filter_type,
-                   enum rte_filter_op filter_op, void *arg);
 #endif