bnx2x_sp.h 36 KB

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