bnx2x_sp.h 36 KB

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