bnx2x_sp.h 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387
  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 Queue states */
  650. enum bnx2x_q_logical_state {
  651. BNX2X_Q_LOGICAL_STATE_ACTIVE,
  652. BNX2X_Q_LOGICAL_STATE_STOPPED,
  653. };
  654. /* Allowed commands */
  655. enum bnx2x_queue_cmd {
  656. BNX2X_Q_CMD_INIT,
  657. BNX2X_Q_CMD_SETUP,
  658. BNX2X_Q_CMD_SETUP_TX_ONLY,
  659. BNX2X_Q_CMD_DEACTIVATE,
  660. BNX2X_Q_CMD_ACTIVATE,
  661. BNX2X_Q_CMD_UPDATE,
  662. BNX2X_Q_CMD_UPDATE_TPA,
  663. BNX2X_Q_CMD_HALT,
  664. BNX2X_Q_CMD_CFC_DEL,
  665. BNX2X_Q_CMD_TERMINATE,
  666. BNX2X_Q_CMD_EMPTY,
  667. BNX2X_Q_CMD_MAX,
  668. };
  669. /* queue SETUP + INIT flags */
  670. enum {
  671. BNX2X_Q_FLG_TPA,
  672. BNX2X_Q_FLG_TPA_IPV6,
  673. BNX2X_Q_FLG_TPA_GRO,
  674. BNX2X_Q_FLG_STATS,
  675. BNX2X_Q_FLG_ZERO_STATS,
  676. BNX2X_Q_FLG_ACTIVE,
  677. BNX2X_Q_FLG_OV,
  678. BNX2X_Q_FLG_VLAN,
  679. BNX2X_Q_FLG_COS,
  680. BNX2X_Q_FLG_HC,
  681. BNX2X_Q_FLG_HC_EN,
  682. BNX2X_Q_FLG_DHC,
  683. BNX2X_Q_FLG_FCOE,
  684. BNX2X_Q_FLG_LEADING_RSS,
  685. BNX2X_Q_FLG_MCAST,
  686. BNX2X_Q_FLG_DEF_VLAN,
  687. BNX2X_Q_FLG_TX_SWITCH,
  688. BNX2X_Q_FLG_TX_SEC,
  689. BNX2X_Q_FLG_ANTI_SPOOF,
  690. BNX2X_Q_FLG_SILENT_VLAN_REM,
  691. BNX2X_Q_FLG_FORCE_DEFAULT_PRI
  692. };
  693. /* Queue type options: queue type may be a compination of below. */
  694. enum bnx2x_q_type {
  695. /** TODO: Consider moving both these flags into the init()
  696. * ramrod params.
  697. */
  698. BNX2X_Q_TYPE_HAS_RX,
  699. BNX2X_Q_TYPE_HAS_TX,
  700. };
  701. #define BNX2X_PRIMARY_CID_INDEX 0
  702. #define BNX2X_MULTI_TX_COS_E1X 3 /* QM only */
  703. #define BNX2X_MULTI_TX_COS_E2_E3A0 2
  704. #define BNX2X_MULTI_TX_COS_E3B0 3
  705. #define BNX2X_MULTI_TX_COS 3 /* Maximum possible */
  706. struct bnx2x_queue_init_params {
  707. struct {
  708. unsigned long flags;
  709. u16 hc_rate;
  710. u8 fw_sb_id;
  711. u8 sb_cq_index;
  712. } tx;
  713. struct {
  714. unsigned long flags;
  715. u16 hc_rate;
  716. u8 fw_sb_id;
  717. u8 sb_cq_index;
  718. } rx;
  719. /* CID context in the host memory */
  720. struct eth_context *cxts[BNX2X_MULTI_TX_COS];
  721. /* maximum number of cos supported by hardware */
  722. u8 max_cos;
  723. };
  724. struct bnx2x_queue_terminate_params {
  725. /* index within the tx_only cids of this queue object */
  726. u8 cid_index;
  727. };
  728. struct bnx2x_queue_cfc_del_params {
  729. /* index within the tx_only cids of this queue object */
  730. u8 cid_index;
  731. };
  732. struct bnx2x_queue_update_params {
  733. unsigned long update_flags; /* BNX2X_Q_UPDATE_XX bits */
  734. u16 def_vlan;
  735. u16 silent_removal_value;
  736. u16 silent_removal_mask;
  737. /* index within the tx_only cids of this queue object */
  738. u8 cid_index;
  739. };
  740. struct rxq_pause_params {
  741. u16 bd_th_lo;
  742. u16 bd_th_hi;
  743. u16 rcq_th_lo;
  744. u16 rcq_th_hi;
  745. u16 sge_th_lo; /* valid iff BNX2X_Q_FLG_TPA */
  746. u16 sge_th_hi; /* valid iff BNX2X_Q_FLG_TPA */
  747. u16 pri_map;
  748. };
  749. /* general */
  750. struct bnx2x_general_setup_params {
  751. /* valid iff BNX2X_Q_FLG_STATS */
  752. u8 stat_id;
  753. u8 spcl_id;
  754. u16 mtu;
  755. u8 cos;
  756. };
  757. struct bnx2x_rxq_setup_params {
  758. /* dma */
  759. dma_addr_t dscr_map;
  760. dma_addr_t sge_map;
  761. dma_addr_t rcq_map;
  762. dma_addr_t rcq_np_map;
  763. u16 drop_flags;
  764. u16 buf_sz;
  765. u8 fw_sb_id;
  766. u8 cl_qzone_id;
  767. /* valid iff BNX2X_Q_FLG_TPA */
  768. u16 tpa_agg_sz;
  769. u16 sge_buf_sz;
  770. u8 max_sges_pkt;
  771. u8 max_tpa_queues;
  772. u8 rss_engine_id;
  773. /* valid iff BNX2X_Q_FLG_MCAST */
  774. u8 mcast_engine_id;
  775. u8 cache_line_log;
  776. u8 sb_cq_index;
  777. /* valid iff BXN2X_Q_FLG_SILENT_VLAN_REM */
  778. u16 silent_removal_value;
  779. u16 silent_removal_mask;
  780. };
  781. struct bnx2x_txq_setup_params {
  782. /* dma */
  783. dma_addr_t dscr_map;
  784. u8 fw_sb_id;
  785. u8 sb_cq_index;
  786. u8 cos; /* valid iff BNX2X_Q_FLG_COS */
  787. u16 traffic_type;
  788. /* equals to the leading rss client id, used for TX classification*/
  789. u8 tss_leading_cl_id;
  790. /* valid iff BNX2X_Q_FLG_DEF_VLAN */
  791. u16 default_vlan;
  792. };
  793. struct bnx2x_queue_setup_params {
  794. struct bnx2x_general_setup_params gen_params;
  795. struct bnx2x_txq_setup_params txq_params;
  796. struct bnx2x_rxq_setup_params rxq_params;
  797. struct rxq_pause_params pause_params;
  798. unsigned long flags;
  799. };
  800. struct bnx2x_queue_setup_tx_only_params {
  801. struct bnx2x_general_setup_params gen_params;
  802. struct bnx2x_txq_setup_params txq_params;
  803. unsigned long flags;
  804. /* index within the tx_only cids of this queue object */
  805. u8 cid_index;
  806. };
  807. struct bnx2x_queue_state_params {
  808. struct bnx2x_queue_sp_obj *q_obj;
  809. /* Current command */
  810. enum bnx2x_queue_cmd cmd;
  811. /* may have RAMROD_COMP_WAIT set only */
  812. unsigned long ramrod_flags;
  813. /* Params according to the current command */
  814. union {
  815. struct bnx2x_queue_update_params update;
  816. struct bnx2x_queue_setup_params setup;
  817. struct bnx2x_queue_init_params init;
  818. struct bnx2x_queue_setup_tx_only_params tx_only;
  819. struct bnx2x_queue_terminate_params terminate;
  820. struct bnx2x_queue_cfc_del_params cfc_del;
  821. } params;
  822. };
  823. struct bnx2x_viflist_params {
  824. u8 echo_res;
  825. u8 func_bit_map_res;
  826. };
  827. struct bnx2x_queue_sp_obj {
  828. u32 cids[BNX2X_MULTI_TX_COS];
  829. u8 cl_id;
  830. u8 func_id;
  831. /*
  832. * number of traffic classes supported by queue.
  833. * The primary connection of the queue suppotrs the first traffic
  834. * class. Any further traffic class is suppoted by a tx-only
  835. * connection.
  836. *
  837. * Therefore max_cos is also a number of valid entries in the cids
  838. * array.
  839. */
  840. u8 max_cos;
  841. u8 num_tx_only, next_tx_only;
  842. enum bnx2x_q_state state, next_state;
  843. /* bits from enum bnx2x_q_type */
  844. unsigned long type;
  845. /* BNX2X_Q_CMD_XX bits. This object implements "one
  846. * pending" paradigm but for debug and tracing purposes it's
  847. * more convinient to have different bits for different
  848. * commands.
  849. */
  850. unsigned long pending;
  851. /* Buffer to use as a ramrod data and its mapping */
  852. void *rdata;
  853. dma_addr_t rdata_mapping;
  854. /**
  855. * Performs one state change according to the given parameters.
  856. *
  857. * @return 0 in case of success and negative value otherwise.
  858. */
  859. int (*send_cmd)(struct bnx2x *bp,
  860. struct bnx2x_queue_state_params *params);
  861. /**
  862. * Sets the pending bit according to the requested transition.
  863. */
  864. int (*set_pending)(struct bnx2x_queue_sp_obj *o,
  865. struct bnx2x_queue_state_params *params);
  866. /**
  867. * Checks that the requested state transition is legal.
  868. */
  869. int (*check_transition)(struct bnx2x *bp,
  870. struct bnx2x_queue_sp_obj *o,
  871. struct bnx2x_queue_state_params *params);
  872. /**
  873. * Completes the pending command.
  874. */
  875. int (*complete_cmd)(struct bnx2x *bp,
  876. struct bnx2x_queue_sp_obj *o,
  877. enum bnx2x_queue_cmd);
  878. int (*wait_comp)(struct bnx2x *bp,
  879. struct bnx2x_queue_sp_obj *o,
  880. enum bnx2x_queue_cmd cmd);
  881. };
  882. /********************** Function state update *********************************/
  883. /* Allowed Function states */
  884. enum bnx2x_func_state {
  885. BNX2X_F_STATE_RESET,
  886. BNX2X_F_STATE_INITIALIZED,
  887. BNX2X_F_STATE_STARTED,
  888. BNX2X_F_STATE_TX_STOPPED,
  889. BNX2X_F_STATE_MAX,
  890. };
  891. /* Allowed Function commands */
  892. enum bnx2x_func_cmd {
  893. BNX2X_F_CMD_HW_INIT,
  894. BNX2X_F_CMD_START,
  895. BNX2X_F_CMD_STOP,
  896. BNX2X_F_CMD_HW_RESET,
  897. BNX2X_F_CMD_AFEX_UPDATE,
  898. BNX2X_F_CMD_AFEX_VIFLISTS,
  899. BNX2X_F_CMD_TX_STOP,
  900. BNX2X_F_CMD_TX_START,
  901. BNX2X_F_CMD_SWITCH_UPDATE,
  902. BNX2X_F_CMD_MAX,
  903. };
  904. struct bnx2x_func_hw_init_params {
  905. /* A load phase returned by MCP.
  906. *
  907. * May be:
  908. * FW_MSG_CODE_DRV_LOAD_COMMON_CHIP
  909. * FW_MSG_CODE_DRV_LOAD_COMMON
  910. * FW_MSG_CODE_DRV_LOAD_PORT
  911. * FW_MSG_CODE_DRV_LOAD_FUNCTION
  912. */
  913. u32 load_phase;
  914. };
  915. struct bnx2x_func_hw_reset_params {
  916. /* A load phase returned by MCP.
  917. *
  918. * May be:
  919. * FW_MSG_CODE_DRV_LOAD_COMMON_CHIP
  920. * FW_MSG_CODE_DRV_LOAD_COMMON
  921. * FW_MSG_CODE_DRV_LOAD_PORT
  922. * FW_MSG_CODE_DRV_LOAD_FUNCTION
  923. */
  924. u32 reset_phase;
  925. };
  926. struct bnx2x_func_start_params {
  927. /* Multi Function mode:
  928. * - Single Function
  929. * - Switch Dependent
  930. * - Switch Independent
  931. */
  932. u16 mf_mode;
  933. /* Switch Dependent mode outer VLAN tag */
  934. u16 sd_vlan_tag;
  935. /* Function cos mode */
  936. u8 network_cos_mode;
  937. };
  938. struct bnx2x_func_switch_update_params {
  939. u8 suspend;
  940. };
  941. struct bnx2x_func_afex_update_params {
  942. u16 vif_id;
  943. u16 afex_default_vlan;
  944. u8 allowed_priorities;
  945. };
  946. struct bnx2x_func_afex_viflists_params {
  947. u16 vif_list_index;
  948. u8 func_bit_map;
  949. u8 afex_vif_list_command;
  950. u8 func_to_clear;
  951. };
  952. struct bnx2x_func_tx_start_params {
  953. struct priority_cos traffic_type_to_priority_cos[MAX_TRAFFIC_TYPES];
  954. u8 dcb_enabled;
  955. u8 dcb_version;
  956. u8 dont_add_pri_0_en;
  957. };
  958. struct bnx2x_func_state_params {
  959. struct bnx2x_func_sp_obj *f_obj;
  960. /* Current command */
  961. enum bnx2x_func_cmd cmd;
  962. /* may have RAMROD_COMP_WAIT set only */
  963. unsigned long ramrod_flags;
  964. /* Params according to the current command */
  965. union {
  966. struct bnx2x_func_hw_init_params hw_init;
  967. struct bnx2x_func_hw_reset_params hw_reset;
  968. struct bnx2x_func_start_params start;
  969. struct bnx2x_func_switch_update_params switch_update;
  970. struct bnx2x_func_afex_update_params afex_update;
  971. struct bnx2x_func_afex_viflists_params afex_viflists;
  972. struct bnx2x_func_tx_start_params tx_start;
  973. } params;
  974. };
  975. struct bnx2x_func_sp_drv_ops {
  976. /* Init tool + runtime initialization:
  977. * - Common Chip
  978. * - Common (per Path)
  979. * - Port
  980. * - Function phases
  981. */
  982. int (*init_hw_cmn_chip)(struct bnx2x *bp);
  983. int (*init_hw_cmn)(struct bnx2x *bp);
  984. int (*init_hw_port)(struct bnx2x *bp);
  985. int (*init_hw_func)(struct bnx2x *bp);
  986. /* Reset Function HW: Common, Port, Function phases. */
  987. void (*reset_hw_cmn)(struct bnx2x *bp);
  988. void (*reset_hw_port)(struct bnx2x *bp);
  989. void (*reset_hw_func)(struct bnx2x *bp);
  990. /* Init/Free GUNZIP resources */
  991. int (*gunzip_init)(struct bnx2x *bp);
  992. void (*gunzip_end)(struct bnx2x *bp);
  993. /* Prepare/Release FW resources */
  994. int (*init_fw)(struct bnx2x *bp);
  995. void (*release_fw)(struct bnx2x *bp);
  996. };
  997. struct bnx2x_func_sp_obj {
  998. enum bnx2x_func_state state, next_state;
  999. /* BNX2X_FUNC_CMD_XX bits. This object implements "one
  1000. * pending" paradigm but for debug and tracing purposes it's
  1001. * more convinient to have different bits for different
  1002. * commands.
  1003. */
  1004. unsigned long pending;
  1005. /* Buffer to use as a ramrod data and its mapping */
  1006. void *rdata;
  1007. dma_addr_t rdata_mapping;
  1008. /* Buffer to use as a afex ramrod data and its mapping.
  1009. * This can't be same rdata as above because afex ramrod requests
  1010. * can arrive to the object in parallel to other ramrod requests.
  1011. */
  1012. void *afex_rdata;
  1013. dma_addr_t afex_rdata_mapping;
  1014. /* this mutex validates that when pending flag is taken, the next
  1015. * ramrod to be sent will be the one set the pending bit
  1016. */
  1017. struct mutex one_pending_mutex;
  1018. /* Driver interface */
  1019. struct bnx2x_func_sp_drv_ops *drv;
  1020. /**
  1021. * Performs one state change according to the given parameters.
  1022. *
  1023. * @return 0 in case of success and negative value otherwise.
  1024. */
  1025. int (*send_cmd)(struct bnx2x *bp,
  1026. struct bnx2x_func_state_params *params);
  1027. /**
  1028. * Checks that the requested state transition is legal.
  1029. */
  1030. int (*check_transition)(struct bnx2x *bp,
  1031. struct bnx2x_func_sp_obj *o,
  1032. struct bnx2x_func_state_params *params);
  1033. /**
  1034. * Completes the pending command.
  1035. */
  1036. int (*complete_cmd)(struct bnx2x *bp,
  1037. struct bnx2x_func_sp_obj *o,
  1038. enum bnx2x_func_cmd cmd);
  1039. int (*wait_comp)(struct bnx2x *bp, struct bnx2x_func_sp_obj *o,
  1040. enum bnx2x_func_cmd cmd);
  1041. };
  1042. /********************** Interfaces ********************************************/
  1043. /* Queueable objects set */
  1044. union bnx2x_qable_obj {
  1045. struct bnx2x_vlan_mac_obj vlan_mac;
  1046. };
  1047. /************** Function state update *********/
  1048. void bnx2x_init_func_obj(struct bnx2x *bp,
  1049. struct bnx2x_func_sp_obj *obj,
  1050. void *rdata, dma_addr_t rdata_mapping,
  1051. void *afex_rdata, dma_addr_t afex_rdata_mapping,
  1052. struct bnx2x_func_sp_drv_ops *drv_iface);
  1053. int bnx2x_func_state_change(struct bnx2x *bp,
  1054. struct bnx2x_func_state_params *params);
  1055. enum bnx2x_func_state bnx2x_func_get_state(struct bnx2x *bp,
  1056. struct bnx2x_func_sp_obj *o);
  1057. /******************* Queue State **************/
  1058. void bnx2x_init_queue_obj(struct bnx2x *bp,
  1059. struct bnx2x_queue_sp_obj *obj, u8 cl_id, u32 *cids,
  1060. u8 cid_cnt, u8 func_id, void *rdata,
  1061. dma_addr_t rdata_mapping, unsigned long type);
  1062. int bnx2x_queue_state_change(struct bnx2x *bp,
  1063. struct bnx2x_queue_state_params *params);
  1064. int bnx2x_get_q_logical_state(struct bnx2x *bp,
  1065. struct bnx2x_queue_sp_obj *obj);
  1066. /********************* VLAN-MAC ****************/
  1067. void bnx2x_init_mac_obj(struct bnx2x *bp,
  1068. struct bnx2x_vlan_mac_obj *mac_obj,
  1069. u8 cl_id, u32 cid, u8 func_id, void *rdata,
  1070. dma_addr_t rdata_mapping, int state,
  1071. unsigned long *pstate, bnx2x_obj_type type,
  1072. struct bnx2x_credit_pool_obj *macs_pool);
  1073. void bnx2x_init_vlan_obj(struct bnx2x *bp,
  1074. struct bnx2x_vlan_mac_obj *vlan_obj,
  1075. u8 cl_id, u32 cid, u8 func_id, void *rdata,
  1076. dma_addr_t rdata_mapping, int state,
  1077. unsigned long *pstate, bnx2x_obj_type type,
  1078. struct bnx2x_credit_pool_obj *vlans_pool);
  1079. void bnx2x_init_vlan_mac_obj(struct bnx2x *bp,
  1080. struct bnx2x_vlan_mac_obj *vlan_mac_obj,
  1081. u8 cl_id, u32 cid, u8 func_id, void *rdata,
  1082. dma_addr_t rdata_mapping, int state,
  1083. unsigned long *pstate, bnx2x_obj_type type,
  1084. struct bnx2x_credit_pool_obj *macs_pool,
  1085. struct bnx2x_credit_pool_obj *vlans_pool);
  1086. int bnx2x_config_vlan_mac(struct bnx2x *bp,
  1087. struct bnx2x_vlan_mac_ramrod_params *p);
  1088. int bnx2x_vlan_mac_move(struct bnx2x *bp,
  1089. struct bnx2x_vlan_mac_ramrod_params *p,
  1090. struct bnx2x_vlan_mac_obj *dest_o);
  1091. /********************* RX MODE ****************/
  1092. void bnx2x_init_rx_mode_obj(struct bnx2x *bp,
  1093. struct bnx2x_rx_mode_obj *o);
  1094. /**
  1095. * bnx2x_config_rx_mode - Send and RX_MODE ramrod according to the provided parameters.
  1096. *
  1097. * @p: Command parameters
  1098. *
  1099. * Return: 0 - if operation was successfull and there is no pending completions,
  1100. * positive number - if there are pending completions,
  1101. * negative - if there were errors
  1102. */
  1103. int bnx2x_config_rx_mode(struct bnx2x *bp,
  1104. struct bnx2x_rx_mode_ramrod_params *p);
  1105. /****************** MULTICASTS ****************/
  1106. void bnx2x_init_mcast_obj(struct bnx2x *bp,
  1107. struct bnx2x_mcast_obj *mcast_obj,
  1108. u8 mcast_cl_id, u32 mcast_cid, u8 func_id,
  1109. u8 engine_id, void *rdata, dma_addr_t rdata_mapping,
  1110. int state, unsigned long *pstate,
  1111. bnx2x_obj_type type);
  1112. /**
  1113. * bnx2x_config_mcast - Configure multicast MACs list.
  1114. *
  1115. * @cmd: command to execute: BNX2X_MCAST_CMD_X
  1116. *
  1117. * May configure a new list
  1118. * provided in p->mcast_list (BNX2X_MCAST_CMD_ADD), clean up
  1119. * (BNX2X_MCAST_CMD_DEL) or restore (BNX2X_MCAST_CMD_RESTORE) a current
  1120. * configuration, continue to execute the pending commands
  1121. * (BNX2X_MCAST_CMD_CONT).
  1122. *
  1123. * If previous command is still pending or if number of MACs to
  1124. * configure is more that maximum number of MACs in one command,
  1125. * the current command will be enqueued to the tail of the
  1126. * pending commands list.
  1127. *
  1128. * Return: 0 is operation was successfull and there are no pending completions,
  1129. * negative if there were errors, positive if there are pending
  1130. * completions.
  1131. */
  1132. int bnx2x_config_mcast(struct bnx2x *bp,
  1133. struct bnx2x_mcast_ramrod_params *p, int cmd);
  1134. /****************** CREDIT POOL ****************/
  1135. void bnx2x_init_mac_credit_pool(struct bnx2x *bp,
  1136. struct bnx2x_credit_pool_obj *p, u8 func_id,
  1137. u8 func_num);
  1138. void bnx2x_init_vlan_credit_pool(struct bnx2x *bp,
  1139. struct bnx2x_credit_pool_obj *p, u8 func_id,
  1140. u8 func_num);
  1141. /****************** RSS CONFIGURATION ****************/
  1142. void bnx2x_init_rss_config_obj(struct bnx2x *bp,
  1143. struct bnx2x_rss_config_obj *rss_obj,
  1144. u8 cl_id, u32 cid, u8 func_id, u8 engine_id,
  1145. void *rdata, dma_addr_t rdata_mapping,
  1146. int state, unsigned long *pstate,
  1147. bnx2x_obj_type type);
  1148. /**
  1149. * bnx2x_config_rss - Updates RSS configuration according to provided parameters
  1150. *
  1151. * Return: 0 in case of success
  1152. */
  1153. int bnx2x_config_rss(struct bnx2x *bp,
  1154. struct bnx2x_config_rss_params *p);
  1155. /**
  1156. * bnx2x_get_rss_ind_table - Return the current ind_table configuration.
  1157. *
  1158. * @ind_table: buffer to fill with the current indirection
  1159. * table content. Should be at least
  1160. * T_ETH_INDIRECTION_TABLE_SIZE bytes long.
  1161. */
  1162. void bnx2x_get_rss_ind_table(struct bnx2x_rss_config_obj *rss_obj,
  1163. u8 *ind_table);
  1164. #endif /* BNX2X_SP_VERBS */