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