linux/drivers/net/ethernet/qlogic/qed/qed_cxt.h
<<
>>
Prefs
   1/* QLogic qed NIC Driver
   2 * Copyright (c) 2015 QLogic Corporation
   3 *
   4 * This software is available under the terms of the GNU General Public License
   5 * (GPL) Version 2, available from the file COPYING in the main directory of
   6 * this source tree.
   7 */
   8
   9#ifndef _QED_CXT_H
  10#define _QED_CXT_H
  11
  12#include <linux/types.h>
  13#include <linux/slab.h>
  14#include <linux/qed/qed_if.h>
  15#include "qed_hsi.h"
  16#include "qed.h"
  17
  18struct qed_cxt_info {
  19        void                    *p_cxt;
  20        u32                     iid;
  21        enum protocol_type      type;
  22};
  23
  24#define MAX_TID_BLOCKS                  512
  25struct qed_tid_mem {
  26        u32 tid_size;
  27        u32 num_tids_per_block;
  28        u32 waste;
  29        u8 *blocks[MAX_TID_BLOCKS];     /* 4K */
  30};
  31
  32/**
  33 * @brief qed_cxt_acquire - Acquire a new cid of a specific protocol type
  34 *
  35 * @param p_hwfn
  36 * @param type
  37 * @param p_cid
  38 *
  39 * @return int
  40 */
  41int qed_cxt_acquire_cid(struct qed_hwfn *p_hwfn,
  42                        enum protocol_type type,
  43                        u32 *p_cid);
  44
  45/**
  46 * @brief qedo_cid_get_cxt_info - Returns the context info for a specific cid
  47 *
  48 *
  49 * @param p_hwfn
  50 * @param p_info in/out
  51 *
  52 * @return int
  53 */
  54int qed_cxt_get_cid_info(struct qed_hwfn *p_hwfn,
  55                         struct qed_cxt_info *p_info);
  56
  57/**
  58 * @brief qed_cxt_get_tid_mem_info
  59 *
  60 * @param p_hwfn
  61 * @param p_info
  62 *
  63 * @return int
  64 */
  65int qed_cxt_get_tid_mem_info(struct qed_hwfn *p_hwfn,
  66                             struct qed_tid_mem *p_info);
  67
  68#define QED_CXT_ISCSI_TID_SEG   PROTOCOLID_ISCSI
  69#define QED_CXT_ROCE_TID_SEG    PROTOCOLID_ROCE
  70enum qed_cxt_elem_type {
  71        QED_ELEM_CXT,
  72        QED_ELEM_SRQ,
  73        QED_ELEM_TASK
  74};
  75
  76u32 qed_cxt_get_proto_cid_count(struct qed_hwfn *p_hwfn,
  77                                enum protocol_type type, u32 *vf_cid);
  78
  79/**
  80 * @brief qed_cxt_set_pf_params - Set the PF params for cxt init
  81 *
  82 * @param p_hwfn
  83 *
  84 * @return int
  85 */
  86int qed_cxt_set_pf_params(struct qed_hwfn *p_hwfn);
  87
  88/**
  89 * @brief qed_cxt_cfg_ilt_compute - compute ILT init parameters
  90 *
  91 * @param p_hwfn
  92 *
  93 * @return int
  94 */
  95int qed_cxt_cfg_ilt_compute(struct qed_hwfn *p_hwfn);
  96
  97/**
  98 * @brief qed_cxt_mngr_alloc - Allocate and init the context manager struct
  99 *
 100 * @param p_hwfn
 101 *
 102 * @return int
 103 */
 104int qed_cxt_mngr_alloc(struct qed_hwfn *p_hwfn);
 105
 106/**
 107 * @brief qed_cxt_mngr_free
 108 *
 109 * @param p_hwfn
 110 */
 111void qed_cxt_mngr_free(struct qed_hwfn *p_hwfn);
 112
 113/**
 114 * @brief qed_cxt_tables_alloc - Allocate ILT shadow, Searcher T2, acquired map
 115 *
 116 * @param p_hwfn
 117 *
 118 * @return int
 119 */
 120int qed_cxt_tables_alloc(struct qed_hwfn *p_hwfn);
 121
 122/**
 123 * @brief qed_cxt_mngr_setup - Reset the acquired CIDs
 124 *
 125 * @param p_hwfn
 126 */
 127void qed_cxt_mngr_setup(struct qed_hwfn *p_hwfn);
 128
 129/**
 130 * @brief qed_cxt_hw_init_common - Initailze ILT and DQ, common phase, per path.
 131 *
 132 *
 133 *
 134 * @param p_hwfn
 135 */
 136void qed_cxt_hw_init_common(struct qed_hwfn *p_hwfn);
 137
 138/**
 139 * @brief qed_cxt_hw_init_pf - Initailze ILT and DQ, PF phase, per path.
 140 *
 141 *
 142 *
 143 * @param p_hwfn
 144 */
 145void qed_cxt_hw_init_pf(struct qed_hwfn *p_hwfn);
 146
 147/**
 148 * @brief qed_qm_init_pf - Initailze the QM PF phase, per path
 149 *
 150 * @param p_hwfn
 151 */
 152
 153void qed_qm_init_pf(struct qed_hwfn *p_hwfn);
 154
 155/**
 156 * @brief Reconfigures QM pf on the fly
 157 *
 158 * @param p_hwfn
 159 * @param p_ptt
 160 *
 161 * @return int
 162 */
 163int qed_qm_reconf(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt);
 164
 165/**
 166 * @brief qed_cxt_release - Release a cid
 167 *
 168 * @param p_hwfn
 169 * @param cid
 170 */
 171void qed_cxt_release_cid(struct qed_hwfn *p_hwfn,
 172                         u32 cid);
 173int qed_cxt_dynamic_ilt_alloc(struct qed_hwfn *p_hwfn,
 174                              enum qed_cxt_elem_type elem_type, u32 iid);
 175u32 qed_cxt_get_proto_tid_count(struct qed_hwfn *p_hwfn,
 176                                enum protocol_type type);
 177u32 qed_cxt_get_proto_cid_start(struct qed_hwfn *p_hwfn,
 178                                enum protocol_type type);
 179int qed_cxt_free_proto_ilt(struct qed_hwfn *p_hwfn, enum protocol_type proto);
 180
 181#define QED_CTX_WORKING_MEM 0
 182#define QED_CTX_FL_MEM 1
 183#endif
 184