2 * Copyright (c) 2016 QLogic Corporation.
6 * See LICENSE.qede_pmd for copyright and licensing details.
10 #define __ECORE_L2_H__
15 #include "ecore_spq.h"
16 #include "ecore_l2_api.h"
18 #define MAX_QUEUES_PER_QZONE (sizeof(unsigned long) * 8)
19 #define ECORE_QUEUE_CID_PF (0xff)
21 /* Additional parameters required for initialization of the queue_cid
22 * and are relevant only for a PF initializing one for its VFs.
24 struct ecore_queue_cid_vf_params {
25 /* Should match the VF's relative index */
28 /* 0-based queue index. Should reflect the relative qzone the
29 * VF thinks is associated with it [in its range].
33 /* Indicates a VF is legacy, making it differ in several things:
34 * - Producers would be placed in a different place.
35 * - Makes assumptions regarding the CIDs.
39 /* For VFs, this index arrives via TLV to diffrentiate between
40 * different queues opened on the same qzone, and is passed
41 * [where the PF would have allocated it internally for its own].
46 struct ecore_queue_cid {
47 /* 'Relative' is a relative term ;-). Usually the indices [not counting
48 * SBs] would be PF-relative, but there are some cases where that isn't
49 * the case - specifically for a PF configuring its VF indices it's
50 * possible some fields [E.g., stats-id] in 'rel' would already be abs.
52 struct ecore_queue_start_common_params rel;
53 struct ecore_queue_start_common_params abs;
57 /* VFs queues are mapped differently, so we need to know the
58 * relative queue associated with them [0-based].
59 * Notice this is relevant on the *PF* queue-cid of its VF's queues,
60 * and not on the VF itself.
65 /* We need an additional index to diffrentiate between queues opened
66 * for same queue-zone, as VFs would have to communicate the info
67 * to the PF [otherwise PF has no way to diffrentiate].
71 /* Legacy VFs might have Rx producer located elsewhere */
74 struct ecore_hwfn *p_owner;
77 enum _ecore_status_t ecore_l2_alloc(struct ecore_hwfn *p_hwfn);
78 void ecore_l2_setup(struct ecore_hwfn *p_hwfn);
79 void ecore_l2_free(struct ecore_hwfn *p_hwfn);
81 void ecore_eth_queue_cid_release(struct ecore_hwfn *p_hwfn,
82 struct ecore_queue_cid *p_cid);
84 struct ecore_queue_cid *
85 ecore_eth_queue_to_cid(struct ecore_hwfn *p_hwfn, u16 opaque_fid,
86 struct ecore_queue_start_common_params *p_params,
87 struct ecore_queue_cid_vf_params *p_vf_params);
90 ecore_sp_eth_vport_start(struct ecore_hwfn *p_hwfn,
91 struct ecore_sp_vport_start_params *p_params);
94 * @brief - Starts an Rx queue, when queue_cid is already prepared
99 * @param bd_chain_phys_addr
100 * @param cqe_pbl_addr
101 * @param cqe_pbl_size
103 * @return enum _ecore_status_t
106 ecore_eth_rxq_start_ramrod(struct ecore_hwfn *p_hwfn,
107 struct ecore_queue_cid *p_cid,
109 dma_addr_t bd_chain_phys_addr,
110 dma_addr_t cqe_pbl_addr,
114 * @brief - Starts a Tx queue, where queue_cid is already prepared
120 * @param p_pq_params - parameters for choosing the PQ for this Tx queue
122 * @return enum _ecore_status_t
125 ecore_eth_txq_start_ramrod(struct ecore_hwfn *p_hwfn,
126 struct ecore_queue_cid *p_cid,
127 dma_addr_t pbl_addr, u16 pbl_size,
130 u8 ecore_mcast_bin_from_mac(u8 *mac);
133 * @brief - ecore_configure_rfs_ntuple_filter
135 * This ramrod should be used to add or remove arfs hw filter
139 * @params p_cb Used for ECORE_SPQ_MODE_CB,where client would initialize
140 it with cookie and callback function address, if not
141 using this mode then client must pass NULL.
142 * @params p_addr p_addr is an actual packet header that needs to be
143 * filter. It has to mapped with IO to read prior to
144 * calling this, [contains 4 tuples- src ip, dest ip,
145 * src port, dest port].
146 * @params length length of p_addr header up to past the transport header.
147 * @params qid receive packet will be directed to this queue.
149 * @params b_is_add flag to add or remove filter.
153 ecore_configure_rfs_ntuple_filter(struct ecore_hwfn *p_hwfn,
154 struct ecore_ptt *p_ptt,
155 struct ecore_spq_comp_cb *p_cb,
156 dma_addr_t p_addr, u16 length,
157 u16 qid, u8 vport_id,