bnx2x_sp.h 36 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394
  1. /* bnx2x_sp.h: Broadcom Everest network driver.
  2. *
  3. * Copyright (c) 2011-2013 Broadcom Corporation
  4. *
  5. * Unless you and Broadcom execute a separate written software license
  6. * agreement governing use of this software, this software is licensed to you
  7. * under the terms of the GNU General Public License version 2, available
  8. * at http://www.gnu.org/licenses/old-licenses/gpl-2.0.html (the "GPL").
  9. *
  10. * Notwithstanding the above, under no circumstances may you combine this
  11. * software in any way with any other Broadcom software provided under a
  12. * license other than the GPL, without Broadcom's express prior written
  13. * consent.
  14. *
  15. * Maintained by: Eilon Greenstein <eilong@broadcom.com>
  16. * Written by: Vladislav Zolotarov
  17. *
  18. */
  19. #ifndef BNX2X_SP_VERBS
  20. #define BNX2X_SP_VERBS
  21. struct bnx2x;
  22. struct eth_context;
  23. /* Bits representing general command's configuration */
  24. enum {
  25. RAMROD_TX,
  26. RAMROD_RX,
  27. /* Wait until all pending commands complete */
  28. RAMROD_COMP_WAIT,
  29. /* Don't send a ramrod, only update a registry */
  30. RAMROD_DRV_CLR_ONLY,
  31. /* Configure HW according to the current object state */
  32. RAMROD_RESTORE,
  33. /* Execute the next command now */
  34. RAMROD_EXEC,
  35. /*
  36. * Don't add a new command and continue execution of posponed
  37. * commands. If not set a new command will be added to the
  38. * pending commands list.
  39. */
  40. RAMROD_CONT,
  41. /* If there is another pending ramrod, wait until it finishes and
  42. * re-try to submit this one. This flag can be set only in sleepable
  43. * context, and should not be set from the context that completes the
  44. * ramrods as deadlock will occur.
  45. */
  46. RAMROD_RETRY,
  47. };
  48. typedef enum {
  49. BNX2X_OBJ_TYPE_RX,
  50. BNX2X_OBJ_TYPE_TX,
  51. BNX2X_OBJ_TYPE_RX_TX,
  52. } bnx2x_obj_type;
  53. /* Public slow path states */
  54. enum {
  55. BNX2X_FILTER_MAC_PENDING,
  56. BNX2X_FILTER_VLAN_PENDING,
  57. BNX2X_FILTER_VLAN_MAC_PENDING,
  58. BNX2X_FILTER_RX_MODE_PENDING,
  59. BNX2X_FILTER_RX_MODE_SCHED,
  60. BNX2X_FILTER_ISCSI_ETH_START_SCHED,
  61. BNX2X_FILTER_ISCSI_ETH_STOP_SCHED,
  62. BNX2X_FILTER_FCOE_ETH_START_SCHED,
  63. BNX2X_FILTER_FCOE_ETH_STOP_SCHED,
  64. BNX2X_FILTER_MCAST_PENDING,
  65. BNX2X_FILTER_MCAST_SCHED,
  66. BNX2X_FILTER_RSS_CONF_PENDING,
  67. BNX2X_AFEX_FCOE_Q_UPDATE_PENDING,
  68. BNX2X_AFEX_PENDING_VIFSET_MCP_ACK
  69. };
  70. struct bnx2x_raw_obj {
  71. u8 func_id;
  72. /* Queue params */
  73. u8 cl_id;
  74. u32 cid;
  75. /* Ramrod data buffer params */
  76. void *rdata;
  77. dma_addr_t rdata_mapping;
  78. /* Ramrod state params */
  79. int state; /* "ramrod is pending" state bit */
  80. unsigned long *pstate; /* pointer to state buffer */
  81. bnx2x_obj_type obj_type;
  82. int (*wait_comp)(struct bnx2x *bp,
  83. struct bnx2x_raw_obj *o);
  84. bool (*check_pending)(struct bnx2x_raw_obj *o);
  85. void (*clear_pending)(struct bnx2x_raw_obj *o);
  86. void (*set_pending)(struct bnx2x_raw_obj *o);
  87. };
  88. /************************* VLAN-MAC commands related parameters ***************/
  89. struct bnx2x_mac_ramrod_data {
  90. u8 mac[ETH_ALEN];
  91. };
  92. struct bnx2x_vlan_ramrod_data {
  93. u16 vlan;
  94. };
  95. struct bnx2x_vlan_mac_ramrod_data {
  96. u8 mac[ETH_ALEN];
  97. u16 vlan;
  98. };
  99. union bnx2x_classification_ramrod_data {
  100. struct bnx2x_mac_ramrod_data mac;
  101. struct bnx2x_vlan_ramrod_data vlan;
  102. struct bnx2x_vlan_mac_ramrod_data vlan_mac;
  103. };
  104. /* VLAN_MAC commands */
  105. enum bnx2x_vlan_mac_cmd {
  106. BNX2X_VLAN_MAC_ADD,
  107. BNX2X_VLAN_MAC_DEL,
  108. BNX2X_VLAN_MAC_MOVE,
  109. };
  110. struct bnx2x_vlan_mac_data {
  111. /* Requested command: BNX2X_VLAN_MAC_XX */
  112. enum bnx2x_vlan_mac_cmd cmd;
  113. /*
  114. * used to contain the data related vlan_mac_flags bits from
  115. * ramrod parameters.
  116. */
  117. unsigned long vlan_mac_flags;
  118. /* Needed for MOVE command */
  119. struct bnx2x_vlan_mac_obj *target_obj;
  120. union bnx2x_classification_ramrod_data u;
  121. };
  122. /*************************** Exe Queue obj ************************************/
  123. union bnx2x_exe_queue_cmd_data {
  124. struct bnx2x_vlan_mac_data vlan_mac;
  125. struct {
  126. /* TODO */
  127. } mcast;
  128. };
  129. struct bnx2x_exeq_elem {
  130. struct list_head link;
  131. /* Length of this element in the exe_chunk. */
  132. int cmd_len;
  133. union bnx2x_exe_queue_cmd_data cmd_data;
  134. };
  135. union bnx2x_qable_obj;
  136. union bnx2x_exeq_comp_elem {
  137. union event_ring_elem *elem;
  138. };
  139. struct bnx2x_exe_queue_obj;
  140. typedef int (*exe_q_validate)(struct bnx2x *bp,
  141. union bnx2x_qable_obj *o,
  142. struct bnx2x_exeq_elem *elem);
  143. typedef int (*exe_q_remove)(struct bnx2x *bp,
  144. union bnx2x_qable_obj *o,
  145. struct bnx2x_exeq_elem *elem);
  146. /* Return positive if entry was optimized, 0 - if not, negative
  147. * in case of an error.
  148. */
  149. typedef int (*exe_q_optimize)(struct bnx2x *bp,
  150. union bnx2x_qable_obj *o,
  151. struct bnx2x_exeq_elem *elem);
  152. typedef int (*exe_q_execute)(struct bnx2x *bp,
  153. union bnx2x_qable_obj *o,
  154. struct list_head *exe_chunk,
  155. unsigned long *ramrod_flags);
  156. typedef struct bnx2x_exeq_elem *
  157. (*exe_q_get)(struct bnx2x_exe_queue_obj *o,
  158. struct bnx2x_exeq_elem *elem);
  159. struct bnx2x_exe_queue_obj {
  160. /*
  161. * Commands pending for an execution.
  162. */
  163. struct list_head exe_queue;
  164. /*
  165. * Commands pending for an completion.
  166. */
  167. struct list_head pending_comp;
  168. spinlock_t lock;
  169. /* Maximum length of commands' list for one execution */
  170. int exe_chunk_len;
  171. union bnx2x_qable_obj *owner;
  172. /****** Virtual functions ******/
  173. /**
  174. * Called before commands execution for commands that are really
  175. * going to be executed (after 'optimize').
  176. *
  177. * Must run under exe_queue->lock
  178. */
  179. exe_q_validate validate;
  180. /**
  181. * Called before removing pending commands, cleaning allocated
  182. * resources (e.g., credits from validate)
  183. */
  184. exe_q_remove remove;
  185. /**
  186. * This will try to cancel the current pending commands list
  187. * considering the new command.
  188. *
  189. * Returns the number of optimized commands or a negative error code
  190. *
  191. * Must run under exe_queue->lock
  192. */
  193. exe_q_optimize optimize;
  194. /**
  195. * Run the next commands chunk (owner specific).
  196. */
  197. exe_q_execute execute;
  198. /**
  199. * Return the exe_queue element containing the specific command
  200. * if any. Otherwise return NULL.
  201. */
  202. exe_q_get get;
  203. };
  204. /***************** Classification verbs: Set/Del MAC/VLAN/VLAN-MAC ************/
  205. /*
  206. * Element in the VLAN_MAC registry list having all currenty configured
  207. * rules.
  208. */
  209. struct bnx2x_vlan_mac_registry_elem {
  210. struct list_head link;
  211. /*
  212. * Used to store the cam offset used for the mac/vlan/vlan-mac.
  213. * Relevant for 57710 and 57711 only. VLANs and MACs share the
  214. * same CAM for these chips.
  215. */
  216. int cam_offset;
  217. /* Needed for DEL and RESTORE flows */
  218. unsigned long vlan_mac_flags;
  219. union bnx2x_classification_ramrod_data u;
  220. };
  221. /* Bits representing VLAN_MAC commands specific flags */
  222. enum {
  223. BNX2X_UC_LIST_MAC,
  224. BNX2X_ETH_MAC,
  225. BNX2X_ISCSI_ETH_MAC,
  226. BNX2X_NETQ_ETH_MAC,
  227. BNX2X_DONT_CONSUME_CAM_CREDIT,
  228. BNX2X_DONT_CONSUME_CAM_CREDIT_DEST,
  229. };
  230. struct bnx2x_vlan_mac_ramrod_params {
  231. /* Object to run the command from */
  232. struct bnx2x_vlan_mac_obj *vlan_mac_obj;
  233. /* General command flags: COMP_WAIT, etc. */
  234. unsigned long ramrod_flags;
  235. /* Command specific configuration request */
  236. struct bnx2x_vlan_mac_data user_req;
  237. };
  238. struct bnx2x_vlan_mac_obj {
  239. struct bnx2x_raw_obj raw;
  240. /* Bookkeeping list: will prevent the addition of already existing
  241. * entries.
  242. */
  243. struct list_head head;
  244. /* TODO: Add it's initialization in the init functions */
  245. struct bnx2x_exe_queue_obj exe_queue;
  246. /* MACs credit pool */
  247. struct bnx2x_credit_pool_obj *macs_pool;
  248. /* VLANs credit pool */
  249. struct bnx2x_credit_pool_obj *vlans_pool;
  250. /* RAMROD command to be used */
  251. int ramrod_cmd;
  252. /* copy first n elements onto preallocated buffer
  253. *
  254. * @param n number of elements to get
  255. * @param buf buffer preallocated by caller into which elements
  256. * will be copied. Note elements are 4-byte aligned
  257. * so buffer size must be able to accomodate the
  258. * aligned elements.
  259. *
  260. * @return number of copied bytes
  261. */
  262. int (*get_n_elements)(struct bnx2x *bp,
  263. struct bnx2x_vlan_mac_obj *o, int n, u8 *base,
  264. u8 stride, u8 size);
  265. /**
  266. * Checks if ADD-ramrod with the given params may be performed.
  267. *
  268. * @return zero if the element may be added
  269. */
  270. int (*check_add)(struct bnx2x *bp,
  271. struct bnx2x_vlan_mac_obj *o,
  272. union bnx2x_classification_ramrod_data *data);
  273. /**
  274. * Checks if DEL-ramrod with the given params may be performed.
  275. *
  276. * @return true if the element may be deleted
  277. */
  278. struct bnx2x_vlan_mac_registry_elem *
  279. (*check_del)(struct bnx2x *bp,
  280. struct bnx2x_vlan_mac_obj *o,
  281. union bnx2x_classification_ramrod_data *data);
  282. /**
  283. * Checks if DEL-ramrod with the given params may be performed.
  284. *
  285. * @return true if the element may be deleted
  286. */
  287. bool (*check_move)(struct bnx2x *bp,
  288. struct bnx2x_vlan_mac_obj *src_o,
  289. struct bnx2x_vlan_mac_obj *dst_o,
  290. union bnx2x_classification_ramrod_data *data);
  291. /**
  292. * Update the relevant credit object(s) (consume/return
  293. * correspondingly).
  294. */
  295. bool (*get_credit)(struct bnx2x_vlan_mac_obj *o);
  296. bool (*put_credit)(struct bnx2x_vlan_mac_obj *o);
  297. bool (*get_cam_offset)(struct bnx2x_vlan_mac_obj *o, int *offset);
  298. bool (*put_cam_offset)(struct bnx2x_vlan_mac_obj *o, int offset);
  299. /**
  300. * Configures one rule in the ramrod data buffer.
  301. */
  302. void (*set_one_rule)(struct bnx2x *bp,
  303. struct bnx2x_vlan_mac_obj *o,
  304. struct bnx2x_exeq_elem *elem, int rule_idx,
  305. int cam_offset);
  306. /**
  307. * Delete all configured elements having the given
  308. * vlan_mac_flags specification. Assumes no pending for
  309. * execution commands. Will schedule all all currently
  310. * configured MACs/VLANs/VLAN-MACs matching the vlan_mac_flags
  311. * specification for deletion and will use the given
  312. * ramrod_flags for the last DEL operation.
  313. *
  314. * @param bp
  315. * @param o
  316. * @param ramrod_flags RAMROD_XX flags
  317. *
  318. * @return 0 if the last operation has completed successfully
  319. * and there are no more elements left, positive value
  320. * if there are pending for completion commands,
  321. * negative value in case of failure.
  322. */
  323. int (*delete_all)(struct bnx2x *bp,
  324. struct bnx2x_vlan_mac_obj *o,
  325. unsigned long *vlan_mac_flags,
  326. unsigned long *ramrod_flags);
  327. /**
  328. * Reconfigures the next MAC/VLAN/VLAN-MAC element from the previously
  329. * configured elements list.
  330. *
  331. * @param bp
  332. * @param p Command parameters (RAMROD_COMP_WAIT bit in
  333. * ramrod_flags is only taken into an account)
  334. * @param ppos a pointer to the cooky that should be given back in the
  335. * next call to make function handle the next element. If
  336. * *ppos is set to NULL it will restart the iterator.
  337. * If returned *ppos == NULL this means that the last
  338. * element has been handled.
  339. *
  340. * @return int
  341. */
  342. int (*restore)(struct bnx2x *bp,
  343. struct bnx2x_vlan_mac_ramrod_params *p,
  344. struct bnx2x_vlan_mac_registry_elem **ppos);
  345. /**
  346. * Should be called on a completion arival.
  347. *
  348. * @param bp
  349. * @param o
  350. * @param cqe Completion element we are handling
  351. * @param ramrod_flags if RAMROD_CONT is set the next bulk of
  352. * pending commands will be executed.
  353. * RAMROD_DRV_CLR_ONLY and RAMROD_RESTORE
  354. * may also be set if needed.
  355. *
  356. * @return 0 if there are neither pending nor waiting for
  357. * completion commands. Positive value if there are
  358. * pending for execution or for completion commands.
  359. * Negative value in case of an error (including an
  360. * error in the cqe).
  361. */
  362. int (*complete)(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o,
  363. union event_ring_elem *cqe,
  364. unsigned long *ramrod_flags);
  365. /**
  366. * Wait for completion of all commands. Don't schedule new ones,
  367. * just wait. It assumes that the completion code will schedule
  368. * for new commands.
  369. */
  370. int (*wait)(struct bnx2x *bp, struct bnx2x_vlan_mac_obj *o);
  371. };
  372. enum {
  373. BNX2X_LLH_CAM_ISCSI_ETH_LINE = 0,
  374. BNX2X_LLH_CAM_ETH_LINE,
  375. BNX2X_LLH_CAM_MAX_PF_LINE = NIG_REG_LLH1_FUNC_MEM_SIZE / 2
  376. };
  377. void bnx2x_set_mac_in_nig(struct bnx2x *bp,
  378. bool add, unsigned char *dev_addr, int index);
  379. /** RX_MODE verbs:DROP_ALL/ACCEPT_ALL/ACCEPT_ALL_MULTI/ACCEPT_ALL_VLAN/NORMAL */
  380. /* RX_MODE ramrod spesial flags: set in rx_mode_flags field in
  381. * a bnx2x_rx_mode_ramrod_params.
  382. */
  383. enum {
  384. BNX2X_RX_MODE_FCOE_ETH,
  385. BNX2X_RX_MODE_ISCSI_ETH,
  386. };
  387. enum {
  388. BNX2X_ACCEPT_UNICAST,
  389. BNX2X_ACCEPT_MULTICAST,
  390. BNX2X_ACCEPT_ALL_UNICAST,
  391. BNX2X_ACCEPT_ALL_MULTICAST,
  392. BNX2X_ACCEPT_BROADCAST,
  393. BNX2X_ACCEPT_UNMATCHED,
  394. BNX2X_ACCEPT_ANY_VLAN
  395. };
  396. struct bnx2x_rx_mode_ramrod_params {
  397. struct bnx2x_rx_mode_obj *rx_mode_obj;
  398. unsigned long *pstate;
  399. int state;
  400. u8 cl_id;
  401. u32 cid;
  402. u8 func_id;
  403. unsigned long ramrod_flags;
  404. unsigned long rx_mode_flags;
  405. /*
  406. * rdata is either a pointer to eth_filter_rules_ramrod_data(e2) or to
  407. * a tstorm_eth_mac_filter_config (e1x).
  408. */
  409. void *rdata;
  410. dma_addr_t rdata_mapping;
  411. /* Rx mode settings */
  412. unsigned long rx_accept_flags;
  413. /* internal switching settings */
  414. unsigned long tx_accept_flags;
  415. };
  416. struct bnx2x_rx_mode_obj {
  417. int (*config_rx_mode)(struct bnx2x *bp,
  418. struct bnx2x_rx_mode_ramrod_params *p);
  419. int (*wait_comp)(struct bnx2x *bp,
  420. struct bnx2x_rx_mode_ramrod_params *p);
  421. };
  422. /********************** Set multicast group ***********************************/
  423. struct bnx2x_mcast_list_elem {
  424. struct list_head link;
  425. u8 *mac;
  426. };
  427. union bnx2x_mcast_config_data {
  428. u8 *mac;
  429. u8 bin; /* used in a RESTORE flow */
  430. };
  431. struct bnx2x_mcast_ramrod_params {
  432. struct bnx2x_mcast_obj *mcast_obj;
  433. /* Relevant options are RAMROD_COMP_WAIT and RAMROD_DRV_CLR_ONLY */
  434. unsigned long ramrod_flags;
  435. struct list_head mcast_list; /* list of struct bnx2x_mcast_list_elem */
  436. /** TODO:
  437. * - rename it to macs_num.
  438. * - Add a new command type for handling pending commands
  439. * (remove "zero semantics").
  440. *
  441. * Length of mcast_list. If zero and ADD_CONT command - post
  442. * pending commands.
  443. */
  444. int mcast_list_len;
  445. };
  446. enum bnx2x_mcast_cmd {
  447. BNX2X_MCAST_CMD_ADD,
  448. BNX2X_MCAST_CMD_CONT,
  449. BNX2X_MCAST_CMD_DEL,
  450. BNX2X_MCAST_CMD_RESTORE,
  451. };
  452. struct bnx2x_mcast_obj {
  453. struct bnx2x_raw_obj raw;
  454. union {
  455. struct {
  456. #define BNX2X_MCAST_BINS_NUM 256
  457. #define BNX2X_MCAST_VEC_SZ (BNX2X_MCAST_BINS_NUM / 64)
  458. u64 vec[BNX2X_MCAST_VEC_SZ];
  459. /** Number of BINs to clear. Should be updated
  460. * immediately when a command arrives in order to
  461. * properly create DEL commands.
  462. */
  463. int num_bins_set;
  464. } aprox_match;
  465. struct {
  466. struct list_head macs;
  467. int num_macs_set;
  468. } exact_match;
  469. } registry;
  470. /* Pending commands */
  471. struct list_head pending_cmds_head;
  472. /* A state that is set in raw.pstate, when there are pending commands */
  473. int sched_state;
  474. /* Maximal number of mcast MACs configured in one command */
  475. int max_cmd_len;
  476. /* Total number of currently pending MACs to configure: both
  477. * in the pending commands list and in the current command.
  478. */
  479. int total_pending_num;
  480. u8 engine_id;
  481. /**
  482. * @param cmd command to execute (BNX2X_MCAST_CMD_X, see above)
  483. */
  484. int (*config_mcast)(struct bnx2x *bp,
  485. struct bnx2x_mcast_ramrod_params *p,
  486. enum bnx2x_mcast_cmd cmd);
  487. /**
  488. * Fills the ramrod data during the RESTORE flow.
  489. *
  490. * @param bp
  491. * @param o
  492. * @param start_idx Registry index to start from
  493. * @param rdata_idx Index in the ramrod data to start from
  494. *
  495. * @return -1 if we handled the whole registry or index of the last
  496. * handled registry element.
  497. */
  498. int (*hdl_restore)(struct bnx2x *bp, struct bnx2x_mcast_obj *o,
  499. int start_bin, int *rdata_idx);
  500. int (*enqueue_cmd)(struct bnx2x *bp, struct bnx2x_mcast_obj *o,
  501. struct bnx2x_mcast_ramrod_params *p,
  502. enum bnx2x_mcast_cmd cmd);
  503. void (*set_one_rule)(struct bnx2x *bp,
  504. struct bnx2x_mcast_obj *o, int idx,
  505. union bnx2x_mcast_config_data *cfg_data,
  506. enum bnx2x_mcast_cmd cmd);
  507. /** Checks if there are more mcast MACs to be set or a previous
  508. * command is still pending.
  509. */
  510. bool (*check_pending)(struct bnx2x_mcast_obj *o);
  511. /**
  512. * Set/Clear/Check SCHEDULED state of the object
  513. */
  514. void (*set_sched)(struct bnx2x_mcast_obj *o);
  515. void (*clear_sched)(struct bnx2x_mcast_obj *o);
  516. bool (*check_sched)(struct bnx2x_mcast_obj *o);
  517. /* Wait until all pending commands complete */
  518. int (*wait_comp)(struct bnx2x *bp, struct bnx2x_mcast_obj *o);
  519. /**
  520. * Handle the internal object counters needed for proper
  521. * commands handling. Checks that the provided parameters are
  522. * feasible.
  523. */
  524. int (*validate)(struct bnx2x *bp,
  525. struct bnx2x_mcast_ramrod_params *p,
  526. enum bnx2x_mcast_cmd cmd);
  527. /**
  528. * Restore the values of internal counters in case of a failure.
  529. */
  530. void (*revert)(struct bnx2x *bp,
  531. struct bnx2x_mcast_ramrod_params *p,
  532. int old_num_bins);
  533. int (*get_registry_size)(struct bnx2x_mcast_obj *o);
  534. void (*set_registry_size)(struct bnx2x_mcast_obj *o, int n);
  535. };
  536. /*************************** Credit handling **********************************/
  537. struct bnx2x_credit_pool_obj {
  538. /* Current amount of credit in the pool */
  539. atomic_t credit;
  540. /* Maximum allowed credit. put() will check against it. */
  541. int pool_sz;
  542. /*
  543. * Allocate a pool table statically.
  544. *
  545. * Currently the mamimum allowed size is MAX_MAC_CREDIT_E2(272)
  546. *
  547. * The set bit in the table will mean that the entry is available.
  548. */
  549. #define BNX2X_POOL_VEC_SIZE (MAX_MAC_CREDIT_E2 / 64)
  550. u64 pool_mirror[BNX2X_POOL_VEC_SIZE];
  551. /* Base pool offset (initialized differently */
  552. int base_pool_offset;
  553. /**
  554. * Get the next free pool entry.
  555. *
  556. * @return true if there was a free entry in the pool
  557. */
  558. bool (*get_entry)(struct bnx2x_credit_pool_obj *o, int *entry);
  559. /**
  560. * Return the entry back to the pool.
  561. *
  562. * @return true if entry is legal and has been successfully
  563. * returned to the pool.
  564. */
  565. bool (*put_entry)(struct bnx2x_credit_pool_obj *o, int entry);
  566. /**
  567. * Get the requested amount of credit from the pool.
  568. *
  569. * @param cnt Amount of requested credit
  570. * @return true if the operation is successful
  571. */
  572. bool (*get)(struct bnx2x_credit_pool_obj *o, int cnt);
  573. /**
  574. * Returns the credit to the pool.
  575. *
  576. * @param cnt Amount of credit to return
  577. * @return true if the operation is successful
  578. */
  579. bool (*put)(struct bnx2x_credit_pool_obj *o, int cnt);
  580. /**
  581. * Reads the current amount of credit.
  582. */
  583. int (*check)(struct bnx2x_credit_pool_obj *o);
  584. };
  585. /*************************** RSS configuration ********************************/
  586. enum {
  587. /* RSS_MODE bits are mutually exclusive */
  588. BNX2X_RSS_MODE_DISABLED,
  589. BNX2X_RSS_MODE_REGULAR,
  590. BNX2X_RSS_SET_SRCH, /* Setup searcher, E1x specific flag */
  591. BNX2X_RSS_IPV4,
  592. BNX2X_RSS_IPV4_TCP,
  593. BNX2X_RSS_IPV4_UDP,
  594. BNX2X_RSS_IPV6,
  595. BNX2X_RSS_IPV6_TCP,
  596. BNX2X_RSS_IPV6_UDP,
  597. };
  598. struct bnx2x_config_rss_params {
  599. struct bnx2x_rss_config_obj *rss_obj;
  600. /* may have RAMROD_COMP_WAIT set only */
  601. unsigned long ramrod_flags;
  602. /* BNX2X_RSS_X bits */
  603. unsigned long rss_flags;
  604. /* Number hash bits to take into an account */
  605. u8 rss_result_mask;
  606. /* Indirection table */
  607. u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
  608. /* RSS hash values */
  609. u32 rss_key[10];
  610. /* valid only iff BNX2X_RSS_UPDATE_TOE is set */
  611. u16 toe_rss_bitmap;
  612. };
  613. struct bnx2x_rss_config_obj {
  614. struct bnx2x_raw_obj raw;
  615. /* RSS engine to use */
  616. u8 engine_id;
  617. /* Last configured indirection table */
  618. u8 ind_table[T_ETH_INDIRECTION_TABLE_SIZE];
  619. /* flags for enabling 4-tupple hash on UDP */
  620. u8 udp_rss_v4;
  621. u8 udp_rss_v6;
  622. int (*config_rss)(struct bnx2x *bp,
  623. struct bnx2x_config_rss_params *p);
  624. };
  625. /*********************** Queue state update ***********************************/
  626. /* UPDATE command options */
  627. enum {
  628. BNX2X_Q_UPDATE_IN_VLAN_REM,
  629. BNX2X_Q_UPDATE_IN_VLAN_REM_CHNG,
  630. BNX2X_Q_UPDATE_OUT_VLAN_REM,
  631. BNX2X_Q_UPDATE_OUT_VLAN_REM_CHNG,
  632. BNX2X_Q_UPDATE_ANTI_SPOOF,
  633. BNX2X_Q_UPDATE_ANTI_SPOOF_CHNG,
  634. BNX2X_Q_UPDATE_ACTIVATE,
  635. BNX2X_Q_UPDATE_ACTIVATE_CHNG,
  636. BNX2X_Q_UPDATE_DEF_VLAN_EN,
  637. BNX2X_Q_UPDATE_DEF_VLAN_EN_CHNG,
  638. BNX2X_Q_UPDATE_SILENT_VLAN_REM_CHNG,
  639. BNX2X_Q_UPDATE_SILENT_VLAN_REM
  640. };
  641. /* Allowed Queue states */
  642. enum bnx2x_q_state {
  643. BNX2X_Q_STATE_RESET,
  644. BNX2X_Q_STATE_INITIALIZED,
  645. BNX2X_Q_STATE_ACTIVE,
  646. BNX2X_Q_STATE_MULTI_COS,
  647. BNX2X_Q_STATE_MCOS_TERMINATED,
  648. BNX2X_Q_STATE_INACTIVE,
  649. BNX2X_Q_STATE_STOPPED,
  650. BNX2X_Q_STATE_TERMINATED,
  651. BNX2X_Q_STATE_FLRED,
  652. BNX2X_Q_STATE_MAX,
  653. };
  654. /* Allowed Queue states */
  655. enum bnx2x_q_logical_state {
  656. BNX2X_Q_LOGICAL_STATE_ACTIVE,
  657. BNX2X_Q_LOGICAL_STATE_STOPPED,
  658. };
  659. /* Allowed commands */
  660. enum bnx2x_queue_cmd {
  661. BNX2X_Q_CMD_INIT,
  662. BNX2X_Q_CMD_SETUP,
  663. BNX2X_Q_CMD_SETUP_TX_ONLY,
  664. BNX2X_Q_CMD_DEACTIVATE,
  665. BNX2X_Q_CMD_ACTIVATE,
  666. BNX2X_Q_CMD_UPDATE,
  667. BNX2X_Q_CMD_UPDATE_TPA,
  668. BNX2X_Q_CMD_HALT,
  669. BNX2X_Q_CMD_CFC_DEL,
  670. BNX2X_Q_CMD_TERMINATE,
  671. BNX2X_Q_CMD_EMPTY,
  672. BNX2X_Q_CMD_MAX,
  673. };
  674. /* queue SETUP + INIT flags */
  675. enum {
  676. BNX2X_Q_FLG_TPA,
  677. BNX2X_Q_FLG_TPA_IPV6,
  678. BNX2X_Q_FLG_TPA_GRO,
  679. BNX2X_Q_FLG_STATS,
  680. BNX2X_Q_FLG_ZERO_STATS,
  681. BNX2X_Q_FLG_ACTIVE,
  682. BNX2X_Q_FLG_OV,
  683. BNX2X_Q_FLG_VLAN,
  684. BNX2X_Q_FLG_COS,
  685. BNX2X_Q_FLG_HC,
  686. BNX2X_Q_FLG_HC_EN,
  687. BNX2X_Q_FLG_DHC,
  688. BNX2X_Q_FLG_FCOE,
  689. BNX2X_Q_FLG_LEADING_RSS,
  690. BNX2X_Q_FLG_MCAST,
  691. BNX2X_Q_FLG_DEF_VLAN,
  692. BNX2X_Q_FLG_TX_SWITCH,
  693. BNX2X_Q_FLG_TX_SEC,
  694. BNX2X_Q_FLG_ANTI_SPOOF,
  695. BNX2X_Q_FLG_SILENT_VLAN_REM,
  696. BNX2X_Q_FLG_FORCE_DEFAULT_PRI
  697. };
  698. /* Queue type options: queue type may be a compination of below. */
  699. enum bnx2x_q_type {
  700. /** TODO: Consider moving both these flags into the init()
  701. * ramrod params.
  702. */
  703. BNX2X_Q_TYPE_HAS_RX,
  704. BNX2X_Q_TYPE_HAS_TX,
  705. };
  706. #define BNX2X_PRIMARY_CID_INDEX 0
  707. #define BNX2X_MULTI_TX_COS_E1X 3 /* QM only */
  708. #define BNX2X_MULTI_TX_COS_E2_E3A0 2
  709. #define BNX2X_MULTI_TX_COS_E3B0 3
  710. #define BNX2X_MULTI_TX_COS 3 /* Maximum possible */
  711. #define MAC_PAD (ALIGN(ETH_ALEN, sizeof(u32)) - ETH_ALEN)
  712. struct bnx2x_queue_init_params {
  713. struct {
  714. unsigned long flags;
  715. u16 hc_rate;
  716. u8 fw_sb_id;
  717. u8 sb_cq_index;
  718. } tx;
  719. struct {
  720. unsigned long flags;
  721. u16 hc_rate;
  722. u8 fw_sb_id;
  723. u8 sb_cq_index;
  724. } rx;
  725. /* CID context in the host memory */
  726. struct eth_context *cxts[BNX2X_MULTI_TX_COS];
  727. /* maximum number of cos supported by hardware */
  728. u8 max_cos;
  729. };
  730. struct bnx2x_queue_terminate_params {
  731. /* index within the tx_only cids of this queue object */
  732. u8 cid_index;
  733. };
  734. struct bnx2x_queue_cfc_del_params {
  735. /* index within the tx_only cids of this queue object */
  736. u8 cid_index;
  737. };
  738. struct bnx2x_queue_update_params {
  739. unsigned long update_flags; /* BNX2X_Q_UPDATE_XX bits */
  740. u16 def_vlan;
  741. u16 silent_removal_value;
  742. u16 silent_removal_mask;
  743. /* index within the tx_only cids of this queue object */
  744. u8 cid_index;
  745. };
  746. struct rxq_pause_params {
  747. u16 bd_th_lo;
  748. u16 bd_th_hi;
  749. u16 rcq_th_lo;
  750. u16 rcq_th_hi;
  751. u16 sge_th_lo; /* valid iff BNX2X_Q_FLG_TPA */
  752. u16 sge_th_hi; /* valid iff BNX2X_Q_FLG_TPA */
  753. u16 pri_map;
  754. };
  755. /* general */
  756. struct bnx2x_general_setup_params {
  757. /* valid iff BNX2X_Q_FLG_STATS */
  758. u8 stat_id;
  759. u8 spcl_id;
  760. u16 mtu;
  761. u8 cos;
  762. };
  763. struct bnx2x_rxq_setup_params {
  764. /* dma */
  765. dma_addr_t dscr_map;
  766. dma_addr_t sge_map;
  767. dma_addr_t rcq_map;
  768. dma_addr_t rcq_np_map;
  769. u16 drop_flags;
  770. u16 buf_sz;
  771. u8 fw_sb_id;
  772. u8 cl_qzone_id;
  773. /* valid iff BNX2X_Q_FLG_TPA */
  774. u16 tpa_agg_sz;
  775. u16 sge_buf_sz;
  776. u8 max_sges_pkt;
  777. u8 max_tpa_queues;
  778. u8 rss_engine_id;
  779. /* valid iff BNX2X_Q_FLG_MCAST */
  780. u8 mcast_engine_id;
  781. u8 cache_line_log;
  782. u8 sb_cq_index;
  783. /* valid iff BXN2X_Q_FLG_SILENT_VLAN_REM */
  784. u16 silent_removal_value;
  785. u16 silent_removal_mask;
  786. };
  787. struct bnx2x_txq_setup_params {
  788. /* dma */
  789. dma_addr_t dscr_map;
  790. u8 fw_sb_id;
  791. u8 sb_cq_index;
  792. u8 cos; /* valid iff BNX2X_Q_FLG_COS */
  793. u16 traffic_type;
  794. /* equals to the leading rss client id, used for TX classification*/
  795. u8 tss_leading_cl_id;
  796. /* valid iff BNX2X_Q_FLG_DEF_VLAN */
  797. u16 default_vlan;
  798. };
  799. struct bnx2x_queue_setup_params {
  800. struct bnx2x_general_setup_params gen_params;
  801. struct bnx2x_txq_setup_params txq_params;
  802. struct bnx2x_rxq_setup_params rxq_params;
  803. struct rxq_pause_params pause_params;
  804. unsigned long flags;
  805. };
  806. struct bnx2x_queue_setup_tx_only_params {
  807. struct bnx2x_general_setup_params gen_params;
  808. struct bnx2x_txq_setup_params txq_params;
  809. unsigned long flags;
  810. /* index within the tx_only cids of this queue object */
  811. u8 cid_index;
  812. };
  813. struct bnx2x_queue_state_params {
  814. struct bnx2x_queue_sp_obj *q_obj;
  815. /* Current command */
  816. enum bnx2x_queue_cmd cmd;
  817. /* may have RAMROD_COMP_WAIT set only */
  818. unsigned long ramrod_flags;
  819. /* Params according to the current command */
  820. union {
  821. struct bnx2x_queue_update_params update;
  822. struct bnx2x_queue_setup_params setup;
  823. struct bnx2x_queue_init_params init;
  824. struct bnx2x_queue_setup_tx_only_params tx_only;
  825. struct bnx2x_queue_terminate_params terminate;
  826. struct bnx2x_queue_cfc_del_params cfc_del;
  827. } params;
  828. };
  829. struct bnx2x_viflist_params {
  830. u8 echo_res;
  831. u8 func_bit_map_res;
  832. };
  833. struct bnx2x_queue_sp_obj {
  834. u32 cids[BNX2X_MULTI_TX_COS];
  835. u8 cl_id;
  836. u8 func_id;
  837. /*
  838. * number of traffic classes supported by queue.
  839. * The primary connection of the queue suppotrs the first traffic
  840. * class. Any further traffic class is suppoted by a tx-only
  841. * connection.
  842. *
  843. * Therefore max_cos is also a number of valid entries in the cids
  844. * array.
  845. */
  846. u8 max_cos;
  847. u8 num_tx_only, next_tx_only;
  848. enum bnx2x_q_state state, next_state;
  849. /* bits from enum bnx2x_q_type */
  850. unsigned long type;
  851. /* BNX2X_Q_CMD_XX bits. This object implements "one
  852. * pending" paradigm but for debug and tracing purposes it's
  853. * more convinient to have different bits for different
  854. * commands.
  855. */
  856. unsigned long pending;
  857. /* Buffer to use as a ramrod data and its mapping */
  858. void *rdata;
  859. dma_addr_t rdata_mapping;
  860. /**
  861. * Performs one state change according to the given parameters.
  862. *
  863. * @return 0 in case of success and negative value otherwise.
  864. */
  865. int (*send_cmd)(struct bnx2x *bp,
  866. struct bnx2x_queue_state_params *params);
  867. /**
  868. * Sets the pending bit according to the requested transition.
  869. */
  870. int (*set_pending)(struct bnx2x_queue_sp_obj *o,
  871. struct bnx2x_queue_state_params *params);
  872. /**
  873. * Checks that the requested state transition is legal.
  874. */
  875. int (*check_transition)(struct bnx2x *bp,
  876. struct bnx2x_queue_sp_obj *o,
  877. struct bnx2x_queue_state_params *params);
  878. /**
  879. * Completes the pending command.
  880. */
  881. int (*complete_cmd)(struct bnx2x *bp,
  882. struct bnx2x_queue_sp_obj *o,
  883. enum bnx2x_queue_cmd);
  884. int (*wait_comp)(struct bnx2x *bp,
  885. struct bnx2x_queue_sp_obj *o,
  886. enum bnx2x_queue_cmd cmd);
  887. };
  888. /********************** Function state update *********************************/
  889. /* Allowed Function states */
  890. enum bnx2x_func_state {
  891. BNX2X_F_STATE_RESET,
  892. BNX2X_F_STATE_INITIALIZED,
  893. BNX2X_F_STATE_STARTED,
  894. BNX2X_F_STATE_TX_STOPPED,
  895. BNX2X_F_STATE_MAX,
  896. };
  897. /* Allowed Function commands */
  898. enum bnx2x_func_cmd {
  899. BNX2X_F_CMD_HW_INIT,
  900. BNX2X_F_CMD_START,
  901. BNX2X_F_CMD_STOP,
  902. BNX2X_F_CMD_HW_RESET,
  903. BNX2X_F_CMD_AFEX_UPDATE,
  904. BNX2X_F_CMD_AFEX_VIFLISTS,
  905. BNX2X_F_CMD_TX_STOP,
  906. BNX2X_F_CMD_TX_START,
  907. BNX2X_F_CMD_SWITCH_UPDATE,
  908. BNX2X_F_CMD_MAX,
  909. };
  910. struct bnx2x_func_hw_init_params {
  911. /* A load phase returned by MCP.
  912. *
  913. * May be:
  914. * FW_MSG_CODE_DRV_LOAD_COMMON_CHIP
  915. * FW_MSG_CODE_DRV_LOAD_COMMON
  916. * FW_MSG_CODE_DRV_LOAD_PORT
  917. * FW_MSG_CODE_DRV_LOAD_FUNCTION
  918. */
  919. u32 load_phase;
  920. };
  921. struct bnx2x_func_hw_reset_params {
  922. /* A load phase returned by MCP.
  923. *
  924. * May be:
  925. * FW_MSG_CODE_DRV_LOAD_COMMON_CHIP
  926. * FW_MSG_CODE_DRV_LOAD_COMMON
  927. * FW_MSG_CODE_DRV_LOAD_PORT
  928. * FW_MSG_CODE_DRV_LOAD_FUNCTION
  929. */
  930. u32 reset_phase;
  931. };
  932. struct bnx2x_func_start_params {
  933. /* Multi Function mode:
  934. * - Single Function
  935. * - Switch Dependent
  936. * - Switch Independent
  937. */
  938. u16 mf_mode;
  939. /* Switch Dependent mode outer VLAN tag */
  940. u16 sd_vlan_tag;
  941. /* Function cos mode */
  942. u8 network_cos_mode;
  943. };
  944. struct bnx2x_func_switch_update_params {
  945. u8 suspend;
  946. };
  947. struct bnx2x_func_afex_update_params {
  948. u16 vif_id;
  949. u16 afex_default_vlan;
  950. u8 allowed_priorities;
  951. };
  952. struct bnx2x_func_afex_viflists_params {
  953. u16 vif_list_index;
  954. u8 func_bit_map;
  955. u8 afex_vif_list_command;
  956. u8 func_to_clear;
  957. };
  958. struct bnx2x_func_tx_start_params {
  959. struct priority_cos traffic_type_to_priority_cos[MAX_TRAFFIC_TYPES];
  960. u8 dcb_enabled;
  961. u8 dcb_version;
  962. u8 dont_add_pri_0_en;
  963. };
  964. struct bnx2x_func_state_params {
  965. struct bnx2x_func_sp_obj *f_obj;
  966. /* Current command */
  967. enum bnx2x_func_cmd cmd;
  968. /* may have RAMROD_COMP_WAIT set only */
  969. unsigned long ramrod_flags;
  970. /* Params according to the current command */
  971. union {
  972. struct bnx2x_func_hw_init_params hw_init;
  973. struct bnx2x_func_hw_reset_params hw_reset;
  974. struct bnx2x_func_start_params start;
  975. struct bnx2x_func_switch_update_params switch_update;
  976. struct bnx2x_func_afex_update_params afex_update;
  977. struct bnx2x_func_afex_viflists_params afex_viflists;
  978. struct bnx2x_func_tx_start_params tx_start;
  979. } params;
  980. };
  981. struct bnx2x_func_sp_drv_ops {
  982. /* Init tool + runtime initialization:
  983. * - Common Chip
  984. * - Common (per Path)
  985. * - Port
  986. * - Function phases
  987. */
  988. int (*init_hw_cmn_chip)(struct bnx2x *bp);
  989. int (*init_hw_cmn)(struct bnx2x *bp);
  990. int (*init_hw_port)(struct bnx2x *bp);
  991. int (*init_hw_func)(struct bnx2x *bp);
  992. /* Reset Function HW: Common, Port, Function phases. */
  993. void (*reset_hw_cmn)(struct bnx2x *bp);
  994. void (*reset_hw_port)(struct bnx2x *bp);
  995. void (*reset_hw_func)(struct bnx2x *bp);
  996. /* Init/Free GUNZIP resources */
  997. int (*gunzip_init)(struct bnx2x *bp);
  998. void (*gunzip_end)(struct bnx2x *bp);
  999. /* Prepare/Release FW resources */
  1000. int (*init_fw)(struct bnx2x *bp);
  1001. void (*release_fw)(struct bnx2x *bp);
  1002. };
  1003. struct bnx2x_func_sp_obj {
  1004. enum bnx2x_func_state state, next_state;
  1005. /* BNX2X_FUNC_CMD_XX bits. This object implements "one
  1006. * pending" paradigm but for debug and tracing purposes it's
  1007. * more convinient to have different bits for different
  1008. * commands.
  1009. */
  1010. unsigned long pending;
  1011. /* Buffer to use as a ramrod data and its mapping */
  1012. void *rdata;
  1013. dma_addr_t rdata_mapping;
  1014. /* Buffer to use as a afex ramrod data and its mapping.
  1015. * This can't be same rdata as above because afex ramrod requests
  1016. * can arrive to the object in parallel to other ramrod requests.
  1017. */
  1018. void *afex_rdata;
  1019. dma_addr_t afex_rdata_mapping;
  1020. /* this mutex validates that when pending flag is taken, the next
  1021. * ramrod to be sent will be the one set the pending bit
  1022. */
  1023. struct mutex one_pending_mutex;
  1024. /* Driver interface */
  1025. struct bnx2x_func_sp_drv_ops *drv;
  1026. /**
  1027. * Performs one state change according to the given parameters.
  1028. *
  1029. * @return 0 in case of success and negative value otherwise.
  1030. */
  1031. int (*send_cmd)(struct bnx2x *bp,
  1032. struct bnx2x_func_state_params *params);
  1033. /**
  1034. * Checks that the requested state transition is legal.
  1035. */
  1036. int (*check_transition)(struct bnx2x *bp,
  1037. struct bnx2x_func_sp_obj *o,
  1038. struct bnx2x_func_state_params *params);
  1039. /**
  1040. * Completes the pending command.
  1041. */
  1042. int (*complete_cmd)(struct bnx2x *bp,
  1043. struct bnx2x_func_sp_obj *o,
  1044. enum bnx2x_func_cmd cmd);
  1045. int (*wait_comp)(struct bnx2x *bp, struct bnx2x_func_sp_obj *o,
  1046. enum bnx2x_func_cmd cmd);
  1047. };
  1048. /********************** Interfaces ********************************************/
  1049. /* Queueable objects set */
  1050. union bnx2x_qable_obj {
  1051. struct bnx2x_vlan_mac_obj vlan_mac;
  1052. };
  1053. /************** Function state update *********/
  1054. void bnx2x_init_func_obj(struct bnx2x *bp,
  1055. struct bnx2x_func_sp_obj *obj,
  1056. void *rdata, dma_addr_t rdata_mapping,
  1057. void *afex_rdata, dma_addr_t afex_rdata_mapping,
  1058. struct bnx2x_func_sp_drv_ops *drv_iface);
  1059. int bnx2x_func_state_change(struct bnx2x *bp,
  1060. struct bnx2x_func_state_params *params);
  1061. enum bnx2x_func_state bnx2x_func_get_state(struct bnx2x *bp,
  1062. struct bnx2x_func_sp_obj *o);
  1063. /******************* Queue State **************/
  1064. void bnx2x_init_queue_obj(struct bnx2x *bp,
  1065. struct bnx2x_queue_sp_obj *obj, u8 cl_id, u32 *cids,
  1066. u8 cid_cnt, u8 func_id, void *rdata,
  1067. dma_addr_t rdata_mapping, unsigned long type);
  1068. int bnx2x_queue_state_change(struct bnx2x *bp,
  1069. struct bnx2x_queue_state_params *params);
  1070. int bnx2x_get_q_logical_state(struct bnx2x *bp,
  1071. struct bnx2x_queue_sp_obj *obj);
  1072. /********************* VLAN-MAC ****************/
  1073. void bnx2x_init_mac_obj(struct bnx2x *bp,
  1074. struct bnx2x_vlan_mac_obj *mac_obj,
  1075. u8 cl_id, u32 cid, u8 func_id, void *rdata,
  1076. dma_addr_t rdata_mapping, int state,
  1077. unsigned long *pstate, bnx2x_obj_type type,
  1078. struct bnx2x_credit_pool_obj *macs_pool);
  1079. void bnx2x_init_vlan_obj(struct bnx2x *bp,
  1080. struct bnx2x_vlan_mac_obj *vlan_obj,
  1081. u8 cl_id, u32 cid, u8 func_id, void *rdata,
  1082. dma_addr_t rdata_mapping, int state,
  1083. unsigned long *pstate, bnx2x_obj_type type,
  1084. struct bnx2x_credit_pool_obj *vlans_pool);
  1085. void bnx2x_init_vlan_mac_obj(struct bnx2x *bp,
  1086. struct bnx2x_vlan_mac_obj *vlan_mac_obj,
  1087. u8 cl_id, u32 cid, u8 func_id, void *rdata,
  1088. dma_addr_t rdata_mapping, int state,
  1089. unsigned long *pstate, bnx2x_obj_type type,
  1090. struct bnx2x_credit_pool_obj *macs_pool,
  1091. struct bnx2x_credit_pool_obj *vlans_pool);
  1092. int bnx2x_config_vlan_mac(struct bnx2x *bp,
  1093. struct bnx2x_vlan_mac_ramrod_params *p);
  1094. int bnx2x_vlan_mac_move(struct bnx2x *bp,
  1095. struct bnx2x_vlan_mac_ramrod_params *p,
  1096. struct bnx2x_vlan_mac_obj *dest_o);
  1097. /********************* RX MODE ****************/
  1098. void bnx2x_init_rx_mode_obj(struct bnx2x *bp,
  1099. struct bnx2x_rx_mode_obj *o);
  1100. /**
  1101. * bnx2x_config_rx_mode - Send and RX_MODE ramrod according to the provided parameters.
  1102. *
  1103. * @p: Command parameters
  1104. *
  1105. * Return: 0 - if operation was successfull and there is no pending completions,
  1106. * positive number - if there are pending completions,
  1107. * negative - if there were errors
  1108. */
  1109. int bnx2x_config_rx_mode(struct bnx2x *bp,
  1110. struct bnx2x_rx_mode_ramrod_params *p);
  1111. /****************** MULTICASTS ****************/
  1112. void bnx2x_init_mcast_obj(struct bnx2x *bp,
  1113. struct bnx2x_mcast_obj *mcast_obj,
  1114. u8 mcast_cl_id, u32 mcast_cid, u8 func_id,
  1115. u8 engine_id, void *rdata, dma_addr_t rdata_mapping,
  1116. int state, unsigned long *pstate,
  1117. bnx2x_obj_type type);
  1118. /**
  1119. * bnx2x_config_mcast - Configure multicast MACs list.
  1120. *
  1121. * @cmd: command to execute: BNX2X_MCAST_CMD_X
  1122. *
  1123. * May configure a new list
  1124. * provided in p->mcast_list (BNX2X_MCAST_CMD_ADD), clean up
  1125. * (BNX2X_MCAST_CMD_DEL) or restore (BNX2X_MCAST_CMD_RESTORE) a current
  1126. * configuration, continue to execute the pending commands
  1127. * (BNX2X_MCAST_CMD_CONT).
  1128. *
  1129. * If previous command is still pending or if number of MACs to
  1130. * configure is more that maximum number of MACs in one command,
  1131. * the current command will be enqueued to the tail of the
  1132. * pending commands list.
  1133. *
  1134. * Return: 0 is operation was successfull and there are no pending completions,
  1135. * negative if there were errors, positive if there are pending
  1136. * completions.
  1137. */
  1138. int bnx2x_config_mcast(struct bnx2x *bp,
  1139. struct bnx2x_mcast_ramrod_params *p,
  1140. enum bnx2x_mcast_cmd cmd);
  1141. /****************** CREDIT POOL ****************/
  1142. void bnx2x_init_mac_credit_pool(struct bnx2x *bp,
  1143. struct bnx2x_credit_pool_obj *p, u8 func_id,
  1144. u8 func_num);
  1145. void bnx2x_init_vlan_credit_pool(struct bnx2x *bp,
  1146. struct bnx2x_credit_pool_obj *p, u8 func_id,
  1147. u8 func_num);
  1148. /****************** RSS CONFIGURATION ****************/
  1149. void bnx2x_init_rss_config_obj(struct bnx2x *bp,
  1150. struct bnx2x_rss_config_obj *rss_obj,
  1151. u8 cl_id, u32 cid, u8 func_id, u8 engine_id,
  1152. void *rdata, dma_addr_t rdata_mapping,
  1153. int state, unsigned long *pstate,
  1154. bnx2x_obj_type type);
  1155. /**
  1156. * bnx2x_config_rss - Updates RSS configuration according to provided parameters
  1157. *
  1158. * Return: 0 in case of success
  1159. */
  1160. int bnx2x_config_rss(struct bnx2x *bp,
  1161. struct bnx2x_config_rss_params *p);
  1162. /**
  1163. * bnx2x_get_rss_ind_table - Return the current ind_table configuration.
  1164. *
  1165. * @ind_table: buffer to fill with the current indirection
  1166. * table content. Should be at least
  1167. * T_ETH_INDIRECTION_TABLE_SIZE bytes long.
  1168. */
  1169. void bnx2x_get_rss_ind_table(struct bnx2x_rss_config_obj *rss_obj,
  1170. u8 *ind_table);
  1171. #endif /* BNX2X_SP_VERBS */