ixgbe_lib.c 32 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157
  1. /*******************************************************************************
  2. Intel 10 Gigabit PCI Express Linux driver
  3. Copyright(c) 1999 - 2012 Intel Corporation.
  4. This program is free software; you can redistribute it and/or modify it
  5. under the terms and conditions of the GNU General Public License,
  6. version 2, as published by the Free Software Foundation.
  7. This program is distributed in the hope it will be useful, but WITHOUT
  8. ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  9. FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  10. more details.
  11. You should have received a copy of the GNU General Public License along with
  12. this program; if not, write to the Free Software Foundation, Inc.,
  13. 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
  14. The full GNU General Public License is included in this distribution in
  15. the file called "COPYING".
  16. Contact Information:
  17. e1000-devel Mailing List <e1000-devel@lists.sourceforge.net>
  18. Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
  19. *******************************************************************************/
  20. #include "ixgbe.h"
  21. #include "ixgbe_sriov.h"
  22. #ifdef CONFIG_IXGBE_DCB
  23. /**
  24. * ixgbe_cache_ring_dcb_sriov - Descriptor ring to register mapping for SR-IOV
  25. * @adapter: board private structure to initialize
  26. *
  27. * Cache the descriptor ring offsets for SR-IOV to the assigned rings. It
  28. * will also try to cache the proper offsets if RSS/FCoE are enabled along
  29. * with VMDq.
  30. *
  31. **/
  32. static bool ixgbe_cache_ring_dcb_sriov(struct ixgbe_adapter *adapter)
  33. {
  34. #ifdef IXGBE_FCOE
  35. struct ixgbe_ring_feature *fcoe = &adapter->ring_feature[RING_F_FCOE];
  36. #endif /* IXGBE_FCOE */
  37. struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ];
  38. int i;
  39. u16 reg_idx;
  40. u8 tcs = netdev_get_num_tc(adapter->netdev);
  41. /* verify we have DCB queueing enabled before proceeding */
  42. if (tcs <= 1)
  43. return false;
  44. /* verify we have VMDq enabled before proceeding */
  45. if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
  46. return false;
  47. /* start at VMDq register offset for SR-IOV enabled setups */
  48. reg_idx = vmdq->offset * __ALIGN_MASK(1, ~vmdq->mask);
  49. for (i = 0; i < adapter->num_rx_queues; i++, reg_idx++) {
  50. /* If we are greater than indices move to next pool */
  51. if ((reg_idx & ~vmdq->mask) >= tcs)
  52. reg_idx = __ALIGN_MASK(reg_idx, ~vmdq->mask);
  53. adapter->rx_ring[i]->reg_idx = reg_idx;
  54. }
  55. reg_idx = vmdq->offset * __ALIGN_MASK(1, ~vmdq->mask);
  56. for (i = 0; i < adapter->num_tx_queues; i++, reg_idx++) {
  57. /* If we are greater than indices move to next pool */
  58. if ((reg_idx & ~vmdq->mask) >= tcs)
  59. reg_idx = __ALIGN_MASK(reg_idx, ~vmdq->mask);
  60. adapter->tx_ring[i]->reg_idx = reg_idx;
  61. }
  62. #ifdef IXGBE_FCOE
  63. /* nothing to do if FCoE is disabled */
  64. if (!(adapter->flags & IXGBE_FLAG_FCOE_ENABLED))
  65. return true;
  66. /* The work is already done if the FCoE ring is shared */
  67. if (fcoe->offset < tcs)
  68. return true;
  69. /* The FCoE rings exist separately, we need to move their reg_idx */
  70. if (fcoe->indices) {
  71. u16 queues_per_pool = __ALIGN_MASK(1, ~vmdq->mask);
  72. u8 fcoe_tc = ixgbe_fcoe_get_tc(adapter);
  73. reg_idx = (vmdq->offset + vmdq->indices) * queues_per_pool;
  74. for (i = fcoe->offset; i < adapter->num_rx_queues; i++) {
  75. reg_idx = __ALIGN_MASK(reg_idx, ~vmdq->mask) + fcoe_tc;
  76. adapter->rx_ring[i]->reg_idx = reg_idx;
  77. reg_idx++;
  78. }
  79. reg_idx = (vmdq->offset + vmdq->indices) * queues_per_pool;
  80. for (i = fcoe->offset; i < adapter->num_tx_queues; i++) {
  81. reg_idx = __ALIGN_MASK(reg_idx, ~vmdq->mask) + fcoe_tc;
  82. adapter->tx_ring[i]->reg_idx = reg_idx;
  83. reg_idx++;
  84. }
  85. }
  86. #endif /* IXGBE_FCOE */
  87. return true;
  88. }
  89. /* ixgbe_get_first_reg_idx - Return first register index associated with ring */
  90. static void ixgbe_get_first_reg_idx(struct ixgbe_adapter *adapter, u8 tc,
  91. unsigned int *tx, unsigned int *rx)
  92. {
  93. struct net_device *dev = adapter->netdev;
  94. struct ixgbe_hw *hw = &adapter->hw;
  95. u8 num_tcs = netdev_get_num_tc(dev);
  96. *tx = 0;
  97. *rx = 0;
  98. switch (hw->mac.type) {
  99. case ixgbe_mac_82598EB:
  100. /* TxQs/TC: 4 RxQs/TC: 8 */
  101. *tx = tc << 2; /* 0, 4, 8, 12, 16, 20, 24, 28 */
  102. *rx = tc << 3; /* 0, 8, 16, 24, 32, 40, 48, 56 */
  103. break;
  104. case ixgbe_mac_82599EB:
  105. case ixgbe_mac_X540:
  106. if (num_tcs > 4) {
  107. /*
  108. * TCs : TC0/1 TC2/3 TC4-7
  109. * TxQs/TC: 32 16 8
  110. * RxQs/TC: 16 16 16
  111. */
  112. *rx = tc << 4;
  113. if (tc < 3)
  114. *tx = tc << 5; /* 0, 32, 64 */
  115. else if (tc < 5)
  116. *tx = (tc + 2) << 4; /* 80, 96 */
  117. else
  118. *tx = (tc + 8) << 3; /* 104, 112, 120 */
  119. } else {
  120. /*
  121. * TCs : TC0 TC1 TC2/3
  122. * TxQs/TC: 64 32 16
  123. * RxQs/TC: 32 32 32
  124. */
  125. *rx = tc << 5;
  126. if (tc < 2)
  127. *tx = tc << 6; /* 0, 64 */
  128. else
  129. *tx = (tc + 4) << 4; /* 96, 112 */
  130. }
  131. default:
  132. break;
  133. }
  134. }
  135. /**
  136. * ixgbe_cache_ring_dcb - Descriptor ring to register mapping for DCB
  137. * @adapter: board private structure to initialize
  138. *
  139. * Cache the descriptor ring offsets for DCB to the assigned rings.
  140. *
  141. **/
  142. static bool ixgbe_cache_ring_dcb(struct ixgbe_adapter *adapter)
  143. {
  144. struct net_device *dev = adapter->netdev;
  145. unsigned int tx_idx, rx_idx;
  146. int tc, offset, rss_i, i;
  147. u8 num_tcs = netdev_get_num_tc(dev);
  148. /* verify we have DCB queueing enabled before proceeding */
  149. if (num_tcs <= 1)
  150. return false;
  151. rss_i = adapter->ring_feature[RING_F_RSS].indices;
  152. for (tc = 0, offset = 0; tc < num_tcs; tc++, offset += rss_i) {
  153. ixgbe_get_first_reg_idx(adapter, tc, &tx_idx, &rx_idx);
  154. for (i = 0; i < rss_i; i++, tx_idx++, rx_idx++) {
  155. adapter->tx_ring[offset + i]->reg_idx = tx_idx;
  156. adapter->rx_ring[offset + i]->reg_idx = rx_idx;
  157. adapter->tx_ring[offset + i]->dcb_tc = tc;
  158. adapter->rx_ring[offset + i]->dcb_tc = tc;
  159. }
  160. }
  161. return true;
  162. }
  163. #endif
  164. /**
  165. * ixgbe_cache_ring_sriov - Descriptor ring to register mapping for sriov
  166. * @adapter: board private structure to initialize
  167. *
  168. * SR-IOV doesn't use any descriptor rings but changes the default if
  169. * no other mapping is used.
  170. *
  171. */
  172. static bool ixgbe_cache_ring_sriov(struct ixgbe_adapter *adapter)
  173. {
  174. #ifdef IXGBE_FCOE
  175. struct ixgbe_ring_feature *fcoe = &adapter->ring_feature[RING_F_FCOE];
  176. #endif /* IXGBE_FCOE */
  177. struct ixgbe_ring_feature *vmdq = &adapter->ring_feature[RING_F_VMDQ];
  178. struct ixgbe_ring_feature *rss = &adapter->ring_feature[RING_F_RSS];
  179. int i;
  180. u16 reg_idx;
  181. /* only proceed if VMDq is enabled */
  182. if (!(adapter->flags & IXGBE_FLAG_VMDQ_ENABLED))
  183. return false;
  184. /* start at VMDq register offset for SR-IOV enabled setups */
  185. reg_idx = vmdq->offset * __ALIGN_MASK(1, ~vmdq->mask);
  186. for (i = 0; i < adapter->num_rx_queues; i++, reg_idx++) {
  187. #ifdef IXGBE_FCOE
  188. /* Allow first FCoE queue to be mapped as RSS */
  189. if (fcoe->offset && (i > fcoe->offset))
  190. break;
  191. #endif
  192. /* If we are greater than indices move to next pool */
  193. if ((reg_idx & ~vmdq->mask) >= rss->indices)
  194. reg_idx = __ALIGN_MASK(reg_idx, ~vmdq->mask);
  195. adapter->rx_ring[i]->reg_idx = reg_idx;
  196. }
  197. #ifdef IXGBE_FCOE
  198. /* FCoE uses a linear block of queues so just assigning 1:1 */
  199. for (; i < adapter->num_rx_queues; i++, reg_idx++)
  200. adapter->rx_ring[i]->reg_idx = reg_idx;
  201. #endif
  202. reg_idx = vmdq->offset * __ALIGN_MASK(1, ~vmdq->mask);
  203. for (i = 0; i < adapter->num_tx_queues; i++, reg_idx++) {
  204. #ifdef IXGBE_FCOE
  205. /* Allow first FCoE queue to be mapped as RSS */
  206. if (fcoe->offset && (i > fcoe->offset))
  207. break;
  208. #endif
  209. /* If we are greater than indices move to next pool */
  210. if ((reg_idx & rss->mask) >= rss->indices)
  211. reg_idx = __ALIGN_MASK(reg_idx, ~vmdq->mask);
  212. adapter->tx_ring[i]->reg_idx = reg_idx;
  213. }
  214. #ifdef IXGBE_FCOE
  215. /* FCoE uses a linear block of queues so just assigning 1:1 */
  216. for (; i < adapter->num_tx_queues; i++, reg_idx++)
  217. adapter->tx_ring[i]->reg_idx = reg_idx;
  218. #endif
  219. return true;
  220. }
  221. /**
  222. * ixgbe_cache_ring_rss - Descriptor ring to register mapping for RSS
  223. * @adapter: board private structure to initialize
  224. *
  225. * Cache the descriptor ring offsets for RSS to the assigned rings.
  226. *
  227. **/
  228. static bool ixgbe_cache_ring_rss(struct ixgbe_adapter *adapter)
  229. {
  230. int i;
  231. for (i = 0; i < adapter->num_rx_queues; i++)
  232. adapter->rx_ring[i]->reg_idx = i;
  233. for (i = 0; i < adapter->num_tx_queues; i++)
  234. adapter->tx_ring[i]->reg_idx = i;
  235. return true;
  236. }
  237. /**
  238. * ixgbe_cache_ring_register - Descriptor ring to register mapping
  239. * @adapter: board private structure to initialize
  240. *
  241. * Once we know the feature-set enabled for the device, we'll cache
  242. * the register offset the descriptor ring is assigned to.
  243. *
  244. * Note, the order the various feature calls is important. It must start with
  245. * the "most" features enabled at the same time, then trickle down to the
  246. * least amount of features turned on at once.
  247. **/
  248. static void ixgbe_cache_ring_register(struct ixgbe_adapter *adapter)
  249. {
  250. /* start with default case */
  251. adapter->rx_ring[0]->reg_idx = 0;
  252. adapter->tx_ring[0]->reg_idx = 0;
  253. #ifdef CONFIG_IXGBE_DCB
  254. if (ixgbe_cache_ring_dcb_sriov(adapter))
  255. return;
  256. if (ixgbe_cache_ring_dcb(adapter))
  257. return;
  258. #endif
  259. if (ixgbe_cache_ring_sriov(adapter))
  260. return;
  261. ixgbe_cache_ring_rss(adapter);
  262. }
  263. #define IXGBE_RSS_16Q_MASK 0xF
  264. #define IXGBE_RSS_8Q_MASK 0x7
  265. #define IXGBE_RSS_4Q_MASK 0x3
  266. #define IXGBE_RSS_2Q_MASK 0x1
  267. #define IXGBE_RSS_DISABLED_MASK 0x0
  268. #ifdef CONFIG_IXGBE_DCB
  269. /**
  270. * ixgbe_set_dcb_sriov_queues: Allocate queues for SR-IOV devices w/ DCB
  271. * @adapter: board private structure to initialize
  272. *
  273. * When SR-IOV (Single Root IO Virtualiztion) is enabled, allocate queues
  274. * and VM pools where appropriate. Also assign queues based on DCB
  275. * priorities and map accordingly..
  276. *
  277. **/
  278. static bool ixgbe_set_dcb_sriov_queues(struct ixgbe_adapter *adapter)
  279. {
  280. int i;
  281. u16 vmdq_i = adapter->ring_feature[RING_F_VMDQ].limit;
  282. u16 vmdq_m = 0;
  283. #ifdef IXGBE_FCOE
  284. u16 fcoe_i = 0;
  285. #endif
  286. u8 tcs = netdev_get_num_tc(adapter->netdev);
  287. /* verify we have DCB queueing enabled before proceeding */
  288. if (tcs <= 1)
  289. return false;
  290. /* verify we have VMDq enabled before proceeding */
  291. if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
  292. return false;
  293. /* Add starting offset to total pool count */
  294. vmdq_i += adapter->ring_feature[RING_F_VMDQ].offset;
  295. /* 16 pools w/ 8 TC per pool */
  296. if (tcs > 4) {
  297. vmdq_i = min_t(u16, vmdq_i, 16);
  298. vmdq_m = IXGBE_82599_VMDQ_8Q_MASK;
  299. /* 32 pools w/ 4 TC per pool */
  300. } else {
  301. vmdq_i = min_t(u16, vmdq_i, 32);
  302. vmdq_m = IXGBE_82599_VMDQ_4Q_MASK;
  303. }
  304. #ifdef IXGBE_FCOE
  305. /* queues in the remaining pools are available for FCoE */
  306. fcoe_i = (128 / __ALIGN_MASK(1, ~vmdq_m)) - vmdq_i;
  307. #endif
  308. /* remove the starting offset from the pool count */
  309. vmdq_i -= adapter->ring_feature[RING_F_VMDQ].offset;
  310. /* save features for later use */
  311. adapter->ring_feature[RING_F_VMDQ].indices = vmdq_i;
  312. adapter->ring_feature[RING_F_VMDQ].mask = vmdq_m;
  313. /*
  314. * We do not support DCB, VMDq, and RSS all simultaneously
  315. * so we will disable RSS since it is the lowest priority
  316. */
  317. adapter->ring_feature[RING_F_RSS].indices = 1;
  318. adapter->ring_feature[RING_F_RSS].mask = IXGBE_RSS_DISABLED_MASK;
  319. adapter->num_rx_pools = vmdq_i;
  320. adapter->num_rx_queues_per_pool = tcs;
  321. adapter->num_tx_queues = vmdq_i * tcs;
  322. adapter->num_rx_queues = vmdq_i * tcs;
  323. #ifdef IXGBE_FCOE
  324. if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) {
  325. struct ixgbe_ring_feature *fcoe;
  326. fcoe = &adapter->ring_feature[RING_F_FCOE];
  327. /* limit ourselves based on feature limits */
  328. fcoe_i = min_t(u16, fcoe_i, num_online_cpus());
  329. fcoe_i = min_t(u16, fcoe_i, fcoe->limit);
  330. if (fcoe_i) {
  331. /* alloc queues for FCoE separately */
  332. fcoe->indices = fcoe_i;
  333. fcoe->offset = vmdq_i * tcs;
  334. /* add queues to adapter */
  335. adapter->num_tx_queues += fcoe_i;
  336. adapter->num_rx_queues += fcoe_i;
  337. } else if (tcs > 1) {
  338. /* use queue belonging to FcoE TC */
  339. fcoe->indices = 1;
  340. fcoe->offset = ixgbe_fcoe_get_tc(adapter);
  341. } else {
  342. adapter->flags &= ~IXGBE_FLAG_FCOE_ENABLED;
  343. fcoe->indices = 0;
  344. fcoe->offset = 0;
  345. }
  346. }
  347. #endif /* IXGBE_FCOE */
  348. /* configure TC to queue mapping */
  349. for (i = 0; i < tcs; i++)
  350. netdev_set_tc_queue(adapter->netdev, i, 1, i);
  351. return true;
  352. }
  353. static bool ixgbe_set_dcb_queues(struct ixgbe_adapter *adapter)
  354. {
  355. struct net_device *dev = adapter->netdev;
  356. struct ixgbe_ring_feature *f;
  357. int rss_i, rss_m, i;
  358. int tcs;
  359. /* Map queue offset and counts onto allocated tx queues */
  360. tcs = netdev_get_num_tc(dev);
  361. /* verify we have DCB queueing enabled before proceeding */
  362. if (tcs <= 1)
  363. return false;
  364. /* determine the upper limit for our current DCB mode */
  365. rss_i = dev->num_tx_queues / tcs;
  366. if (adapter->hw.mac.type == ixgbe_mac_82598EB) {
  367. /* 8 TC w/ 4 queues per TC */
  368. rss_i = min_t(u16, rss_i, 4);
  369. rss_m = IXGBE_RSS_4Q_MASK;
  370. } else if (tcs > 4) {
  371. /* 8 TC w/ 8 queues per TC */
  372. rss_i = min_t(u16, rss_i, 8);
  373. rss_m = IXGBE_RSS_8Q_MASK;
  374. } else {
  375. /* 4 TC w/ 16 queues per TC */
  376. rss_i = min_t(u16, rss_i, 16);
  377. rss_m = IXGBE_RSS_16Q_MASK;
  378. }
  379. /* set RSS mask and indices */
  380. f = &adapter->ring_feature[RING_F_RSS];
  381. rss_i = min_t(int, rss_i, f->limit);
  382. f->indices = rss_i;
  383. f->mask = rss_m;
  384. #ifdef IXGBE_FCOE
  385. /* FCoE enabled queues require special configuration indexed
  386. * by feature specific indices and offset. Here we map FCoE
  387. * indices onto the DCB queue pairs allowing FCoE to own
  388. * configuration later.
  389. */
  390. if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) {
  391. u8 tc = ixgbe_fcoe_get_tc(adapter);
  392. f = &adapter->ring_feature[RING_F_FCOE];
  393. f->indices = min_t(u16, rss_i, f->limit);
  394. f->offset = rss_i * tc;
  395. }
  396. #endif /* IXGBE_FCOE */
  397. for (i = 0; i < tcs; i++)
  398. netdev_set_tc_queue(dev, i, rss_i, rss_i * i);
  399. adapter->num_tx_queues = rss_i * tcs;
  400. adapter->num_rx_queues = rss_i * tcs;
  401. return true;
  402. }
  403. #endif
  404. /**
  405. * ixgbe_set_sriov_queues - Allocate queues for SR-IOV devices
  406. * @adapter: board private structure to initialize
  407. *
  408. * When SR-IOV (Single Root IO Virtualiztion) is enabled, allocate queues
  409. * and VM pools where appropriate. If RSS is available, then also try and
  410. * enable RSS and map accordingly.
  411. *
  412. **/
  413. static bool ixgbe_set_sriov_queues(struct ixgbe_adapter *adapter)
  414. {
  415. u16 vmdq_i = adapter->ring_feature[RING_F_VMDQ].limit;
  416. u16 vmdq_m = 0;
  417. u16 rss_i = adapter->ring_feature[RING_F_RSS].limit;
  418. u16 rss_m = IXGBE_RSS_DISABLED_MASK;
  419. #ifdef IXGBE_FCOE
  420. u16 fcoe_i = 0;
  421. #endif
  422. /* only proceed if SR-IOV is enabled */
  423. if (!(adapter->flags & IXGBE_FLAG_SRIOV_ENABLED))
  424. return false;
  425. /* Add starting offset to total pool count */
  426. vmdq_i += adapter->ring_feature[RING_F_VMDQ].offset;
  427. /* double check we are limited to maximum pools */
  428. vmdq_i = min_t(u16, IXGBE_MAX_VMDQ_INDICES, vmdq_i);
  429. /* 64 pool mode with 2 queues per pool */
  430. if ((vmdq_i > 32) || (rss_i < 4)) {
  431. vmdq_m = IXGBE_82599_VMDQ_2Q_MASK;
  432. rss_m = IXGBE_RSS_2Q_MASK;
  433. rss_i = min_t(u16, rss_i, 2);
  434. /* 32 pool mode with 4 queues per pool */
  435. } else {
  436. vmdq_m = IXGBE_82599_VMDQ_4Q_MASK;
  437. rss_m = IXGBE_RSS_4Q_MASK;
  438. rss_i = 4;
  439. }
  440. #ifdef IXGBE_FCOE
  441. /* queues in the remaining pools are available for FCoE */
  442. fcoe_i = 128 - (vmdq_i * __ALIGN_MASK(1, ~vmdq_m));
  443. #endif
  444. /* remove the starting offset from the pool count */
  445. vmdq_i -= adapter->ring_feature[RING_F_VMDQ].offset;
  446. /* save features for later use */
  447. adapter->ring_feature[RING_F_VMDQ].indices = vmdq_i;
  448. adapter->ring_feature[RING_F_VMDQ].mask = vmdq_m;
  449. /* limit RSS based on user input and save for later use */
  450. adapter->ring_feature[RING_F_RSS].indices = rss_i;
  451. adapter->ring_feature[RING_F_RSS].mask = rss_m;
  452. adapter->num_rx_pools = vmdq_i;
  453. adapter->num_rx_queues_per_pool = rss_i;
  454. adapter->num_rx_queues = vmdq_i * rss_i;
  455. adapter->num_tx_queues = vmdq_i * rss_i;
  456. /* disable ATR as it is not supported when VMDq is enabled */
  457. adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
  458. #ifdef IXGBE_FCOE
  459. /*
  460. * FCoE can use rings from adjacent buffers to allow RSS
  461. * like behavior. To account for this we need to add the
  462. * FCoE indices to the total ring count.
  463. */
  464. if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) {
  465. struct ixgbe_ring_feature *fcoe;
  466. fcoe = &adapter->ring_feature[RING_F_FCOE];
  467. /* limit ourselves based on feature limits */
  468. fcoe_i = min_t(u16, fcoe_i, fcoe->limit);
  469. if (vmdq_i > 1 && fcoe_i) {
  470. /* reserve no more than number of CPUs */
  471. fcoe_i = min_t(u16, fcoe_i, num_online_cpus());
  472. /* alloc queues for FCoE separately */
  473. fcoe->indices = fcoe_i;
  474. fcoe->offset = vmdq_i * rss_i;
  475. } else {
  476. /* merge FCoE queues with RSS queues */
  477. fcoe_i = min_t(u16, fcoe_i + rss_i, num_online_cpus());
  478. /* limit indices to rss_i if MSI-X is disabled */
  479. if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED))
  480. fcoe_i = rss_i;
  481. /* attempt to reserve some queues for just FCoE */
  482. fcoe->indices = min_t(u16, fcoe_i, fcoe->limit);
  483. fcoe->offset = fcoe_i - fcoe->indices;
  484. fcoe_i -= rss_i;
  485. }
  486. /* add queues to adapter */
  487. adapter->num_tx_queues += fcoe_i;
  488. adapter->num_rx_queues += fcoe_i;
  489. }
  490. #endif
  491. return true;
  492. }
  493. /**
  494. * ixgbe_set_rss_queues - Allocate queues for RSS
  495. * @adapter: board private structure to initialize
  496. *
  497. * This is our "base" multiqueue mode. RSS (Receive Side Scaling) will try
  498. * to allocate one Rx queue per CPU, and if available, one Tx queue per CPU.
  499. *
  500. **/
  501. static bool ixgbe_set_rss_queues(struct ixgbe_adapter *adapter)
  502. {
  503. struct ixgbe_ring_feature *f;
  504. u16 rss_i;
  505. /* set mask for 16 queue limit of RSS */
  506. f = &adapter->ring_feature[RING_F_RSS];
  507. rss_i = f->limit;
  508. f->indices = rss_i;
  509. f->mask = IXGBE_RSS_16Q_MASK;
  510. /*
  511. * Use Flow Director in addition to RSS to ensure the best
  512. * distribution of flows across cores, even when an FDIR flow
  513. * isn't matched.
  514. */
  515. if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
  516. f = &adapter->ring_feature[RING_F_FDIR];
  517. f->indices = min_t(u16, num_online_cpus(), f->limit);
  518. rss_i = max_t(u16, rss_i, f->indices);
  519. }
  520. #ifdef IXGBE_FCOE
  521. /*
  522. * FCoE can exist on the same rings as standard network traffic
  523. * however it is preferred to avoid that if possible. In order
  524. * to get the best performance we allocate as many FCoE queues
  525. * as we can and we place them at the end of the ring array to
  526. * avoid sharing queues with standard RSS on systems with 24 or
  527. * more CPUs.
  528. */
  529. if (adapter->flags & IXGBE_FLAG_FCOE_ENABLED) {
  530. struct net_device *dev = adapter->netdev;
  531. u16 fcoe_i;
  532. f = &adapter->ring_feature[RING_F_FCOE];
  533. /* merge FCoE queues with RSS queues */
  534. fcoe_i = min_t(u16, f->limit + rss_i, num_online_cpus());
  535. fcoe_i = min_t(u16, fcoe_i, dev->num_tx_queues);
  536. /* limit indices to rss_i if MSI-X is disabled */
  537. if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED))
  538. fcoe_i = rss_i;
  539. /* attempt to reserve some queues for just FCoE */
  540. f->indices = min_t(u16, fcoe_i, f->limit);
  541. f->offset = fcoe_i - f->indices;
  542. rss_i = max_t(u16, fcoe_i, rss_i);
  543. }
  544. #endif /* IXGBE_FCOE */
  545. adapter->num_rx_queues = rss_i;
  546. adapter->num_tx_queues = rss_i;
  547. return true;
  548. }
  549. /**
  550. * ixgbe_set_num_queues - Allocate queues for device, feature dependent
  551. * @adapter: board private structure to initialize
  552. *
  553. * This is the top level queue allocation routine. The order here is very
  554. * important, starting with the "most" number of features turned on at once,
  555. * and ending with the smallest set of features. This way large combinations
  556. * can be allocated if they're turned on, and smaller combinations are the
  557. * fallthrough conditions.
  558. *
  559. **/
  560. static void ixgbe_set_num_queues(struct ixgbe_adapter *adapter)
  561. {
  562. /* Start with base case */
  563. adapter->num_rx_queues = 1;
  564. adapter->num_tx_queues = 1;
  565. adapter->num_rx_pools = adapter->num_rx_queues;
  566. adapter->num_rx_queues_per_pool = 1;
  567. #ifdef CONFIG_IXGBE_DCB
  568. if (ixgbe_set_dcb_sriov_queues(adapter))
  569. return;
  570. if (ixgbe_set_dcb_queues(adapter))
  571. return;
  572. #endif
  573. if (ixgbe_set_sriov_queues(adapter))
  574. return;
  575. ixgbe_set_rss_queues(adapter);
  576. }
  577. static void ixgbe_acquire_msix_vectors(struct ixgbe_adapter *adapter,
  578. int vectors)
  579. {
  580. int err, vector_threshold;
  581. /* We'll want at least 2 (vector_threshold):
  582. * 1) TxQ[0] + RxQ[0] handler
  583. * 2) Other (Link Status Change, etc.)
  584. */
  585. vector_threshold = MIN_MSIX_COUNT;
  586. /*
  587. * The more we get, the more we will assign to Tx/Rx Cleanup
  588. * for the separate queues...where Rx Cleanup >= Tx Cleanup.
  589. * Right now, we simply care about how many we'll get; we'll
  590. * set them up later while requesting irq's.
  591. */
  592. while (vectors >= vector_threshold) {
  593. err = pci_enable_msix(adapter->pdev, adapter->msix_entries,
  594. vectors);
  595. if (!err) /* Success in acquiring all requested vectors. */
  596. break;
  597. else if (err < 0)
  598. vectors = 0; /* Nasty failure, quit now */
  599. else /* err == number of vectors we should try again with */
  600. vectors = err;
  601. }
  602. if (vectors < vector_threshold) {
  603. /* Can't allocate enough MSI-X interrupts? Oh well.
  604. * This just means we'll go with either a single MSI
  605. * vector or fall back to legacy interrupts.
  606. */
  607. netif_printk(adapter, hw, KERN_DEBUG, adapter->netdev,
  608. "Unable to allocate MSI-X interrupts\n");
  609. adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED;
  610. kfree(adapter->msix_entries);
  611. adapter->msix_entries = NULL;
  612. } else {
  613. adapter->flags |= IXGBE_FLAG_MSIX_ENABLED; /* Woot! */
  614. /*
  615. * Adjust for only the vectors we'll use, which is minimum
  616. * of max_msix_q_vectors + NON_Q_VECTORS, or the number of
  617. * vectors we were allocated.
  618. */
  619. vectors -= NON_Q_VECTORS;
  620. adapter->num_q_vectors = min(vectors, adapter->max_q_vectors);
  621. }
  622. }
  623. static void ixgbe_add_ring(struct ixgbe_ring *ring,
  624. struct ixgbe_ring_container *head)
  625. {
  626. ring->next = head->ring;
  627. head->ring = ring;
  628. head->count++;
  629. }
  630. /**
  631. * ixgbe_alloc_q_vector - Allocate memory for a single interrupt vector
  632. * @adapter: board private structure to initialize
  633. * @v_count: q_vectors allocated on adapter, used for ring interleaving
  634. * @v_idx: index of vector in adapter struct
  635. * @txr_count: total number of Tx rings to allocate
  636. * @txr_idx: index of first Tx ring to allocate
  637. * @rxr_count: total number of Rx rings to allocate
  638. * @rxr_idx: index of first Rx ring to allocate
  639. *
  640. * We allocate one q_vector. If allocation fails we return -ENOMEM.
  641. **/
  642. static int ixgbe_alloc_q_vector(struct ixgbe_adapter *adapter,
  643. int v_count, int v_idx,
  644. int txr_count, int txr_idx,
  645. int rxr_count, int rxr_idx)
  646. {
  647. struct ixgbe_q_vector *q_vector;
  648. struct ixgbe_ring *ring;
  649. int node = -1;
  650. int cpu = -1;
  651. int ring_count, size;
  652. ring_count = txr_count + rxr_count;
  653. size = sizeof(struct ixgbe_q_vector) +
  654. (sizeof(struct ixgbe_ring) * ring_count);
  655. /* customize cpu for Flow Director mapping */
  656. if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
  657. if (cpu_online(v_idx)) {
  658. cpu = v_idx;
  659. node = cpu_to_node(cpu);
  660. }
  661. }
  662. /* allocate q_vector and rings */
  663. q_vector = kzalloc_node(size, GFP_KERNEL, node);
  664. if (!q_vector)
  665. q_vector = kzalloc(size, GFP_KERNEL);
  666. if (!q_vector)
  667. return -ENOMEM;
  668. /* setup affinity mask and node */
  669. if (cpu != -1)
  670. cpumask_set_cpu(cpu, &q_vector->affinity_mask);
  671. else
  672. cpumask_copy(&q_vector->affinity_mask, cpu_online_mask);
  673. q_vector->numa_node = node;
  674. /* initialize NAPI */
  675. netif_napi_add(adapter->netdev, &q_vector->napi,
  676. ixgbe_poll, 64);
  677. /* tie q_vector and adapter together */
  678. adapter->q_vector[v_idx] = q_vector;
  679. q_vector->adapter = adapter;
  680. q_vector->v_idx = v_idx;
  681. /* initialize work limits */
  682. q_vector->tx.work_limit = adapter->tx_work_limit;
  683. /* initialize pointer to rings */
  684. ring = q_vector->ring;
  685. while (txr_count) {
  686. /* assign generic ring traits */
  687. ring->dev = &adapter->pdev->dev;
  688. ring->netdev = adapter->netdev;
  689. /* configure backlink on ring */
  690. ring->q_vector = q_vector;
  691. /* update q_vector Tx values */
  692. ixgbe_add_ring(ring, &q_vector->tx);
  693. /* apply Tx specific ring traits */
  694. ring->count = adapter->tx_ring_count;
  695. ring->queue_index = txr_idx;
  696. /* assign ring to adapter */
  697. adapter->tx_ring[txr_idx] = ring;
  698. /* update count and index */
  699. txr_count--;
  700. txr_idx += v_count;
  701. /* push pointer to next ring */
  702. ring++;
  703. }
  704. while (rxr_count) {
  705. /* assign generic ring traits */
  706. ring->dev = &adapter->pdev->dev;
  707. ring->netdev = adapter->netdev;
  708. /* configure backlink on ring */
  709. ring->q_vector = q_vector;
  710. /* update q_vector Rx values */
  711. ixgbe_add_ring(ring, &q_vector->rx);
  712. /*
  713. * 82599 errata, UDP frames with a 0 checksum
  714. * can be marked as checksum errors.
  715. */
  716. if (adapter->hw.mac.type == ixgbe_mac_82599EB)
  717. set_bit(__IXGBE_RX_CSUM_UDP_ZERO_ERR, &ring->state);
  718. #ifdef IXGBE_FCOE
  719. if (adapter->netdev->features & NETIF_F_FCOE_MTU) {
  720. struct ixgbe_ring_feature *f;
  721. f = &adapter->ring_feature[RING_F_FCOE];
  722. if ((rxr_idx >= f->offset) &&
  723. (rxr_idx < f->offset + f->indices))
  724. set_bit(__IXGBE_RX_FCOE, &ring->state);
  725. }
  726. #endif /* IXGBE_FCOE */
  727. /* apply Rx specific ring traits */
  728. ring->count = adapter->rx_ring_count;
  729. ring->queue_index = rxr_idx;
  730. /* assign ring to adapter */
  731. adapter->rx_ring[rxr_idx] = ring;
  732. /* update count and index */
  733. rxr_count--;
  734. rxr_idx += v_count;
  735. /* push pointer to next ring */
  736. ring++;
  737. }
  738. return 0;
  739. }
  740. /**
  741. * ixgbe_free_q_vector - Free memory allocated for specific interrupt vector
  742. * @adapter: board private structure to initialize
  743. * @v_idx: Index of vector to be freed
  744. *
  745. * This function frees the memory allocated to the q_vector. In addition if
  746. * NAPI is enabled it will delete any references to the NAPI struct prior
  747. * to freeing the q_vector.
  748. **/
  749. static void ixgbe_free_q_vector(struct ixgbe_adapter *adapter, int v_idx)
  750. {
  751. struct ixgbe_q_vector *q_vector = adapter->q_vector[v_idx];
  752. struct ixgbe_ring *ring;
  753. ixgbe_for_each_ring(ring, q_vector->tx)
  754. adapter->tx_ring[ring->queue_index] = NULL;
  755. ixgbe_for_each_ring(ring, q_vector->rx)
  756. adapter->rx_ring[ring->queue_index] = NULL;
  757. adapter->q_vector[v_idx] = NULL;
  758. netif_napi_del(&q_vector->napi);
  759. /*
  760. * ixgbe_get_stats64() might access the rings on this vector,
  761. * we must wait a grace period before freeing it.
  762. */
  763. kfree_rcu(q_vector, rcu);
  764. }
  765. /**
  766. * ixgbe_alloc_q_vectors - Allocate memory for interrupt vectors
  767. * @adapter: board private structure to initialize
  768. *
  769. * We allocate one q_vector per queue interrupt. If allocation fails we
  770. * return -ENOMEM.
  771. **/
  772. static int ixgbe_alloc_q_vectors(struct ixgbe_adapter *adapter)
  773. {
  774. int q_vectors = adapter->num_q_vectors;
  775. int rxr_remaining = adapter->num_rx_queues;
  776. int txr_remaining = adapter->num_tx_queues;
  777. int rxr_idx = 0, txr_idx = 0, v_idx = 0;
  778. int err;
  779. /* only one q_vector if MSI-X is disabled. */
  780. if (!(adapter->flags & IXGBE_FLAG_MSIX_ENABLED))
  781. q_vectors = 1;
  782. if (q_vectors >= (rxr_remaining + txr_remaining)) {
  783. for (; rxr_remaining; v_idx++) {
  784. err = ixgbe_alloc_q_vector(adapter, q_vectors, v_idx,
  785. 0, 0, 1, rxr_idx);
  786. if (err)
  787. goto err_out;
  788. /* update counts and index */
  789. rxr_remaining--;
  790. rxr_idx++;
  791. }
  792. }
  793. for (; v_idx < q_vectors; v_idx++) {
  794. int rqpv = DIV_ROUND_UP(rxr_remaining, q_vectors - v_idx);
  795. int tqpv = DIV_ROUND_UP(txr_remaining, q_vectors - v_idx);
  796. err = ixgbe_alloc_q_vector(adapter, q_vectors, v_idx,
  797. tqpv, txr_idx,
  798. rqpv, rxr_idx);
  799. if (err)
  800. goto err_out;
  801. /* update counts and index */
  802. rxr_remaining -= rqpv;
  803. txr_remaining -= tqpv;
  804. rxr_idx++;
  805. txr_idx++;
  806. }
  807. return 0;
  808. err_out:
  809. adapter->num_tx_queues = 0;
  810. adapter->num_rx_queues = 0;
  811. adapter->num_q_vectors = 0;
  812. while (v_idx--)
  813. ixgbe_free_q_vector(adapter, v_idx);
  814. return -ENOMEM;
  815. }
  816. /**
  817. * ixgbe_free_q_vectors - Free memory allocated for interrupt vectors
  818. * @adapter: board private structure to initialize
  819. *
  820. * This function frees the memory allocated to the q_vectors. In addition if
  821. * NAPI is enabled it will delete any references to the NAPI struct prior
  822. * to freeing the q_vector.
  823. **/
  824. static void ixgbe_free_q_vectors(struct ixgbe_adapter *adapter)
  825. {
  826. int v_idx = adapter->num_q_vectors;
  827. adapter->num_tx_queues = 0;
  828. adapter->num_rx_queues = 0;
  829. adapter->num_q_vectors = 0;
  830. while (v_idx--)
  831. ixgbe_free_q_vector(adapter, v_idx);
  832. }
  833. static void ixgbe_reset_interrupt_capability(struct ixgbe_adapter *adapter)
  834. {
  835. if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED) {
  836. adapter->flags &= ~IXGBE_FLAG_MSIX_ENABLED;
  837. pci_disable_msix(adapter->pdev);
  838. kfree(adapter->msix_entries);
  839. adapter->msix_entries = NULL;
  840. } else if (adapter->flags & IXGBE_FLAG_MSI_ENABLED) {
  841. adapter->flags &= ~IXGBE_FLAG_MSI_ENABLED;
  842. pci_disable_msi(adapter->pdev);
  843. }
  844. }
  845. /**
  846. * ixgbe_set_interrupt_capability - set MSI-X or MSI if supported
  847. * @adapter: board private structure to initialize
  848. *
  849. * Attempt to configure the interrupts using the best available
  850. * capabilities of the hardware and the kernel.
  851. **/
  852. static void ixgbe_set_interrupt_capability(struct ixgbe_adapter *adapter)
  853. {
  854. struct ixgbe_hw *hw = &adapter->hw;
  855. int vector, v_budget, err;
  856. /*
  857. * It's easy to be greedy for MSI-X vectors, but it really
  858. * doesn't do us much good if we have a lot more vectors
  859. * than CPU's. So let's be conservative and only ask for
  860. * (roughly) the same number of vectors as there are CPU's.
  861. * The default is to use pairs of vectors.
  862. */
  863. v_budget = max(adapter->num_rx_queues, adapter->num_tx_queues);
  864. v_budget = min_t(int, v_budget, num_online_cpus());
  865. v_budget += NON_Q_VECTORS;
  866. /*
  867. * At the same time, hardware can only support a maximum of
  868. * hw.mac->max_msix_vectors vectors. With features
  869. * such as RSS and VMDq, we can easily surpass the number of Rx and Tx
  870. * descriptor queues supported by our device. Thus, we cap it off in
  871. * those rare cases where the cpu count also exceeds our vector limit.
  872. */
  873. v_budget = min_t(int, v_budget, hw->mac.max_msix_vectors);
  874. /* A failure in MSI-X entry allocation isn't fatal, but it does
  875. * mean we disable MSI-X capabilities of the adapter. */
  876. adapter->msix_entries = kcalloc(v_budget,
  877. sizeof(struct msix_entry), GFP_KERNEL);
  878. if (adapter->msix_entries) {
  879. for (vector = 0; vector < v_budget; vector++)
  880. adapter->msix_entries[vector].entry = vector;
  881. ixgbe_acquire_msix_vectors(adapter, v_budget);
  882. if (adapter->flags & IXGBE_FLAG_MSIX_ENABLED)
  883. return;
  884. }
  885. adapter->flags &= ~IXGBE_FLAG_DCB_ENABLED;
  886. if (adapter->flags & IXGBE_FLAG_FDIR_HASH_CAPABLE) {
  887. e_err(probe,
  888. "ATR is not supported while multiple "
  889. "queues are disabled. Disabling Flow Director\n");
  890. }
  891. adapter->flags &= ~IXGBE_FLAG_FDIR_HASH_CAPABLE;
  892. adapter->atr_sample_rate = 0;
  893. if (adapter->flags & IXGBE_FLAG_SRIOV_ENABLED)
  894. ixgbe_disable_sriov(adapter);
  895. adapter->ring_feature[RING_F_RSS].limit = 1;
  896. ixgbe_set_num_queues(adapter);
  897. adapter->num_q_vectors = 1;
  898. err = pci_enable_msi(adapter->pdev);
  899. if (err) {
  900. netif_printk(adapter, hw, KERN_DEBUG, adapter->netdev,
  901. "Unable to allocate MSI interrupt, "
  902. "falling back to legacy. Error: %d\n", err);
  903. return;
  904. }
  905. adapter->flags |= IXGBE_FLAG_MSI_ENABLED;
  906. }
  907. /**
  908. * ixgbe_init_interrupt_scheme - Determine proper interrupt scheme
  909. * @adapter: board private structure to initialize
  910. *
  911. * We determine which interrupt scheme to use based on...
  912. * - Kernel support (MSI, MSI-X)
  913. * - which can be user-defined (via MODULE_PARAM)
  914. * - Hardware queue count (num_*_queues)
  915. * - defined by miscellaneous hardware support/features (RSS, etc.)
  916. **/
  917. int ixgbe_init_interrupt_scheme(struct ixgbe_adapter *adapter)
  918. {
  919. int err;
  920. /* Number of supported queues */
  921. ixgbe_set_num_queues(adapter);
  922. /* Set interrupt mode */
  923. ixgbe_set_interrupt_capability(adapter);
  924. err = ixgbe_alloc_q_vectors(adapter);
  925. if (err) {
  926. e_dev_err("Unable to allocate memory for queue vectors\n");
  927. goto err_alloc_q_vectors;
  928. }
  929. ixgbe_cache_ring_register(adapter);
  930. e_dev_info("Multiqueue %s: Rx Queue count = %u, Tx Queue count = %u\n",
  931. (adapter->num_rx_queues > 1) ? "Enabled" : "Disabled",
  932. adapter->num_rx_queues, adapter->num_tx_queues);
  933. set_bit(__IXGBE_DOWN, &adapter->state);
  934. return 0;
  935. err_alloc_q_vectors:
  936. ixgbe_reset_interrupt_capability(adapter);
  937. return err;
  938. }
  939. /**
  940. * ixgbe_clear_interrupt_scheme - Clear the current interrupt scheme settings
  941. * @adapter: board private structure to clear interrupt scheme on
  942. *
  943. * We go through and clear interrupt specific resources and reset the structure
  944. * to pre-load conditions
  945. **/
  946. void ixgbe_clear_interrupt_scheme(struct ixgbe_adapter *adapter)
  947. {
  948. adapter->num_tx_queues = 0;
  949. adapter->num_rx_queues = 0;
  950. ixgbe_free_q_vectors(adapter);
  951. ixgbe_reset_interrupt_capability(adapter);
  952. }
  953. void ixgbe_tx_ctxtdesc(struct ixgbe_ring *tx_ring, u32 vlan_macip_lens,
  954. u32 fcoe_sof_eof, u32 type_tucmd, u32 mss_l4len_idx)
  955. {
  956. struct ixgbe_adv_tx_context_desc *context_desc;
  957. u16 i = tx_ring->next_to_use;
  958. context_desc = IXGBE_TX_CTXTDESC(tx_ring, i);
  959. i++;
  960. tx_ring->next_to_use = (i < tx_ring->count) ? i : 0;
  961. /* set bits to identify this as an advanced context descriptor */
  962. type_tucmd |= IXGBE_TXD_CMD_DEXT | IXGBE_ADVTXD_DTYP_CTXT;
  963. context_desc->vlan_macip_lens = cpu_to_le32(vlan_macip_lens);
  964. context_desc->seqnum_seed = cpu_to_le32(fcoe_sof_eof);
  965. context_desc->type_tucmd_mlhl = cpu_to_le32(type_tucmd);
  966. context_desc->mss_l4len_idx = cpu_to_le32(mss_l4len_idx);
  967. }