bnx2x_sp.h 33 KB

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