net/nfp: rename set MAC function
[dpdk.git] / drivers / net / octeontx_ep / otx_ep_common.h
index 25d1883..8a59a1a 100644 (file)
@@ -4,6 +4,10 @@
 #ifndef _OTX_EP_COMMON_H_
 #define _OTX_EP_COMMON_H_
 
+
+#define OTX_EP_NW_PKT_OP               0x1220
+#define OTX_EP_NW_CMD_OP               0x1221
+
 #define OTX_EP_MAX_RINGS_PER_VF        (8)
 #define OTX_EP_CFG_IO_QUEUES        OTX_EP_MAX_RINGS_PER_VF
 #define OTX_EP_64BYTE_INSTR         (64)
 
 #define OTX_EP_OQ_INFOPTR_MODE      (0)
 #define OTX_EP_OQ_REFIL_THRESHOLD   (16)
+
+/* IQ instruction req types */
+#define OTX_EP_REQTYPE_NONE             (0)
+#define OTX_EP_REQTYPE_NORESP_INSTR     (1)
+#define OTX_EP_REQTYPE_NORESP_NET_DIRECT       (2)
+#define OTX_EP_REQTYPE_NORESP_NET       OTX_EP_REQTYPE_NORESP_NET_DIRECT
+#define OTX_EP_REQTYPE_NORESP_GATHER    (3)
+#define OTX_EP_NORESP_OHSM_SEND     (4)
+#define OTX_EP_NORESP_LAST          (4)
 #define OTX_EP_PCI_RING_ALIGN   65536
 #define SDP_PKIND 40
 #define SDP_OTX2_PKIND 57
+
+#define      ORDERED_TAG 0
+#define      ATOMIC_TAG  1
+#define      NULL_TAG  2
+#define      NULL_NULL_TAG  3
+
+#define OTX_EP_BUSY_LOOP_COUNT      (10000)
 #define OTX_EP_MAX_IOQS_PER_VF 8
+#define OTX_CUST_DATA_LEN 0
 
 #define otx_ep_info(fmt, args...)                              \
        rte_log(RTE_LOG_INFO, otx_net_ep_logtype,               \
@@ -129,7 +150,7 @@ struct otx_ep_iq_config {
 
 /** The instruction (input) queue.
  *  The input queue is used to post raw (instruction) mode data or packet data
- *  to OCTEON TX2 device from the host. Each IQ of a OTX_EP EP VF device has one
+ *  to OCTEON 9 device from the host. Each IQ of a OTX_EP EP VF device has one
  *  such structure to represent it.
  */
 struct otx_ep_instr_queue {
@@ -149,12 +170,12 @@ struct otx_ep_instr_queue {
        /* Input ring index, where the driver should write the next packet */
        uint32_t host_write_index;
 
-       /* Input ring index, where the OCTEON TX2 should read the next packet */
+       /* Input ring index, where the OCTEON 9 should read the next packet */
        uint32_t otx_read_index;
 
        uint32_t reset_instr_cnt;
 
-       /** This index aids in finding the window in the queue where OCTEON TX2
+       /** This index aids in finding the window in the queue where OCTEON 9
         *  has read the commands.
         */
        uint32_t flush_index;
@@ -174,7 +195,7 @@ struct otx_ep_instr_queue {
        /* OTX_EP instruction count register for this ring. */
        void *inst_cnt_reg;
 
-       /* Number of instructions pending to be posted to OCTEON TX2. */
+       /* Number of instructions pending to be posted to OCTEON 9. */
        uint32_t fill_cnt;
 
        /* Statistics for this input queue. */
@@ -209,8 +230,8 @@ union otx_ep_rh {
 };
 #define OTX_EP_RH_SIZE (sizeof(union otx_ep_rh))
 
-/** Information about packet DMA'ed by OCTEON TX2.
- *  The format of the information available at Info Pointer after OCTEON TX2
+/** Information about packet DMA'ed by OCTEON 9.
+ *  The format of the information available at Info Pointer after OCTEON 9
  *  has posted a packet. Not all descriptors have valid information. Only
  *  the Info field of the first descriptor for a packet has information
  *  about the packet.
@@ -274,7 +295,7 @@ struct otx_ep_droq {
        /* Driver should read the next packet at this index */
        uint32_t read_idx;
 
-       /* OCTEON TX2 will write the next packet at this index */
+       /* OCTEON 9 will write the next packet at this index */
        uint32_t write_idx;
 
        /* At this index, the driver will refill the descriptor's buffer */
@@ -305,7 +326,7 @@ struct otx_ep_droq {
         */
        void *pkts_credit_reg;
 
-       /** Pointer to the mapped packet sent register. OCTEON TX2 writes the
+       /** Pointer to the mapped packet sent register. OCTEON 9 writes the
         *  number of packets DMA'ed to host memory in this register.
         */
        void *pkts_sent_reg;
@@ -374,7 +395,14 @@ struct otx_ep_fn_list {
 
        void (*setup_device_regs)(struct otx_ep_device *otx_ep);
 
+       int (*enable_io_queues)(struct otx_ep_device *otx_ep);
        void (*disable_io_queues)(struct otx_ep_device *otx_ep);
+
+       int (*enable_iq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+       void (*disable_iq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+
+       int (*enable_oq)(struct otx_ep_device *otx_ep, uint32_t q_no);
+       void (*disable_oq)(struct otx_ep_device *otx_ep, uint32_t q_no);
 };
 
 /* OTX_EP EP VF device data structure */
@@ -434,8 +462,40 @@ int otx_ep_setup_oqs(struct otx_ep_device *otx_ep, int oq_no, int num_descs,
                     unsigned int socket_id);
 int otx_ep_delete_oqs(struct otx_ep_device *otx_ep, uint32_t oq_no);
 
+struct otx_ep_sg_entry {
+       /** The first 64 bit gives the size of data in each dptr. */
+       union {
+               uint16_t size[4];
+               uint64_t size64;
+       } u;
+
+       /** The 4 dptr pointers for this entry. */
+       uint64_t ptr[4];
+};
+
+#define OTX_EP_SG_ENTRY_SIZE   (sizeof(struct otx_ep_sg_entry))
+
+/** Structure of a node in list of gather components maintained by
+ *  driver for each network device.
+ */
+struct otx_ep_gather {
+       /** number of gather entries. */
+       int num_sg;
+
+       /** Gather component that can accommodate max sized fragment list
+        *  received from the IP layer.
+        */
+       struct otx_ep_sg_entry *sg;
+};
+
+struct otx_ep_buf_free_info {
+       struct rte_mbuf *mbuf;
+       struct otx_ep_gather g;
+};
+
 #define OTX_EP_MAX_PKT_SZ 64000U
 #define OTX_EP_MAX_MAC_ADDRS 1
+#define OTX_EP_SG_ALIGN 8
 #define OTX_EP_CLEAR_ISIZE_BSIZE 0x7FFFFFULL
 #define OTX_EP_CLEAR_OUT_INT_LVLS 0x3FFFFFFFFFFFFFULL
 #define OTX_EP_CLEAR_IN_INT_LVLS 0xFFFFFFFF
@@ -444,5 +504,8 @@ int otx_ep_delete_oqs(struct otx_ep_device *otx_ep, uint32_t oq_no);
 #define OTX_EP_CLEAR_SLIST_DBELL 0xFFFFFFFF
 #define OTX_EP_CLEAR_SDP_OUT_PKT_CNT 0xFFFFFFFFF
 
+/* PCI IDs */
+#define PCI_VENDOR_ID_CAVIUM                   0x177D
+
 extern int otx_net_ep_logtype;
 #endif  /* _OTX_EP_COMMON_H_ */