bnx2x_sp.h 35 KB

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