bnx2x_sp.h 33 KB

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