bnx2x_sp.h 33 KB

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