bnx2x_sp.h 35 KB

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