bnx2x_sp.h 35 KB

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