Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 or BSD-3-Clause */
0002 /*
0003  * Copyright(c) 2016 Intel Corporation.
0004  */
0005 
0006 #ifndef HFI1_SDMA_TXREQ_H
0007 #define HFI1_SDMA_TXREQ_H
0008 
0009 /* increased for AHG */
0010 #define NUM_DESC 6
0011 
0012 /*
0013  * struct sdma_desc - canonical fragment descriptor
0014  *
0015  * This is the descriptor carried in the tx request
0016  * corresponding to each fragment.
0017  *
0018  */
0019 struct sdma_desc {
0020     /* private:  don't use directly */
0021     u64 qw[2];
0022 };
0023 
0024 /**
0025  * struct sdma_txreq - the sdma_txreq structure (one per packet)
0026  * @list: for use by user and by queuing for wait
0027  *
0028  * This is the representation of a packet which consists of some
0029  * number of fragments.   Storage is provided to within the structure.
0030  * for all fragments.
0031  *
0032  * The storage for the descriptors are automatically extended as needed
0033  * when the currently allocation is exceeded.
0034  *
0035  * The user (Verbs or PSM) may overload this structure with fields
0036  * specific to their use by putting this struct first in their struct.
0037  * The method of allocation of the overloaded structure is user dependent
0038  *
0039  * The list is the only public field in the structure.
0040  *
0041  */
0042 
0043 #define SDMA_TXREQ_S_OK        0
0044 #define SDMA_TXREQ_S_SENDERROR 1
0045 #define SDMA_TXREQ_S_ABORTED   2
0046 #define SDMA_TXREQ_S_SHUTDOWN  3
0047 
0048 /* flags bits */
0049 #define SDMA_TXREQ_F_URGENT       0x0001
0050 #define SDMA_TXREQ_F_AHG_COPY     0x0002
0051 #define SDMA_TXREQ_F_USE_AHG      0x0004
0052 #define SDMA_TXREQ_F_VIP          0x0010
0053 
0054 struct sdma_txreq;
0055 typedef void (*callback_t)(struct sdma_txreq *, int);
0056 
0057 struct iowait;
0058 struct sdma_txreq {
0059     struct list_head list;
0060     /* private: */
0061     struct sdma_desc *descp;
0062     /* private: */
0063     void *coalesce_buf;
0064     /* private: */
0065     struct iowait *wait;
0066     /* private: */
0067     callback_t                  complete;
0068 #ifdef CONFIG_HFI1_DEBUG_SDMA_ORDER
0069     u64 sn;
0070 #endif
0071     /* private: - used in coalesce/pad processing */
0072     u16                         packet_len;
0073     /* private: - down-counted to trigger last */
0074     u16                         tlen;
0075     /* private: */
0076     u16                         num_desc;
0077     /* private: */
0078     u16                         desc_limit;
0079     /* private: */
0080     u16                         next_descq_idx;
0081     /* private: */
0082     u16 coalesce_idx;
0083     /* private: flags */
0084     u16                         flags;
0085     /* private: */
0086     struct sdma_desc descs[NUM_DESC];
0087 };
0088 
0089 static inline int sdma_txreq_built(struct sdma_txreq *tx)
0090 {
0091     return tx->num_desc;
0092 }
0093 
0094 #endif                          /* HFI1_SDMA_TXREQ_H */