ionic_if.h 92 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261
  1. /* SPDX-License-Identifier: (GPL-2.0 OR Linux-OpenIB) OR BSD-2-Clause */
  2. /* Copyright (c) 2017-2020 Pensando Systems, Inc. All rights reserved. */
  3. #ifndef _IONIC_IF_H_
  4. #define _IONIC_IF_H_
  5. #define IONIC_DEV_INFO_SIGNATURE 0x44455649 /* 'DEVI' */
  6. #define IONIC_DEV_INFO_VERSION 1
  7. #define IONIC_IFNAMSIZ 16
  8. /*
  9. * enum ionic_cmd_opcode - Device commands
  10. */
  11. enum ionic_cmd_opcode {
  12. IONIC_CMD_NOP = 0,
  13. /* Device commands */
  14. IONIC_CMD_IDENTIFY = 1,
  15. IONIC_CMD_INIT = 2,
  16. IONIC_CMD_RESET = 3,
  17. IONIC_CMD_GETATTR = 4,
  18. IONIC_CMD_SETATTR = 5,
  19. /* Port commands */
  20. IONIC_CMD_PORT_IDENTIFY = 10,
  21. IONIC_CMD_PORT_INIT = 11,
  22. IONIC_CMD_PORT_RESET = 12,
  23. IONIC_CMD_PORT_GETATTR = 13,
  24. IONIC_CMD_PORT_SETATTR = 14,
  25. /* LIF commands */
  26. IONIC_CMD_LIF_IDENTIFY = 20,
  27. IONIC_CMD_LIF_INIT = 21,
  28. IONIC_CMD_LIF_RESET = 22,
  29. IONIC_CMD_LIF_GETATTR = 23,
  30. IONIC_CMD_LIF_SETATTR = 24,
  31. IONIC_CMD_LIF_SETPHC = 25,
  32. IONIC_CMD_RX_MODE_SET = 30,
  33. IONIC_CMD_RX_FILTER_ADD = 31,
  34. IONIC_CMD_RX_FILTER_DEL = 32,
  35. /* Queue commands */
  36. IONIC_CMD_Q_IDENTIFY = 39,
  37. IONIC_CMD_Q_INIT = 40,
  38. IONIC_CMD_Q_CONTROL = 41,
  39. /* RDMA commands */
  40. IONIC_CMD_RDMA_RESET_LIF = 50,
  41. IONIC_CMD_RDMA_CREATE_EQ = 51,
  42. IONIC_CMD_RDMA_CREATE_CQ = 52,
  43. IONIC_CMD_RDMA_CREATE_ADMINQ = 53,
  44. /* SR/IOV commands */
  45. IONIC_CMD_VF_GETATTR = 60,
  46. IONIC_CMD_VF_SETATTR = 61,
  47. IONIC_CMD_VF_CTRL = 62,
  48. /* QoS commands */
  49. IONIC_CMD_QOS_CLASS_IDENTIFY = 240,
  50. IONIC_CMD_QOS_CLASS_INIT = 241,
  51. IONIC_CMD_QOS_CLASS_RESET = 242,
  52. IONIC_CMD_QOS_CLASS_UPDATE = 243,
  53. IONIC_CMD_QOS_CLEAR_STATS = 244,
  54. IONIC_CMD_QOS_RESET = 245,
  55. /* Firmware commands */
  56. IONIC_CMD_FW_DOWNLOAD = 252,
  57. IONIC_CMD_FW_CONTROL = 253,
  58. IONIC_CMD_FW_DOWNLOAD_V1 = 254,
  59. IONIC_CMD_FW_CONTROL_V1 = 255,
  60. };
  61. /*
  62. * enum ionic_status_code - Device command return codes
  63. */
  64. enum ionic_status_code {
  65. IONIC_RC_SUCCESS = 0, /* Success */
  66. IONIC_RC_EVERSION = 1, /* Incorrect version for request */
  67. IONIC_RC_EOPCODE = 2, /* Invalid cmd opcode */
  68. IONIC_RC_EIO = 3, /* I/O error */
  69. IONIC_RC_EPERM = 4, /* Permission denied */
  70. IONIC_RC_EQID = 5, /* Bad qid */
  71. IONIC_RC_EQTYPE = 6, /* Bad qtype */
  72. IONIC_RC_ENOENT = 7, /* No such element */
  73. IONIC_RC_EINTR = 8, /* operation interrupted */
  74. IONIC_RC_EAGAIN = 9, /* Try again */
  75. IONIC_RC_ENOMEM = 10, /* Out of memory */
  76. IONIC_RC_EFAULT = 11, /* Bad address */
  77. IONIC_RC_EBUSY = 12, /* Device or resource busy */
  78. IONIC_RC_EEXIST = 13, /* object already exists */
  79. IONIC_RC_EINVAL = 14, /* Invalid argument */
  80. IONIC_RC_ENOSPC = 15, /* No space left or alloc failure */
  81. IONIC_RC_ERANGE = 16, /* Parameter out of range */
  82. IONIC_RC_BAD_ADDR = 17, /* Descriptor contains a bad ptr */
  83. IONIC_RC_DEV_CMD = 18, /* Device cmd attempted on AdminQ */
  84. IONIC_RC_ENOSUPP = 19, /* Operation not supported */
  85. IONIC_RC_ERROR = 29, /* Generic error */
  86. IONIC_RC_ERDMA = 30, /* Generic RDMA error */
  87. IONIC_RC_EVFID = 31, /* VF ID does not exist */
  88. IONIC_RC_EBAD_FW = 32, /* FW file is invalid or corrupted */
  89. };
  90. enum ionic_notifyq_opcode {
  91. IONIC_EVENT_LINK_CHANGE = 1,
  92. IONIC_EVENT_RESET = 2,
  93. IONIC_EVENT_HEARTBEAT = 3,
  94. IONIC_EVENT_LOG = 4,
  95. IONIC_EVENT_XCVR = 5,
  96. };
  97. /**
  98. * struct ionic_admin_cmd - General admin command format
  99. * @opcode: Opcode for the command
  100. * @rsvd: reserved byte(s)
  101. * @lif_index: LIF index
  102. * @cmd_data: Opcode-specific command bytes
  103. */
  104. struct ionic_admin_cmd {
  105. u8 opcode;
  106. u8 rsvd;
  107. __le16 lif_index;
  108. u8 cmd_data[60];
  109. };
  110. /**
  111. * struct ionic_admin_comp - General admin command completion format
  112. * @status: Status of the command (enum ionic_status_code)
  113. * @rsvd: reserved byte(s)
  114. * @comp_index: Index in the descriptor ring for which this is the completion
  115. * @cmd_data: Command-specific bytes
  116. * @color: Color bit (Always 0 for commands issued to the
  117. * Device Cmd Registers)
  118. */
  119. struct ionic_admin_comp {
  120. u8 status;
  121. u8 rsvd;
  122. __le16 comp_index;
  123. u8 cmd_data[11];
  124. u8 color;
  125. #define IONIC_COMP_COLOR_MASK 0x80
  126. };
  127. static inline u8 color_match(u8 color, u8 done_color)
  128. {
  129. return (!!(color & IONIC_COMP_COLOR_MASK)) == done_color;
  130. }
  131. /**
  132. * struct ionic_nop_cmd - NOP command
  133. * @opcode: opcode
  134. * @rsvd: reserved byte(s)
  135. */
  136. struct ionic_nop_cmd {
  137. u8 opcode;
  138. u8 rsvd[63];
  139. };
  140. /**
  141. * struct ionic_nop_comp - NOP command completion
  142. * @status: Status of the command (enum ionic_status_code)
  143. * @rsvd: reserved byte(s)
  144. */
  145. struct ionic_nop_comp {
  146. u8 status;
  147. u8 rsvd[15];
  148. };
  149. /**
  150. * struct ionic_dev_init_cmd - Device init command
  151. * @opcode: opcode
  152. * @type: Device type
  153. * @rsvd: reserved byte(s)
  154. */
  155. struct ionic_dev_init_cmd {
  156. u8 opcode;
  157. u8 type;
  158. u8 rsvd[62];
  159. };
  160. /**
  161. * struct ionic_dev_init_comp - Device init command completion
  162. * @status: Status of the command (enum ionic_status_code)
  163. * @rsvd: reserved byte(s)
  164. */
  165. struct ionic_dev_init_comp {
  166. u8 status;
  167. u8 rsvd[15];
  168. };
  169. /**
  170. * struct ionic_dev_reset_cmd - Device reset command
  171. * @opcode: opcode
  172. * @rsvd: reserved byte(s)
  173. */
  174. struct ionic_dev_reset_cmd {
  175. u8 opcode;
  176. u8 rsvd[63];
  177. };
  178. /**
  179. * struct ionic_dev_reset_comp - Reset command completion
  180. * @status: Status of the command (enum ionic_status_code)
  181. * @rsvd: reserved byte(s)
  182. */
  183. struct ionic_dev_reset_comp {
  184. u8 status;
  185. u8 rsvd[15];
  186. };
  187. #define IONIC_IDENTITY_VERSION_1 1
  188. #define IONIC_DEV_IDENTITY_VERSION_2 2
  189. /**
  190. * struct ionic_dev_identify_cmd - Driver/device identify command
  191. * @opcode: opcode
  192. * @ver: Highest version of identify supported by driver
  193. * @rsvd: reserved byte(s)
  194. */
  195. struct ionic_dev_identify_cmd {
  196. u8 opcode;
  197. u8 ver;
  198. u8 rsvd[62];
  199. };
  200. /**
  201. * struct ionic_dev_identify_comp - Driver/device identify command completion
  202. * @status: Status of the command (enum ionic_status_code)
  203. * @ver: Version of identify returned by device
  204. * @rsvd: reserved byte(s)
  205. */
  206. struct ionic_dev_identify_comp {
  207. u8 status;
  208. u8 ver;
  209. u8 rsvd[14];
  210. };
  211. enum ionic_os_type {
  212. IONIC_OS_TYPE_LINUX = 1,
  213. IONIC_OS_TYPE_WIN = 2,
  214. IONIC_OS_TYPE_DPDK = 3,
  215. IONIC_OS_TYPE_FREEBSD = 4,
  216. IONIC_OS_TYPE_IPXE = 5,
  217. IONIC_OS_TYPE_ESXI = 6,
  218. };
  219. /**
  220. * union ionic_drv_identity - driver identity information
  221. * @os_type: OS type (see enum ionic_os_type)
  222. * @os_dist: OS distribution, numeric format
  223. * @os_dist_str: OS distribution, string format
  224. * @kernel_ver: Kernel version, numeric format
  225. * @kernel_ver_str: Kernel version, string format
  226. * @driver_ver_str: Driver version, string format
  227. * @words: word access to struct contents
  228. */
  229. union ionic_drv_identity {
  230. struct {
  231. __le32 os_type;
  232. __le32 os_dist;
  233. char os_dist_str[128];
  234. __le32 kernel_ver;
  235. char kernel_ver_str[32];
  236. char driver_ver_str[32];
  237. };
  238. __le32 words[478];
  239. };
  240. /**
  241. * enum ionic_dev_capability - Device capabilities
  242. * @IONIC_DEV_CAP_VF_CTRL: Device supports VF ctrl operations
  243. */
  244. enum ionic_dev_capability {
  245. IONIC_DEV_CAP_VF_CTRL = BIT(0),
  246. };
  247. /**
  248. * union ionic_dev_identity - device identity information
  249. * @version: Version of device identify
  250. * @type: Identify type (0 for now)
  251. * @rsvd: reserved byte(s)
  252. * @nports: Number of ports provisioned
  253. * @rsvd2: reserved byte(s)
  254. * @nlifs: Number of LIFs provisioned
  255. * @nintrs: Number of interrupts provisioned
  256. * @ndbpgs_per_lif: Number of doorbell pages per LIF
  257. * @intr_coal_mult: Interrupt coalescing multiplication factor
  258. * Scale user-supplied interrupt coalescing
  259. * value in usecs to device units using:
  260. * device units = usecs * mult / div
  261. * @intr_coal_div: Interrupt coalescing division factor
  262. * Scale user-supplied interrupt coalescing
  263. * value in usecs to device units using:
  264. * device units = usecs * mult / div
  265. * @eq_count: Number of shared event queues
  266. * @hwstamp_mask: Bitmask for subtraction of hardware tick values.
  267. * @hwstamp_mult: Hardware tick to nanosecond multiplier.
  268. * @hwstamp_shift: Hardware tick to nanosecond divisor (power of two).
  269. * @capabilities: Device capabilities
  270. * @words: word access to struct contents
  271. */
  272. union ionic_dev_identity {
  273. struct {
  274. u8 version;
  275. u8 type;
  276. u8 rsvd[2];
  277. u8 nports;
  278. u8 rsvd2[3];
  279. __le32 nlifs;
  280. __le32 nintrs;
  281. __le32 ndbpgs_per_lif;
  282. __le32 intr_coal_mult;
  283. __le32 intr_coal_div;
  284. __le32 eq_count;
  285. __le64 hwstamp_mask;
  286. __le32 hwstamp_mult;
  287. __le32 hwstamp_shift;
  288. __le64 capabilities;
  289. };
  290. __le32 words[478];
  291. };
  292. enum ionic_lif_type {
  293. IONIC_LIF_TYPE_CLASSIC = 0,
  294. IONIC_LIF_TYPE_MACVLAN = 1,
  295. IONIC_LIF_TYPE_NETQUEUE = 2,
  296. };
  297. /**
  298. * struct ionic_lif_identify_cmd - LIF identify command
  299. * @opcode: opcode
  300. * @type: LIF type (enum ionic_lif_type)
  301. * @ver: Version of identify returned by device
  302. * @rsvd: reserved byte(s)
  303. */
  304. struct ionic_lif_identify_cmd {
  305. u8 opcode;
  306. u8 type;
  307. u8 ver;
  308. u8 rsvd[61];
  309. };
  310. /**
  311. * struct ionic_lif_identify_comp - LIF identify command completion
  312. * @status: Status of the command (enum ionic_status_code)
  313. * @ver: Version of identify returned by device
  314. * @rsvd2: reserved byte(s)
  315. */
  316. struct ionic_lif_identify_comp {
  317. u8 status;
  318. u8 ver;
  319. u8 rsvd2[14];
  320. };
  321. /**
  322. * enum ionic_lif_capability - LIF capabilities
  323. * @IONIC_LIF_CAP_ETH: LIF supports Ethernet
  324. * @IONIC_LIF_CAP_RDMA: LIF supports RDMA
  325. */
  326. enum ionic_lif_capability {
  327. IONIC_LIF_CAP_ETH = BIT(0),
  328. IONIC_LIF_CAP_RDMA = BIT(1),
  329. };
  330. /**
  331. * enum ionic_logical_qtype - Logical Queue Types
  332. * @IONIC_QTYPE_ADMINQ: Administrative Queue
  333. * @IONIC_QTYPE_NOTIFYQ: Notify Queue
  334. * @IONIC_QTYPE_RXQ: Receive Queue
  335. * @IONIC_QTYPE_TXQ: Transmit Queue
  336. * @IONIC_QTYPE_EQ: Event Queue
  337. * @IONIC_QTYPE_MAX: Max queue type supported
  338. */
  339. enum ionic_logical_qtype {
  340. IONIC_QTYPE_ADMINQ = 0,
  341. IONIC_QTYPE_NOTIFYQ = 1,
  342. IONIC_QTYPE_RXQ = 2,
  343. IONIC_QTYPE_TXQ = 3,
  344. IONIC_QTYPE_EQ = 4,
  345. IONIC_QTYPE_MAX = 16,
  346. };
  347. /**
  348. * enum ionic_q_feature - Common Features for most queue types
  349. *
  350. * Common features use bits 0-15. Per-queue-type features use higher bits.
  351. *
  352. * @IONIC_QIDENT_F_CQ: Queue has completion ring
  353. * @IONIC_QIDENT_F_SG: Queue has scatter/gather ring
  354. * @IONIC_QIDENT_F_EQ: Queue can use event queue
  355. * @IONIC_QIDENT_F_CMB: Queue is in cmb bar
  356. * @IONIC_Q_F_2X_DESC: Double main descriptor size
  357. * @IONIC_Q_F_2X_CQ_DESC: Double cq descriptor size
  358. * @IONIC_Q_F_2X_SG_DESC: Double sg descriptor size
  359. * @IONIC_Q_F_4X_DESC: Quadruple main descriptor size
  360. * @IONIC_Q_F_4X_CQ_DESC: Quadruple cq descriptor size
  361. * @IONIC_Q_F_4X_SG_DESC: Quadruple sg descriptor size
  362. */
  363. enum ionic_q_feature {
  364. IONIC_QIDENT_F_CQ = BIT_ULL(0),
  365. IONIC_QIDENT_F_SG = BIT_ULL(1),
  366. IONIC_QIDENT_F_EQ = BIT_ULL(2),
  367. IONIC_QIDENT_F_CMB = BIT_ULL(3),
  368. IONIC_Q_F_2X_DESC = BIT_ULL(4),
  369. IONIC_Q_F_2X_CQ_DESC = BIT_ULL(5),
  370. IONIC_Q_F_2X_SG_DESC = BIT_ULL(6),
  371. IONIC_Q_F_4X_DESC = BIT_ULL(7),
  372. IONIC_Q_F_4X_CQ_DESC = BIT_ULL(8),
  373. IONIC_Q_F_4X_SG_DESC = BIT_ULL(9),
  374. };
  375. /**
  376. * enum ionic_rxq_feature - RXQ-specific Features
  377. *
  378. * Per-queue-type features use bits 16 and higher.
  379. *
  380. * @IONIC_RXQ_F_HWSTAMP: Queue supports Hardware Timestamping
  381. */
  382. enum ionic_rxq_feature {
  383. IONIC_RXQ_F_HWSTAMP = BIT_ULL(16),
  384. };
  385. /**
  386. * enum ionic_txq_feature - TXQ-specific Features
  387. *
  388. * Per-queue-type features use bits 16 and higher.
  389. *
  390. * @IONIC_TXQ_F_HWSTAMP: Queue supports Hardware Timestamping
  391. */
  392. enum ionic_txq_feature {
  393. IONIC_TXQ_F_HWSTAMP = BIT(16),
  394. };
  395. /**
  396. * enum ionic_hwstamp_bits - Hardware timestamp decoding bits
  397. * @IONIC_HWSTAMP_INVALID: Invalid hardware timestamp value
  398. * @IONIC_HWSTAMP_CQ_NEGOFFSET: Timestamp field negative offset
  399. * from the base cq descriptor.
  400. */
  401. enum ionic_hwstamp_bits {
  402. IONIC_HWSTAMP_INVALID = ~0ull,
  403. IONIC_HWSTAMP_CQ_NEGOFFSET = 8,
  404. };
  405. /**
  406. * struct ionic_lif_logical_qtype - Descriptor of logical to HW queue type
  407. * @qtype: Hardware Queue Type
  408. * @rsvd: reserved byte(s)
  409. * @qid_count: Number of Queue IDs of the logical type
  410. * @qid_base: Minimum Queue ID of the logical type
  411. */
  412. struct ionic_lif_logical_qtype {
  413. u8 qtype;
  414. u8 rsvd[3];
  415. __le32 qid_count;
  416. __le32 qid_base;
  417. };
  418. /**
  419. * enum ionic_lif_state - LIF state
  420. * @IONIC_LIF_DISABLE: LIF disabled
  421. * @IONIC_LIF_ENABLE: LIF enabled
  422. * @IONIC_LIF_QUIESCE: LIF Quiesced
  423. */
  424. enum ionic_lif_state {
  425. IONIC_LIF_QUIESCE = 0,
  426. IONIC_LIF_ENABLE = 1,
  427. IONIC_LIF_DISABLE = 2,
  428. };
  429. /**
  430. * union ionic_lif_config - LIF configuration
  431. * @state: LIF state (enum ionic_lif_state)
  432. * @rsvd: reserved byte(s)
  433. * @name: LIF name
  434. * @mtu: MTU
  435. * @mac: Station MAC address
  436. * @vlan: Default Vlan ID
  437. * @features: Features (enum ionic_eth_hw_features)
  438. * @queue_count: Queue counts per queue-type
  439. * @words: word access to struct contents
  440. */
  441. union ionic_lif_config {
  442. struct {
  443. u8 state;
  444. u8 rsvd[3];
  445. char name[IONIC_IFNAMSIZ];
  446. __le32 mtu;
  447. u8 mac[6];
  448. __le16 vlan;
  449. __le64 features;
  450. __le32 queue_count[IONIC_QTYPE_MAX];
  451. } __packed;
  452. __le32 words[64];
  453. };
  454. /**
  455. * struct ionic_lif_identity - LIF identity information (type-specific)
  456. *
  457. * @capabilities: LIF capabilities
  458. *
  459. * @eth: Ethernet identify structure
  460. * @eth.version: Ethernet identify structure version
  461. * @eth.rsvd: reserved byte(s)
  462. * @eth.max_ucast_filters: Number of perfect unicast addresses supported
  463. * @eth.max_mcast_filters: Number of perfect multicast addresses supported
  464. * @eth.min_frame_size: Minimum size of frames to be sent
  465. * @eth.max_frame_size: Maximum size of frames to be sent
  466. * @eth.rsvd2: reserved byte(s)
  467. * @eth.hwstamp_tx_modes: Bitmask of BIT_ULL(enum ionic_txstamp_mode)
  468. * @eth.hwstamp_rx_filters: Bitmask of enum ionic_pkt_class
  469. * @eth.rsvd3: reserved byte(s)
  470. * @eth.config: LIF config struct with features, mtu, mac, q counts
  471. *
  472. * @rdma: RDMA identify structure
  473. * @rdma.version: RDMA version of opcodes and queue descriptors
  474. * @rdma.qp_opcodes: Number of RDMA queue pair opcodes supported
  475. * @rdma.admin_opcodes: Number of RDMA admin opcodes supported
  476. * @rdma.rsvd: reserved byte(s)
  477. * @rdma.npts_per_lif: Page table size per LIF
  478. * @rdma.nmrs_per_lif: Number of memory regions per LIF
  479. * @rdma.nahs_per_lif: Number of address handles per LIF
  480. * @rdma.max_stride: Max work request stride
  481. * @rdma.cl_stride: Cache line stride
  482. * @rdma.pte_stride: Page table entry stride
  483. * @rdma.rrq_stride: Remote RQ work request stride
  484. * @rdma.rsq_stride: Remote SQ work request stride
  485. * @rdma.dcqcn_profiles: Number of DCQCN profiles
  486. * @rdma.rsvd_dimensions: reserved byte(s)
  487. * @rdma.aq_qtype: RDMA Admin Qtype
  488. * @rdma.sq_qtype: RDMA Send Qtype
  489. * @rdma.rq_qtype: RDMA Receive Qtype
  490. * @rdma.cq_qtype: RDMA Completion Qtype
  491. * @rdma.eq_qtype: RDMA Event Qtype
  492. * @words: word access to struct contents
  493. */
  494. union ionic_lif_identity {
  495. struct {
  496. __le64 capabilities;
  497. struct {
  498. u8 version;
  499. u8 rsvd[3];
  500. __le32 max_ucast_filters;
  501. __le32 max_mcast_filters;
  502. __le16 rss_ind_tbl_sz;
  503. __le32 min_frame_size;
  504. __le32 max_frame_size;
  505. u8 rsvd2[2];
  506. __le64 hwstamp_tx_modes;
  507. __le64 hwstamp_rx_filters;
  508. u8 rsvd3[88];
  509. union ionic_lif_config config;
  510. } __packed eth;
  511. struct {
  512. u8 version;
  513. u8 qp_opcodes;
  514. u8 admin_opcodes;
  515. u8 rsvd;
  516. __le32 npts_per_lif;
  517. __le32 nmrs_per_lif;
  518. __le32 nahs_per_lif;
  519. u8 max_stride;
  520. u8 cl_stride;
  521. u8 pte_stride;
  522. u8 rrq_stride;
  523. u8 rsq_stride;
  524. u8 dcqcn_profiles;
  525. u8 rsvd_dimensions[10];
  526. struct ionic_lif_logical_qtype aq_qtype;
  527. struct ionic_lif_logical_qtype sq_qtype;
  528. struct ionic_lif_logical_qtype rq_qtype;
  529. struct ionic_lif_logical_qtype cq_qtype;
  530. struct ionic_lif_logical_qtype eq_qtype;
  531. } __packed rdma;
  532. } __packed;
  533. __le32 words[478];
  534. };
  535. /**
  536. * struct ionic_lif_init_cmd - LIF init command
  537. * @opcode: Opcode
  538. * @type: LIF type (enum ionic_lif_type)
  539. * @index: LIF index
  540. * @rsvd: reserved byte(s)
  541. * @info_pa: Destination address for LIF info (struct ionic_lif_info)
  542. * @rsvd2: reserved byte(s)
  543. */
  544. struct ionic_lif_init_cmd {
  545. u8 opcode;
  546. u8 type;
  547. __le16 index;
  548. __le32 rsvd;
  549. __le64 info_pa;
  550. u8 rsvd2[48];
  551. };
  552. /**
  553. * struct ionic_lif_init_comp - LIF init command completion
  554. * @status: Status of the command (enum ionic_status_code)
  555. * @rsvd: reserved byte(s)
  556. * @hw_index: Hardware index of the initialized LIF
  557. * @rsvd2: reserved byte(s)
  558. */
  559. struct ionic_lif_init_comp {
  560. u8 status;
  561. u8 rsvd;
  562. __le16 hw_index;
  563. u8 rsvd2[12];
  564. };
  565. /**
  566. * struct ionic_q_identify_cmd - queue identify command
  567. * @opcode: opcode
  568. * @rsvd: reserved byte(s)
  569. * @lif_type: LIF type (enum ionic_lif_type)
  570. * @type: Logical queue type (enum ionic_logical_qtype)
  571. * @ver: Highest queue type version that the driver supports
  572. * @rsvd2: reserved byte(s)
  573. */
  574. struct ionic_q_identify_cmd {
  575. u8 opcode;
  576. u8 rsvd;
  577. __le16 lif_type;
  578. u8 type;
  579. u8 ver;
  580. u8 rsvd2[58];
  581. };
  582. /**
  583. * struct ionic_q_identify_comp - queue identify command completion
  584. * @status: Status of the command (enum ionic_status_code)
  585. * @rsvd: reserved byte(s)
  586. * @comp_index: Index in the descriptor ring for which this is the completion
  587. * @ver: Queue type version that can be used with FW
  588. * @rsvd2: reserved byte(s)
  589. */
  590. struct ionic_q_identify_comp {
  591. u8 status;
  592. u8 rsvd;
  593. __le16 comp_index;
  594. u8 ver;
  595. u8 rsvd2[11];
  596. };
  597. /**
  598. * union ionic_q_identity - queue identity information
  599. * @version: Queue type version that can be used with FW
  600. * @supported: Bitfield of queue versions, first bit = ver 0
  601. * @rsvd: reserved byte(s)
  602. * @features: Queue features (enum ionic_q_feature, etc)
  603. * @desc_sz: Descriptor size
  604. * @comp_sz: Completion descriptor size
  605. * @sg_desc_sz: Scatter/Gather descriptor size
  606. * @max_sg_elems: Maximum number of Scatter/Gather elements
  607. * @sg_desc_stride: Number of Scatter/Gather elements per descriptor
  608. * @words: word access to struct contents
  609. */
  610. union ionic_q_identity {
  611. struct {
  612. u8 version;
  613. u8 supported;
  614. u8 rsvd[6];
  615. __le64 features;
  616. __le16 desc_sz;
  617. __le16 comp_sz;
  618. __le16 sg_desc_sz;
  619. __le16 max_sg_elems;
  620. __le16 sg_desc_stride;
  621. };
  622. __le32 words[478];
  623. };
  624. /**
  625. * struct ionic_q_init_cmd - Queue init command
  626. * @opcode: opcode
  627. * @rsvd: reserved byte(s)
  628. * @type: Logical queue type
  629. * @ver: Queue type version
  630. * @rsvd1: reserved byte(s)
  631. * @lif_index: LIF index
  632. * @index: (LIF, qtype) relative admin queue index
  633. * @intr_index: Interrupt control register index, or Event queue index
  634. * @pid: Process ID
  635. * @flags:
  636. * IRQ: Interrupt requested on completion
  637. * ENA: Enable the queue. If ENA=0 the queue is initialized
  638. * but remains disabled, to be later enabled with the
  639. * Queue Enable command. If ENA=1, then queue is
  640. * initialized and then enabled.
  641. * SG: Enable Scatter-Gather on the queue.
  642. * in number of descs. The actual ring size is
  643. * (1 << ring_size). For example, to
  644. * select a ring size of 64 descriptors write
  645. * ring_size = 6. The minimum ring_size value is 2
  646. * for a ring size of 4 descriptors. The maximum
  647. * ring_size value is 16 for a ring size of 64k
  648. * descriptors. Values of ring_size <2 and >16 are
  649. * reserved.
  650. * EQ: Enable the Event Queue
  651. * @cos: Class of service for this queue
  652. * @ring_size: Queue ring size, encoded as a log2(size)
  653. * @ring_base: Queue ring base address
  654. * @cq_ring_base: Completion queue ring base address
  655. * @sg_ring_base: Scatter/Gather ring base address
  656. * @rsvd2: reserved byte(s)
  657. * @features: Mask of queue features to enable, if not in the flags above.
  658. */
  659. struct ionic_q_init_cmd {
  660. u8 opcode;
  661. u8 rsvd;
  662. __le16 lif_index;
  663. u8 type;
  664. u8 ver;
  665. u8 rsvd1[2];
  666. __le32 index;
  667. __le16 pid;
  668. __le16 intr_index;
  669. __le16 flags;
  670. #define IONIC_QINIT_F_IRQ 0x01 /* Request interrupt on completion */
  671. #define IONIC_QINIT_F_ENA 0x02 /* Enable the queue */
  672. #define IONIC_QINIT_F_SG 0x04 /* Enable scatter/gather on the queue */
  673. #define IONIC_QINIT_F_EQ 0x08 /* Enable event queue */
  674. #define IONIC_QINIT_F_CMB 0x10 /* Enable cmb-based queue */
  675. #define IONIC_QINIT_F_DEBUG 0x80 /* Enable queue debugging */
  676. u8 cos;
  677. u8 ring_size;
  678. __le64 ring_base;
  679. __le64 cq_ring_base;
  680. __le64 sg_ring_base;
  681. u8 rsvd2[12];
  682. __le64 features;
  683. } __packed;
  684. /**
  685. * struct ionic_q_init_comp - Queue init command completion
  686. * @status: Status of the command (enum ionic_status_code)
  687. * @rsvd: reserved byte(s)
  688. * @comp_index: Index in the descriptor ring for which this is the completion
  689. * @hw_index: Hardware Queue ID
  690. * @hw_type: Hardware Queue type
  691. * @rsvd2: reserved byte(s)
  692. * @color: Color
  693. */
  694. struct ionic_q_init_comp {
  695. u8 status;
  696. u8 rsvd;
  697. __le16 comp_index;
  698. __le32 hw_index;
  699. u8 hw_type;
  700. u8 rsvd2[6];
  701. u8 color;
  702. };
  703. /* the device's internal addressing uses up to 52 bits */
  704. #define IONIC_ADDR_LEN 52
  705. #define IONIC_ADDR_MASK (BIT_ULL(IONIC_ADDR_LEN) - 1)
  706. enum ionic_txq_desc_opcode {
  707. IONIC_TXQ_DESC_OPCODE_CSUM_NONE = 0,
  708. IONIC_TXQ_DESC_OPCODE_CSUM_PARTIAL = 1,
  709. IONIC_TXQ_DESC_OPCODE_CSUM_HW = 2,
  710. IONIC_TXQ_DESC_OPCODE_TSO = 3,
  711. };
  712. /**
  713. * struct ionic_txq_desc - Ethernet Tx queue descriptor format
  714. * @cmd: Tx operation, see IONIC_TXQ_DESC_OPCODE_*:
  715. *
  716. * IONIC_TXQ_DESC_OPCODE_CSUM_NONE:
  717. * Non-offload send. No segmentation,
  718. * fragmentation or checksum calc/insertion is
  719. * performed by device; packet is prepared
  720. * to send by software stack and requires
  721. * no further manipulation from device.
  722. *
  723. * IONIC_TXQ_DESC_OPCODE_CSUM_PARTIAL:
  724. * Offload 16-bit L4 checksum
  725. * calculation/insertion. The device will
  726. * calculate the L4 checksum value and
  727. * insert the result in the packet's L4
  728. * header checksum field. The L4 checksum
  729. * is calculated starting at @csum_start bytes
  730. * into the packet to the end of the packet.
  731. * The checksum insertion position is given
  732. * in @csum_offset, which is the offset from
  733. * @csum_start to the checksum field in the L4
  734. * header. This feature is only applicable to
  735. * protocols such as TCP, UDP and ICMP where a
  736. * standard (i.e. the 'IP-style' checksum)
  737. * one's complement 16-bit checksum is used,
  738. * using an IP pseudo-header to seed the
  739. * calculation. Software will preload the L4
  740. * checksum field with the IP pseudo-header
  741. * checksum.
  742. *
  743. * For tunnel encapsulation, @csum_start and
  744. * @csum_offset refer to the inner L4
  745. * header. Supported tunnels encapsulations
  746. * are: IPIP, GRE, and UDP. If the @encap
  747. * is clear, no further processing by the
  748. * device is required; software will
  749. * calculate the outer header checksums. If
  750. * the @encap is set, the device will
  751. * offload the outer header checksums using
  752. * LCO (local checksum offload) (see
  753. * Documentation/networking/checksum-offloads.rst
  754. * for more info).
  755. *
  756. * IONIC_TXQ_DESC_OPCODE_CSUM_HW:
  757. * Offload 16-bit checksum computation to hardware.
  758. * If @csum_l3 is set then the packet's L3 checksum is
  759. * updated. Similarly, if @csum_l4 is set the L4
  760. * checksum is updated. If @encap is set then encap header
  761. * checksums are also updated.
  762. *
  763. * IONIC_TXQ_DESC_OPCODE_TSO:
  764. * Device performs TCP segmentation offload
  765. * (TSO). @hdr_len is the number of bytes
  766. * to the end of TCP header (the offset to
  767. * the TCP payload). @mss is the desired
  768. * MSS, the TCP payload length for each
  769. * segment. The device will calculate/
  770. * insert IP (IPv4 only) and TCP checksums
  771. * for each segment. In the first data
  772. * buffer containing the header template,
  773. * the driver will set IPv4 checksum to 0
  774. * and preload TCP checksum with the IP
  775. * pseudo header calculated with IP length = 0.
  776. *
  777. * Supported tunnel encapsulations are IPIP,
  778. * layer-3 GRE, and UDP. @hdr_len includes
  779. * both outer and inner headers. The driver
  780. * will set IPv4 checksum to zero and
  781. * preload TCP checksum with IP pseudo
  782. * header on the inner header.
  783. *
  784. * TCP ECN offload is supported. The device
  785. * will set CWR flag in the first segment if
  786. * CWR is set in the template header, and
  787. * clear CWR in remaining segments.
  788. * flags:
  789. * vlan:
  790. * Insert an L2 VLAN header using @vlan_tci
  791. * encap:
  792. * Calculate encap header checksum
  793. * csum_l3:
  794. * Compute L3 header checksum
  795. * csum_l4:
  796. * Compute L4 header checksum
  797. * tso_sot:
  798. * TSO start
  799. * tso_eot:
  800. * TSO end
  801. * num_sg_elems: Number of scatter-gather elements in SG
  802. * descriptor
  803. * addr: First data buffer's DMA address
  804. * (Subsequent data buffers are on txq_sg_desc)
  805. * @len: First data buffer's length, in bytes
  806. * @vlan_tci: VLAN tag to insert in the packet (if requested
  807. * by @V-bit). Includes .1p and .1q tags
  808. * @hword0: half word padding
  809. * @hdr_len: Length of packet headers, including
  810. * encapsulating outer header, if applicable
  811. * Valid for opcodes IONIC_TXQ_DESC_OPCODE_CALC_CSUM and
  812. * IONIC_TXQ_DESC_OPCODE_TSO. Should be set to zero for
  813. * all other modes. For
  814. * IONIC_TXQ_DESC_OPCODE_CALC_CSUM, @hdr_len is length
  815. * of headers up to inner-most L4 header. For
  816. * IONIC_TXQ_DESC_OPCODE_TSO, @hdr_len is up to
  817. * inner-most L4 payload, so inclusive of
  818. * inner-most L4 header.
  819. * @hword1: half word padding
  820. * @mss: Desired MSS value for TSO; only applicable for
  821. * IONIC_TXQ_DESC_OPCODE_TSO
  822. * @csum_start: Offset from packet to first byte checked in L4 checksum
  823. * @csum_offset: Offset from csum_start to L4 checksum field
  824. * @hword2: half word padding
  825. */
  826. struct ionic_txq_desc {
  827. __le64 cmd;
  828. #define IONIC_TXQ_DESC_OPCODE_MASK 0xf
  829. #define IONIC_TXQ_DESC_OPCODE_SHIFT 4
  830. #define IONIC_TXQ_DESC_FLAGS_MASK 0xf
  831. #define IONIC_TXQ_DESC_FLAGS_SHIFT 0
  832. #define IONIC_TXQ_DESC_NSGE_MASK 0xf
  833. #define IONIC_TXQ_DESC_NSGE_SHIFT 8
  834. #define IONIC_TXQ_DESC_ADDR_MASK (BIT_ULL(IONIC_ADDR_LEN) - 1)
  835. #define IONIC_TXQ_DESC_ADDR_SHIFT 12
  836. /* common flags */
  837. #define IONIC_TXQ_DESC_FLAG_VLAN 0x1
  838. #define IONIC_TXQ_DESC_FLAG_ENCAP 0x2
  839. /* flags for csum_hw opcode */
  840. #define IONIC_TXQ_DESC_FLAG_CSUM_L3 0x4
  841. #define IONIC_TXQ_DESC_FLAG_CSUM_L4 0x8
  842. /* flags for tso opcode */
  843. #define IONIC_TXQ_DESC_FLAG_TSO_SOT 0x4
  844. #define IONIC_TXQ_DESC_FLAG_TSO_EOT 0x8
  845. __le16 len;
  846. union {
  847. __le16 vlan_tci;
  848. __le16 hword0;
  849. };
  850. union {
  851. __le16 csum_start;
  852. __le16 hdr_len;
  853. __le16 hword1;
  854. };
  855. union {
  856. __le16 csum_offset;
  857. __le16 mss;
  858. __le16 hword2;
  859. };
  860. };
  861. static inline u64 encode_txq_desc_cmd(u8 opcode, u8 flags,
  862. u8 nsge, u64 addr)
  863. {
  864. u64 cmd;
  865. cmd = (opcode & IONIC_TXQ_DESC_OPCODE_MASK) << IONIC_TXQ_DESC_OPCODE_SHIFT;
  866. cmd |= (flags & IONIC_TXQ_DESC_FLAGS_MASK) << IONIC_TXQ_DESC_FLAGS_SHIFT;
  867. cmd |= (nsge & IONIC_TXQ_DESC_NSGE_MASK) << IONIC_TXQ_DESC_NSGE_SHIFT;
  868. cmd |= (addr & IONIC_TXQ_DESC_ADDR_MASK) << IONIC_TXQ_DESC_ADDR_SHIFT;
  869. return cmd;
  870. };
  871. static inline void decode_txq_desc_cmd(u64 cmd, u8 *opcode, u8 *flags,
  872. u8 *nsge, u64 *addr)
  873. {
  874. *opcode = (cmd >> IONIC_TXQ_DESC_OPCODE_SHIFT) & IONIC_TXQ_DESC_OPCODE_MASK;
  875. *flags = (cmd >> IONIC_TXQ_DESC_FLAGS_SHIFT) & IONIC_TXQ_DESC_FLAGS_MASK;
  876. *nsge = (cmd >> IONIC_TXQ_DESC_NSGE_SHIFT) & IONIC_TXQ_DESC_NSGE_MASK;
  877. *addr = (cmd >> IONIC_TXQ_DESC_ADDR_SHIFT) & IONIC_TXQ_DESC_ADDR_MASK;
  878. };
  879. /**
  880. * struct ionic_txq_sg_elem - Transmit scatter-gather (SG) descriptor element
  881. * @addr: DMA address of SG element data buffer
  882. * @len: Length of SG element data buffer, in bytes
  883. * @rsvd: reserved byte(s)
  884. */
  885. struct ionic_txq_sg_elem {
  886. __le64 addr;
  887. __le16 len;
  888. __le16 rsvd[3];
  889. };
  890. /**
  891. * struct ionic_txq_sg_desc - Transmit scatter-gather (SG) list
  892. * @elems: Scatter-gather elements
  893. */
  894. struct ionic_txq_sg_desc {
  895. #define IONIC_TX_MAX_SG_ELEMS 8
  896. #define IONIC_TX_SG_DESC_STRIDE 8
  897. struct ionic_txq_sg_elem elems[IONIC_TX_MAX_SG_ELEMS];
  898. };
  899. struct ionic_txq_sg_desc_v1 {
  900. #define IONIC_TX_MAX_SG_ELEMS_V1 15
  901. #define IONIC_TX_SG_DESC_STRIDE_V1 16
  902. struct ionic_txq_sg_elem elems[IONIC_TX_SG_DESC_STRIDE_V1];
  903. };
  904. /**
  905. * struct ionic_txq_comp - Ethernet transmit queue completion descriptor
  906. * @status: Status of the command (enum ionic_status_code)
  907. * @rsvd: reserved byte(s)
  908. * @comp_index: Index in the descriptor ring for which this is the completion
  909. * @rsvd2: reserved byte(s)
  910. * @color: Color bit
  911. */
  912. struct ionic_txq_comp {
  913. u8 status;
  914. u8 rsvd;
  915. __le16 comp_index;
  916. u8 rsvd2[11];
  917. u8 color;
  918. };
  919. enum ionic_rxq_desc_opcode {
  920. IONIC_RXQ_DESC_OPCODE_SIMPLE = 0,
  921. IONIC_RXQ_DESC_OPCODE_SG = 1,
  922. };
  923. /**
  924. * struct ionic_rxq_desc - Ethernet Rx queue descriptor format
  925. * @opcode: Rx operation, see IONIC_RXQ_DESC_OPCODE_*:
  926. *
  927. * IONIC_RXQ_DESC_OPCODE_SIMPLE:
  928. * Receive full packet into data buffer
  929. * starting at @addr. Results of
  930. * receive, including actual bytes received,
  931. * are recorded in Rx completion descriptor.
  932. *
  933. * @rsvd: reserved byte(s)
  934. * @len: Data buffer's length, in bytes
  935. * @addr: Data buffer's DMA address
  936. */
  937. struct ionic_rxq_desc {
  938. u8 opcode;
  939. u8 rsvd[5];
  940. __le16 len;
  941. __le64 addr;
  942. };
  943. /**
  944. * struct ionic_rxq_sg_elem - Receive scatter-gather (SG) descriptor element
  945. * @addr: DMA address of SG element data buffer
  946. * @len: Length of SG element data buffer, in bytes
  947. * @rsvd: reserved byte(s)
  948. */
  949. struct ionic_rxq_sg_elem {
  950. __le64 addr;
  951. __le16 len;
  952. __le16 rsvd[3];
  953. };
  954. /**
  955. * struct ionic_rxq_sg_desc - Receive scatter-gather (SG) list
  956. * @elems: Scatter-gather elements
  957. */
  958. struct ionic_rxq_sg_desc {
  959. #define IONIC_RX_MAX_SG_ELEMS 8
  960. #define IONIC_RX_SG_DESC_STRIDE 8
  961. struct ionic_rxq_sg_elem elems[IONIC_RX_SG_DESC_STRIDE];
  962. };
  963. /**
  964. * struct ionic_rxq_comp - Ethernet receive queue completion descriptor
  965. * @status: Status of the command (enum ionic_status_code)
  966. * @num_sg_elems: Number of SG elements used by this descriptor
  967. * @comp_index: Index in the descriptor ring for which this is the completion
  968. * @rss_hash: 32-bit RSS hash
  969. * @csum: 16-bit sum of the packet's L2 payload
  970. * If the packet's L2 payload is odd length, an extra
  971. * zero-value byte is included in the @csum calculation but
  972. * not included in @len.
  973. * @vlan_tci: VLAN tag stripped from the packet. Valid if @VLAN is
  974. * set. Includes .1p and .1q tags.
  975. * @len: Received packet length, in bytes. Excludes FCS.
  976. * @csum_calc L2 payload checksum is computed or not
  977. * @csum_flags: See IONIC_RXQ_COMP_CSUM_F_*:
  978. *
  979. * IONIC_RXQ_COMP_CSUM_F_TCP_OK:
  980. * The TCP checksum calculated by the device
  981. * matched the checksum in the receive packet's
  982. * TCP header.
  983. *
  984. * IONIC_RXQ_COMP_CSUM_F_TCP_BAD:
  985. * The TCP checksum calculated by the device did
  986. * not match the checksum in the receive packet's
  987. * TCP header.
  988. *
  989. * IONIC_RXQ_COMP_CSUM_F_UDP_OK:
  990. * The UDP checksum calculated by the device
  991. * matched the checksum in the receive packet's
  992. * UDP header
  993. *
  994. * IONIC_RXQ_COMP_CSUM_F_UDP_BAD:
  995. * The UDP checksum calculated by the device did
  996. * not match the checksum in the receive packet's
  997. * UDP header.
  998. *
  999. * IONIC_RXQ_COMP_CSUM_F_IP_OK:
  1000. * The IPv4 checksum calculated by the device
  1001. * matched the checksum in the receive packet's
  1002. * first IPv4 header. If the receive packet
  1003. * contains both a tunnel IPv4 header and a
  1004. * transport IPv4 header, the device validates the
  1005. * checksum for the both IPv4 headers.
  1006. *
  1007. * IONIC_RXQ_COMP_CSUM_F_IP_BAD:
  1008. * The IPv4 checksum calculated by the device did
  1009. * not match the checksum in the receive packet's
  1010. * first IPv4 header. If the receive packet
  1011. * contains both a tunnel IPv4 header and a
  1012. * transport IPv4 header, the device validates the
  1013. * checksum for both IP headers.
  1014. *
  1015. * IONIC_RXQ_COMP_CSUM_F_VLAN:
  1016. * The VLAN header was stripped and placed in @vlan_tci.
  1017. *
  1018. * IONIC_RXQ_COMP_CSUM_F_CALC:
  1019. * The checksum was calculated by the device.
  1020. *
  1021. * @pkt_type_color: Packet type and color bit; see IONIC_RXQ_COMP_PKT_TYPE_MASK
  1022. */
  1023. struct ionic_rxq_comp {
  1024. u8 status;
  1025. u8 num_sg_elems;
  1026. __le16 comp_index;
  1027. __le32 rss_hash;
  1028. __le16 csum;
  1029. __le16 vlan_tci;
  1030. __le16 len;
  1031. u8 csum_flags;
  1032. #define IONIC_RXQ_COMP_CSUM_F_TCP_OK 0x01
  1033. #define IONIC_RXQ_COMP_CSUM_F_TCP_BAD 0x02
  1034. #define IONIC_RXQ_COMP_CSUM_F_UDP_OK 0x04
  1035. #define IONIC_RXQ_COMP_CSUM_F_UDP_BAD 0x08
  1036. #define IONIC_RXQ_COMP_CSUM_F_IP_OK 0x10
  1037. #define IONIC_RXQ_COMP_CSUM_F_IP_BAD 0x20
  1038. #define IONIC_RXQ_COMP_CSUM_F_VLAN 0x40
  1039. #define IONIC_RXQ_COMP_CSUM_F_CALC 0x80
  1040. u8 pkt_type_color;
  1041. #define IONIC_RXQ_COMP_PKT_TYPE_MASK 0x7f
  1042. };
  1043. enum ionic_pkt_type {
  1044. IONIC_PKT_TYPE_NON_IP = 0x00,
  1045. IONIC_PKT_TYPE_IPV4 = 0x01,
  1046. IONIC_PKT_TYPE_IPV4_TCP = 0x03,
  1047. IONIC_PKT_TYPE_IPV4_UDP = 0x05,
  1048. IONIC_PKT_TYPE_IPV6 = 0x08,
  1049. IONIC_PKT_TYPE_IPV6_TCP = 0x18,
  1050. IONIC_PKT_TYPE_IPV6_UDP = 0x28,
  1051. /* below types are only used if encap offloads are enabled on lif */
  1052. IONIC_PKT_TYPE_ENCAP_NON_IP = 0x40,
  1053. IONIC_PKT_TYPE_ENCAP_IPV4 = 0x41,
  1054. IONIC_PKT_TYPE_ENCAP_IPV4_TCP = 0x43,
  1055. IONIC_PKT_TYPE_ENCAP_IPV4_UDP = 0x45,
  1056. IONIC_PKT_TYPE_ENCAP_IPV6 = 0x48,
  1057. IONIC_PKT_TYPE_ENCAP_IPV6_TCP = 0x58,
  1058. IONIC_PKT_TYPE_ENCAP_IPV6_UDP = 0x68,
  1059. };
  1060. enum ionic_eth_hw_features {
  1061. IONIC_ETH_HW_VLAN_TX_TAG = BIT(0),
  1062. IONIC_ETH_HW_VLAN_RX_STRIP = BIT(1),
  1063. IONIC_ETH_HW_VLAN_RX_FILTER = BIT(2),
  1064. IONIC_ETH_HW_RX_HASH = BIT(3),
  1065. IONIC_ETH_HW_RX_CSUM = BIT(4),
  1066. IONIC_ETH_HW_TX_SG = BIT(5),
  1067. IONIC_ETH_HW_RX_SG = BIT(6),
  1068. IONIC_ETH_HW_TX_CSUM = BIT(7),
  1069. IONIC_ETH_HW_TSO = BIT(8),
  1070. IONIC_ETH_HW_TSO_IPV6 = BIT(9),
  1071. IONIC_ETH_HW_TSO_ECN = BIT(10),
  1072. IONIC_ETH_HW_TSO_GRE = BIT(11),
  1073. IONIC_ETH_HW_TSO_GRE_CSUM = BIT(12),
  1074. IONIC_ETH_HW_TSO_IPXIP4 = BIT(13),
  1075. IONIC_ETH_HW_TSO_IPXIP6 = BIT(14),
  1076. IONIC_ETH_HW_TSO_UDP = BIT(15),
  1077. IONIC_ETH_HW_TSO_UDP_CSUM = BIT(16),
  1078. IONIC_ETH_HW_RX_CSUM_GENEVE = BIT(17),
  1079. IONIC_ETH_HW_TX_CSUM_GENEVE = BIT(18),
  1080. IONIC_ETH_HW_TSO_GENEVE = BIT(19),
  1081. IONIC_ETH_HW_TIMESTAMP = BIT(20),
  1082. };
  1083. /**
  1084. * enum ionic_pkt_class - Packet classification mask.
  1085. *
  1086. * Used with rx steering filter, packets indicated by the mask can be steered
  1087. * toward a specific receive queue.
  1088. *
  1089. * @IONIC_PKT_CLS_NTP_ALL: All NTP packets.
  1090. * @IONIC_PKT_CLS_PTP1_SYNC: PTPv1 sync
  1091. * @IONIC_PKT_CLS_PTP1_DREQ: PTPv1 delay-request
  1092. * @IONIC_PKT_CLS_PTP1_ALL: PTPv1 all packets
  1093. * @IONIC_PKT_CLS_PTP2_L4_SYNC: PTPv2-UDP sync
  1094. * @IONIC_PKT_CLS_PTP2_L4_DREQ: PTPv2-UDP delay-request
  1095. * @IONIC_PKT_CLS_PTP2_L4_ALL: PTPv2-UDP all packets
  1096. * @IONIC_PKT_CLS_PTP2_L2_SYNC: PTPv2-ETH sync
  1097. * @IONIC_PKT_CLS_PTP2_L2_DREQ: PTPv2-ETH delay-request
  1098. * @IONIC_PKT_CLS_PTP2_L2_ALL: PTPv2-ETH all packets
  1099. * @IONIC_PKT_CLS_PTP2_SYNC: PTPv2 sync
  1100. * @IONIC_PKT_CLS_PTP2_DREQ: PTPv2 delay-request
  1101. * @IONIC_PKT_CLS_PTP2_ALL: PTPv2 all packets
  1102. * @IONIC_PKT_CLS_PTP_SYNC: PTP sync
  1103. * @IONIC_PKT_CLS_PTP_DREQ: PTP delay-request
  1104. * @IONIC_PKT_CLS_PTP_ALL: PTP all packets
  1105. */
  1106. enum ionic_pkt_class {
  1107. IONIC_PKT_CLS_NTP_ALL = BIT(0),
  1108. IONIC_PKT_CLS_PTP1_SYNC = BIT(1),
  1109. IONIC_PKT_CLS_PTP1_DREQ = BIT(2),
  1110. IONIC_PKT_CLS_PTP1_ALL = BIT(3) |
  1111. IONIC_PKT_CLS_PTP1_SYNC | IONIC_PKT_CLS_PTP1_DREQ,
  1112. IONIC_PKT_CLS_PTP2_L4_SYNC = BIT(4),
  1113. IONIC_PKT_CLS_PTP2_L4_DREQ = BIT(5),
  1114. IONIC_PKT_CLS_PTP2_L4_ALL = BIT(6) |
  1115. IONIC_PKT_CLS_PTP2_L4_SYNC | IONIC_PKT_CLS_PTP2_L4_DREQ,
  1116. IONIC_PKT_CLS_PTP2_L2_SYNC = BIT(7),
  1117. IONIC_PKT_CLS_PTP2_L2_DREQ = BIT(8),
  1118. IONIC_PKT_CLS_PTP2_L2_ALL = BIT(9) |
  1119. IONIC_PKT_CLS_PTP2_L2_SYNC | IONIC_PKT_CLS_PTP2_L2_DREQ,
  1120. IONIC_PKT_CLS_PTP2_SYNC =
  1121. IONIC_PKT_CLS_PTP2_L4_SYNC | IONIC_PKT_CLS_PTP2_L2_SYNC,
  1122. IONIC_PKT_CLS_PTP2_DREQ =
  1123. IONIC_PKT_CLS_PTP2_L4_DREQ | IONIC_PKT_CLS_PTP2_L2_DREQ,
  1124. IONIC_PKT_CLS_PTP2_ALL =
  1125. IONIC_PKT_CLS_PTP2_L4_ALL | IONIC_PKT_CLS_PTP2_L2_ALL,
  1126. IONIC_PKT_CLS_PTP_SYNC =
  1127. IONIC_PKT_CLS_PTP1_SYNC | IONIC_PKT_CLS_PTP2_SYNC,
  1128. IONIC_PKT_CLS_PTP_DREQ =
  1129. IONIC_PKT_CLS_PTP1_DREQ | IONIC_PKT_CLS_PTP2_DREQ,
  1130. IONIC_PKT_CLS_PTP_ALL =
  1131. IONIC_PKT_CLS_PTP1_ALL | IONIC_PKT_CLS_PTP2_ALL,
  1132. };
  1133. /**
  1134. * struct ionic_q_control_cmd - Queue control command
  1135. * @opcode: opcode
  1136. * @type: Queue type
  1137. * @lif_index: LIF index
  1138. * @index: Queue index
  1139. * @oper: Operation (enum ionic_q_control_oper)
  1140. * @rsvd: reserved byte(s)
  1141. */
  1142. struct ionic_q_control_cmd {
  1143. u8 opcode;
  1144. u8 type;
  1145. __le16 lif_index;
  1146. __le32 index;
  1147. u8 oper;
  1148. u8 rsvd[55];
  1149. };
  1150. typedef struct ionic_admin_comp ionic_q_control_comp;
  1151. enum ionic_q_control_oper {
  1152. IONIC_Q_DISABLE = 0,
  1153. IONIC_Q_ENABLE = 1,
  1154. IONIC_Q_HANG_RESET = 2,
  1155. };
  1156. /**
  1157. * enum ionic_phy_type - Physical connection type
  1158. * @IONIC_PHY_TYPE_NONE: No PHY installed
  1159. * @IONIC_PHY_TYPE_COPPER: Copper PHY
  1160. * @IONIC_PHY_TYPE_FIBER: Fiber PHY
  1161. */
  1162. enum ionic_phy_type {
  1163. IONIC_PHY_TYPE_NONE = 0,
  1164. IONIC_PHY_TYPE_COPPER = 1,
  1165. IONIC_PHY_TYPE_FIBER = 2,
  1166. };
  1167. /**
  1168. * enum ionic_xcvr_state - Transceiver status
  1169. * @IONIC_XCVR_STATE_REMOVED: Transceiver removed
  1170. * @IONIC_XCVR_STATE_INSERTED: Transceiver inserted
  1171. * @IONIC_XCVR_STATE_PENDING: Transceiver pending
  1172. * @IONIC_XCVR_STATE_SPROM_READ: Transceiver data read
  1173. * @IONIC_XCVR_STATE_SPROM_READ_ERR: Transceiver data read error
  1174. */
  1175. enum ionic_xcvr_state {
  1176. IONIC_XCVR_STATE_REMOVED = 0,
  1177. IONIC_XCVR_STATE_INSERTED = 1,
  1178. IONIC_XCVR_STATE_PENDING = 2,
  1179. IONIC_XCVR_STATE_SPROM_READ = 3,
  1180. IONIC_XCVR_STATE_SPROM_READ_ERR = 4,
  1181. };
  1182. /*
  1183. * enum ionic_xcvr_pid - Supported link modes
  1184. */
  1185. enum ionic_xcvr_pid {
  1186. IONIC_XCVR_PID_UNKNOWN = 0,
  1187. /* CU */
  1188. IONIC_XCVR_PID_QSFP_100G_CR4 = 1,
  1189. IONIC_XCVR_PID_QSFP_40GBASE_CR4 = 2,
  1190. IONIC_XCVR_PID_SFP_25GBASE_CR_S = 3,
  1191. IONIC_XCVR_PID_SFP_25GBASE_CR_L = 4,
  1192. IONIC_XCVR_PID_SFP_25GBASE_CR_N = 5,
  1193. /* Fiber */
  1194. IONIC_XCVR_PID_QSFP_100G_AOC = 50,
  1195. IONIC_XCVR_PID_QSFP_100G_ACC = 51,
  1196. IONIC_XCVR_PID_QSFP_100G_SR4 = 52,
  1197. IONIC_XCVR_PID_QSFP_100G_LR4 = 53,
  1198. IONIC_XCVR_PID_QSFP_100G_ER4 = 54,
  1199. IONIC_XCVR_PID_QSFP_40GBASE_ER4 = 55,
  1200. IONIC_XCVR_PID_QSFP_40GBASE_SR4 = 56,
  1201. IONIC_XCVR_PID_QSFP_40GBASE_LR4 = 57,
  1202. IONIC_XCVR_PID_QSFP_40GBASE_AOC = 58,
  1203. IONIC_XCVR_PID_SFP_25GBASE_SR = 59,
  1204. IONIC_XCVR_PID_SFP_25GBASE_LR = 60,
  1205. IONIC_XCVR_PID_SFP_25GBASE_ER = 61,
  1206. IONIC_XCVR_PID_SFP_25GBASE_AOC = 62,
  1207. IONIC_XCVR_PID_SFP_10GBASE_SR = 63,
  1208. IONIC_XCVR_PID_SFP_10GBASE_LR = 64,
  1209. IONIC_XCVR_PID_SFP_10GBASE_LRM = 65,
  1210. IONIC_XCVR_PID_SFP_10GBASE_ER = 66,
  1211. IONIC_XCVR_PID_SFP_10GBASE_AOC = 67,
  1212. IONIC_XCVR_PID_SFP_10GBASE_CU = 68,
  1213. IONIC_XCVR_PID_QSFP_100G_CWDM4 = 69,
  1214. IONIC_XCVR_PID_QSFP_100G_PSM4 = 70,
  1215. IONIC_XCVR_PID_SFP_25GBASE_ACC = 71,
  1216. IONIC_XCVR_PID_SFP_10GBASE_T = 72,
  1217. IONIC_XCVR_PID_SFP_1000BASE_T = 73,
  1218. };
  1219. /**
  1220. * enum ionic_port_type - Port types
  1221. * @IONIC_PORT_TYPE_NONE: Port type not configured
  1222. * @IONIC_PORT_TYPE_ETH: Port carries ethernet traffic (inband)
  1223. * @IONIC_PORT_TYPE_MGMT: Port carries mgmt traffic (out-of-band)
  1224. */
  1225. enum ionic_port_type {
  1226. IONIC_PORT_TYPE_NONE = 0,
  1227. IONIC_PORT_TYPE_ETH = 1,
  1228. IONIC_PORT_TYPE_MGMT = 2,
  1229. };
  1230. /**
  1231. * enum ionic_port_admin_state - Port config state
  1232. * @IONIC_PORT_ADMIN_STATE_NONE: Port admin state not configured
  1233. * @IONIC_PORT_ADMIN_STATE_DOWN: Port admin disabled
  1234. * @IONIC_PORT_ADMIN_STATE_UP: Port admin enabled
  1235. */
  1236. enum ionic_port_admin_state {
  1237. IONIC_PORT_ADMIN_STATE_NONE = 0,
  1238. IONIC_PORT_ADMIN_STATE_DOWN = 1,
  1239. IONIC_PORT_ADMIN_STATE_UP = 2,
  1240. };
  1241. /**
  1242. * enum ionic_port_oper_status - Port operational status
  1243. * @IONIC_PORT_OPER_STATUS_NONE: Port disabled
  1244. * @IONIC_PORT_OPER_STATUS_UP: Port link status up
  1245. * @IONIC_PORT_OPER_STATUS_DOWN: Port link status down
  1246. */
  1247. enum ionic_port_oper_status {
  1248. IONIC_PORT_OPER_STATUS_NONE = 0,
  1249. IONIC_PORT_OPER_STATUS_UP = 1,
  1250. IONIC_PORT_OPER_STATUS_DOWN = 2,
  1251. };
  1252. /**
  1253. * enum ionic_port_fec_type - Ethernet Forward error correction (FEC) modes
  1254. * @IONIC_PORT_FEC_TYPE_NONE: FEC Disabled
  1255. * @IONIC_PORT_FEC_TYPE_FC: FireCode FEC
  1256. * @IONIC_PORT_FEC_TYPE_RS: ReedSolomon FEC
  1257. */
  1258. enum ionic_port_fec_type {
  1259. IONIC_PORT_FEC_TYPE_NONE = 0,
  1260. IONIC_PORT_FEC_TYPE_FC = 1,
  1261. IONIC_PORT_FEC_TYPE_RS = 2,
  1262. };
  1263. /**
  1264. * enum ionic_port_pause_type - Ethernet pause (flow control) modes
  1265. * @IONIC_PORT_PAUSE_TYPE_NONE: Disable Pause
  1266. * @IONIC_PORT_PAUSE_TYPE_LINK: Link level pause
  1267. * @IONIC_PORT_PAUSE_TYPE_PFC: Priority-Flow Control
  1268. */
  1269. enum ionic_port_pause_type {
  1270. IONIC_PORT_PAUSE_TYPE_NONE = 0,
  1271. IONIC_PORT_PAUSE_TYPE_LINK = 1,
  1272. IONIC_PORT_PAUSE_TYPE_PFC = 2,
  1273. };
  1274. /**
  1275. * enum ionic_port_loopback_mode - Loopback modes
  1276. * @IONIC_PORT_LOOPBACK_MODE_NONE: Disable loopback
  1277. * @IONIC_PORT_LOOPBACK_MODE_MAC: MAC loopback
  1278. * @IONIC_PORT_LOOPBACK_MODE_PHY: PHY/SerDes loopback
  1279. */
  1280. enum ionic_port_loopback_mode {
  1281. IONIC_PORT_LOOPBACK_MODE_NONE = 0,
  1282. IONIC_PORT_LOOPBACK_MODE_MAC = 1,
  1283. IONIC_PORT_LOOPBACK_MODE_PHY = 2,
  1284. };
  1285. /**
  1286. * struct ionic_xcvr_status - Transceiver Status information
  1287. * @state: Transceiver status (enum ionic_xcvr_state)
  1288. * @phy: Physical connection type (enum ionic_phy_type)
  1289. * @pid: Transceiver link mode (enum ionic_xcvr_pid)
  1290. * @sprom: Transceiver sprom contents
  1291. */
  1292. struct ionic_xcvr_status {
  1293. u8 state;
  1294. u8 phy;
  1295. __le16 pid;
  1296. u8 sprom[256];
  1297. };
  1298. /**
  1299. * union ionic_port_config - Port configuration
  1300. * @speed: port speed (in Mbps)
  1301. * @mtu: mtu
  1302. * @state: port admin state (enum ionic_port_admin_state)
  1303. * @an_enable: autoneg enable
  1304. * @fec_type: fec type (enum ionic_port_fec_type)
  1305. * @pause_type: pause type (enum ionic_port_pause_type)
  1306. * @loopback_mode: loopback mode (enum ionic_port_loopback_mode)
  1307. * @words: word access to struct contents
  1308. */
  1309. union ionic_port_config {
  1310. struct {
  1311. #define IONIC_SPEED_100G 100000 /* 100G in Mbps */
  1312. #define IONIC_SPEED_50G 50000 /* 50G in Mbps */
  1313. #define IONIC_SPEED_40G 40000 /* 40G in Mbps */
  1314. #define IONIC_SPEED_25G 25000 /* 25G in Mbps */
  1315. #define IONIC_SPEED_10G 10000 /* 10G in Mbps */
  1316. #define IONIC_SPEED_1G 1000 /* 1G in Mbps */
  1317. __le32 speed;
  1318. __le32 mtu;
  1319. u8 state;
  1320. u8 an_enable;
  1321. u8 fec_type;
  1322. #define IONIC_PAUSE_TYPE_MASK 0x0f
  1323. #define IONIC_PAUSE_FLAGS_MASK 0xf0
  1324. #define IONIC_PAUSE_F_TX 0x10
  1325. #define IONIC_PAUSE_F_RX 0x20
  1326. u8 pause_type;
  1327. u8 loopback_mode;
  1328. };
  1329. __le32 words[64];
  1330. };
  1331. /**
  1332. * struct ionic_port_status - Port Status information
  1333. * @status: link status (enum ionic_port_oper_status)
  1334. * @id: port id
  1335. * @speed: link speed (in Mbps)
  1336. * @link_down_count: number of times link went from up to down
  1337. * @fec_type: fec type (enum ionic_port_fec_type)
  1338. * @rsvd: reserved byte(s)
  1339. * @xcvr: transceiver status
  1340. */
  1341. struct ionic_port_status {
  1342. __le32 id;
  1343. __le32 speed;
  1344. u8 status;
  1345. __le16 link_down_count;
  1346. u8 fec_type;
  1347. u8 rsvd[48];
  1348. struct ionic_xcvr_status xcvr;
  1349. } __packed;
  1350. /**
  1351. * struct ionic_port_identify_cmd - Port identify command
  1352. * @opcode: opcode
  1353. * @index: port index
  1354. * @ver: Highest version of identify supported by driver
  1355. * @rsvd: reserved byte(s)
  1356. */
  1357. struct ionic_port_identify_cmd {
  1358. u8 opcode;
  1359. u8 index;
  1360. u8 ver;
  1361. u8 rsvd[61];
  1362. };
  1363. /**
  1364. * struct ionic_port_identify_comp - Port identify command completion
  1365. * @status: Status of the command (enum ionic_status_code)
  1366. * @ver: Version of identify returned by device
  1367. * @rsvd: reserved byte(s)
  1368. */
  1369. struct ionic_port_identify_comp {
  1370. u8 status;
  1371. u8 ver;
  1372. u8 rsvd[14];
  1373. };
  1374. /**
  1375. * struct ionic_port_init_cmd - Port initialization command
  1376. * @opcode: opcode
  1377. * @index: port index
  1378. * @rsvd: reserved byte(s)
  1379. * @info_pa: destination address for port info (struct ionic_port_info)
  1380. * @rsvd2: reserved byte(s)
  1381. */
  1382. struct ionic_port_init_cmd {
  1383. u8 opcode;
  1384. u8 index;
  1385. u8 rsvd[6];
  1386. __le64 info_pa;
  1387. u8 rsvd2[48];
  1388. };
  1389. /**
  1390. * struct ionic_port_init_comp - Port initialization command completion
  1391. * @status: Status of the command (enum ionic_status_code)
  1392. * @rsvd: reserved byte(s)
  1393. */
  1394. struct ionic_port_init_comp {
  1395. u8 status;
  1396. u8 rsvd[15];
  1397. };
  1398. /**
  1399. * struct ionic_port_reset_cmd - Port reset command
  1400. * @opcode: opcode
  1401. * @index: port index
  1402. * @rsvd: reserved byte(s)
  1403. */
  1404. struct ionic_port_reset_cmd {
  1405. u8 opcode;
  1406. u8 index;
  1407. u8 rsvd[62];
  1408. };
  1409. /**
  1410. * struct ionic_port_reset_comp - Port reset command completion
  1411. * @status: Status of the command (enum ionic_status_code)
  1412. * @rsvd: reserved byte(s)
  1413. */
  1414. struct ionic_port_reset_comp {
  1415. u8 status;
  1416. u8 rsvd[15];
  1417. };
  1418. /**
  1419. * enum ionic_stats_ctl_cmd - List of commands for stats control
  1420. * @IONIC_STATS_CTL_RESET: Reset statistics
  1421. */
  1422. enum ionic_stats_ctl_cmd {
  1423. IONIC_STATS_CTL_RESET = 0,
  1424. };
  1425. /**
  1426. * enum ionic_txstamp_mode - List of TX Timestamping Modes
  1427. * @IONIC_TXSTAMP_OFF: Disable TX hardware timetamping.
  1428. * @IONIC_TXSTAMP_ON: Enable local TX hardware timetamping.
  1429. * @IONIC_TXSTAMP_ONESTEP_SYNC: Modify TX PTP Sync packets.
  1430. * @IONIC_TXSTAMP_ONESTEP_P2P: Modify TX PTP Sync and PDelayResp.
  1431. */
  1432. enum ionic_txstamp_mode {
  1433. IONIC_TXSTAMP_OFF = 0,
  1434. IONIC_TXSTAMP_ON = 1,
  1435. IONIC_TXSTAMP_ONESTEP_SYNC = 2,
  1436. IONIC_TXSTAMP_ONESTEP_P2P = 3,
  1437. };
  1438. /**
  1439. * enum ionic_port_attr - List of device attributes
  1440. * @IONIC_PORT_ATTR_STATE: Port state attribute
  1441. * @IONIC_PORT_ATTR_SPEED: Port speed attribute
  1442. * @IONIC_PORT_ATTR_MTU: Port MTU attribute
  1443. * @IONIC_PORT_ATTR_AUTONEG: Port autonegotiation attribute
  1444. * @IONIC_PORT_ATTR_FEC: Port FEC attribute
  1445. * @IONIC_PORT_ATTR_PAUSE: Port pause attribute
  1446. * @IONIC_PORT_ATTR_LOOPBACK: Port loopback attribute
  1447. * @IONIC_PORT_ATTR_STATS_CTRL: Port statistics control attribute
  1448. */
  1449. enum ionic_port_attr {
  1450. IONIC_PORT_ATTR_STATE = 0,
  1451. IONIC_PORT_ATTR_SPEED = 1,
  1452. IONIC_PORT_ATTR_MTU = 2,
  1453. IONIC_PORT_ATTR_AUTONEG = 3,
  1454. IONIC_PORT_ATTR_FEC = 4,
  1455. IONIC_PORT_ATTR_PAUSE = 5,
  1456. IONIC_PORT_ATTR_LOOPBACK = 6,
  1457. IONIC_PORT_ATTR_STATS_CTRL = 7,
  1458. };
  1459. /**
  1460. * struct ionic_port_setattr_cmd - Set port attributes on the NIC
  1461. * @opcode: Opcode
  1462. * @index: Port index
  1463. * @attr: Attribute type (enum ionic_port_attr)
  1464. * @rsvd: reserved byte(s)
  1465. * @state: Port state
  1466. * @speed: Port speed
  1467. * @mtu: Port MTU
  1468. * @an_enable: Port autonegotiation setting
  1469. * @fec_type: Port FEC type setting
  1470. * @pause_type: Port pause type setting
  1471. * @loopback_mode: Port loopback mode
  1472. * @stats_ctl: Port stats setting
  1473. * @rsvd2: reserved byte(s)
  1474. */
  1475. struct ionic_port_setattr_cmd {
  1476. u8 opcode;
  1477. u8 index;
  1478. u8 attr;
  1479. u8 rsvd;
  1480. union {
  1481. u8 state;
  1482. __le32 speed;
  1483. __le32 mtu;
  1484. u8 an_enable;
  1485. u8 fec_type;
  1486. u8 pause_type;
  1487. u8 loopback_mode;
  1488. u8 stats_ctl;
  1489. u8 rsvd2[60];
  1490. };
  1491. };
  1492. /**
  1493. * struct ionic_port_setattr_comp - Port set attr command completion
  1494. * @status: Status of the command (enum ionic_status_code)
  1495. * @rsvd: reserved byte(s)
  1496. * @color: Color bit
  1497. */
  1498. struct ionic_port_setattr_comp {
  1499. u8 status;
  1500. u8 rsvd[14];
  1501. u8 color;
  1502. };
  1503. /**
  1504. * struct ionic_port_getattr_cmd - Get port attributes from the NIC
  1505. * @opcode: Opcode
  1506. * @index: port index
  1507. * @attr: Attribute type (enum ionic_port_attr)
  1508. * @rsvd: reserved byte(s)
  1509. */
  1510. struct ionic_port_getattr_cmd {
  1511. u8 opcode;
  1512. u8 index;
  1513. u8 attr;
  1514. u8 rsvd[61];
  1515. };
  1516. /**
  1517. * struct ionic_port_getattr_comp - Port get attr command completion
  1518. * @status: Status of the command (enum ionic_status_code)
  1519. * @rsvd: reserved byte(s)
  1520. * @state: Port state
  1521. * @speed: Port speed
  1522. * @mtu: Port MTU
  1523. * @an_enable: Port autonegotiation setting
  1524. * @fec_type: Port FEC type setting
  1525. * @pause_type: Port pause type setting
  1526. * @loopback_mode: Port loopback mode
  1527. * @rsvd2: reserved byte(s)
  1528. * @color: Color bit
  1529. */
  1530. struct ionic_port_getattr_comp {
  1531. u8 status;
  1532. u8 rsvd[3];
  1533. union {
  1534. u8 state;
  1535. __le32 speed;
  1536. __le32 mtu;
  1537. u8 an_enable;
  1538. u8 fec_type;
  1539. u8 pause_type;
  1540. u8 loopback_mode;
  1541. u8 rsvd2[11];
  1542. } __packed;
  1543. u8 color;
  1544. };
  1545. /**
  1546. * struct ionic_lif_status - LIF status register
  1547. * @eid: most recent NotifyQ event id
  1548. * @port_num: port the LIF is connected to
  1549. * @rsvd: reserved byte(s)
  1550. * @link_status: port status (enum ionic_port_oper_status)
  1551. * @link_speed: speed of link in Mbps
  1552. * @link_down_count: number of times link went from up to down
  1553. * @rsvd2: reserved byte(s)
  1554. */
  1555. struct ionic_lif_status {
  1556. __le64 eid;
  1557. u8 port_num;
  1558. u8 rsvd;
  1559. __le16 link_status;
  1560. __le32 link_speed; /* units of 1Mbps: eg 10000 = 10Gbps */
  1561. __le16 link_down_count;
  1562. u8 rsvd2[46];
  1563. };
  1564. /**
  1565. * struct ionic_lif_reset_cmd - LIF reset command
  1566. * @opcode: opcode
  1567. * @rsvd: reserved byte(s)
  1568. * @index: LIF index
  1569. * @rsvd2: reserved byte(s)
  1570. */
  1571. struct ionic_lif_reset_cmd {
  1572. u8 opcode;
  1573. u8 rsvd;
  1574. __le16 index;
  1575. __le32 rsvd2[15];
  1576. };
  1577. typedef struct ionic_admin_comp ionic_lif_reset_comp;
  1578. enum ionic_dev_state {
  1579. IONIC_DEV_DISABLE = 0,
  1580. IONIC_DEV_ENABLE = 1,
  1581. IONIC_DEV_HANG_RESET = 2,
  1582. };
  1583. /**
  1584. * enum ionic_dev_attr - List of device attributes
  1585. * @IONIC_DEV_ATTR_STATE: Device state attribute
  1586. * @IONIC_DEV_ATTR_NAME: Device name attribute
  1587. * @IONIC_DEV_ATTR_FEATURES: Device feature attributes
  1588. */
  1589. enum ionic_dev_attr {
  1590. IONIC_DEV_ATTR_STATE = 0,
  1591. IONIC_DEV_ATTR_NAME = 1,
  1592. IONIC_DEV_ATTR_FEATURES = 2,
  1593. };
  1594. /**
  1595. * struct ionic_dev_setattr_cmd - Set Device attributes on the NIC
  1596. * @opcode: Opcode
  1597. * @attr: Attribute type (enum ionic_dev_attr)
  1598. * @rsvd: reserved byte(s)
  1599. * @state: Device state (enum ionic_dev_state)
  1600. * @name: The bus info, e.g. PCI slot-device-function, 0 terminated
  1601. * @features: Device features
  1602. * @rsvd2: reserved byte(s)
  1603. */
  1604. struct ionic_dev_setattr_cmd {
  1605. u8 opcode;
  1606. u8 attr;
  1607. __le16 rsvd;
  1608. union {
  1609. u8 state;
  1610. char name[IONIC_IFNAMSIZ];
  1611. __le64 features;
  1612. u8 rsvd2[60];
  1613. } __packed;
  1614. };
  1615. /**
  1616. * struct ionic_dev_setattr_comp - Device set attr command completion
  1617. * @status: Status of the command (enum ionic_status_code)
  1618. * @rsvd: reserved byte(s)
  1619. * @features: Device features
  1620. * @rsvd2: reserved byte(s)
  1621. * @color: Color bit
  1622. */
  1623. struct ionic_dev_setattr_comp {
  1624. u8 status;
  1625. u8 rsvd[3];
  1626. union {
  1627. __le64 features;
  1628. u8 rsvd2[11];
  1629. } __packed;
  1630. u8 color;
  1631. };
  1632. /**
  1633. * struct ionic_dev_getattr_cmd - Get Device attributes from the NIC
  1634. * @opcode: opcode
  1635. * @attr: Attribute type (enum ionic_dev_attr)
  1636. * @rsvd: reserved byte(s)
  1637. */
  1638. struct ionic_dev_getattr_cmd {
  1639. u8 opcode;
  1640. u8 attr;
  1641. u8 rsvd[62];
  1642. };
  1643. /**
  1644. * struct ionic_dev_getattr_comp - Device set attr command completion
  1645. * @status: Status of the command (enum ionic_status_code)
  1646. * @rsvd: reserved byte(s)
  1647. * @features: Device features
  1648. * @rsvd2: reserved byte(s)
  1649. * @color: Color bit
  1650. */
  1651. struct ionic_dev_getattr_comp {
  1652. u8 status;
  1653. u8 rsvd[3];
  1654. union {
  1655. __le64 features;
  1656. u8 rsvd2[11];
  1657. } __packed;
  1658. u8 color;
  1659. };
  1660. /*
  1661. * RSS parameters
  1662. */
  1663. #define IONIC_RSS_HASH_KEY_SIZE 40
  1664. enum ionic_rss_hash_types {
  1665. IONIC_RSS_TYPE_IPV4 = BIT(0),
  1666. IONIC_RSS_TYPE_IPV4_TCP = BIT(1),
  1667. IONIC_RSS_TYPE_IPV4_UDP = BIT(2),
  1668. IONIC_RSS_TYPE_IPV6 = BIT(3),
  1669. IONIC_RSS_TYPE_IPV6_TCP = BIT(4),
  1670. IONIC_RSS_TYPE_IPV6_UDP = BIT(5),
  1671. };
  1672. /**
  1673. * enum ionic_lif_attr - List of LIF attributes
  1674. * @IONIC_LIF_ATTR_STATE: LIF state attribute
  1675. * @IONIC_LIF_ATTR_NAME: LIF name attribute
  1676. * @IONIC_LIF_ATTR_MTU: LIF MTU attribute
  1677. * @IONIC_LIF_ATTR_MAC: LIF MAC attribute
  1678. * @IONIC_LIF_ATTR_FEATURES: LIF features attribute
  1679. * @IONIC_LIF_ATTR_RSS: LIF RSS attribute
  1680. * @IONIC_LIF_ATTR_STATS_CTRL: LIF statistics control attribute
  1681. * @IONIC_LIF_ATTR_TXSTAMP: LIF TX timestamping mode
  1682. * @IONIC_LIF_ATTR_MAX: maximum attribute value
  1683. */
  1684. enum ionic_lif_attr {
  1685. IONIC_LIF_ATTR_STATE = 0,
  1686. IONIC_LIF_ATTR_NAME = 1,
  1687. IONIC_LIF_ATTR_MTU = 2,
  1688. IONIC_LIF_ATTR_MAC = 3,
  1689. IONIC_LIF_ATTR_FEATURES = 4,
  1690. IONIC_LIF_ATTR_RSS = 5,
  1691. IONIC_LIF_ATTR_STATS_CTRL = 6,
  1692. IONIC_LIF_ATTR_TXSTAMP = 7,
  1693. IONIC_LIF_ATTR_MAX = 255,
  1694. };
  1695. /**
  1696. * struct ionic_lif_setattr_cmd - Set LIF attributes on the NIC
  1697. * @opcode: Opcode
  1698. * @attr: Attribute type (enum ionic_lif_attr)
  1699. * @index: LIF index
  1700. * @state: LIF state (enum ionic_lif_state)
  1701. * @name: The netdev name string, 0 terminated
  1702. * @mtu: Mtu
  1703. * @mac: Station mac
  1704. * @features: Features (enum ionic_eth_hw_features)
  1705. * @rss: RSS properties
  1706. * @rss.types: The hash types to enable (see rss_hash_types)
  1707. * @rss.key: The hash secret key
  1708. * @rss.rsvd: reserved byte(s)
  1709. * @rss.addr: Address for the indirection table shared memory
  1710. * @stats_ctl: stats control commands (enum ionic_stats_ctl_cmd)
  1711. * @txstamp_mode: TX Timestamping Mode (enum ionic_txstamp_mode)
  1712. * @rsvd: reserved byte(s)
  1713. */
  1714. struct ionic_lif_setattr_cmd {
  1715. u8 opcode;
  1716. u8 attr;
  1717. __le16 index;
  1718. union {
  1719. u8 state;
  1720. char name[IONIC_IFNAMSIZ];
  1721. __le32 mtu;
  1722. u8 mac[6];
  1723. __le64 features;
  1724. struct {
  1725. __le16 types;
  1726. u8 key[IONIC_RSS_HASH_KEY_SIZE];
  1727. u8 rsvd[6];
  1728. __le64 addr;
  1729. } rss;
  1730. u8 stats_ctl;
  1731. __le16 txstamp_mode;
  1732. u8 rsvd[60];
  1733. } __packed;
  1734. };
  1735. /**
  1736. * struct ionic_lif_setattr_comp - LIF set attr command completion
  1737. * @status: Status of the command (enum ionic_status_code)
  1738. * @rsvd: reserved byte(s)
  1739. * @comp_index: Index in the descriptor ring for which this is the completion
  1740. * @features: features (enum ionic_eth_hw_features)
  1741. * @rsvd2: reserved byte(s)
  1742. * @color: Color bit
  1743. */
  1744. struct ionic_lif_setattr_comp {
  1745. u8 status;
  1746. u8 rsvd;
  1747. __le16 comp_index;
  1748. union {
  1749. __le64 features;
  1750. u8 rsvd2[11];
  1751. } __packed;
  1752. u8 color;
  1753. };
  1754. /**
  1755. * struct ionic_lif_getattr_cmd - Get LIF attributes from the NIC
  1756. * @opcode: Opcode
  1757. * @attr: Attribute type (enum ionic_lif_attr)
  1758. * @index: LIF index
  1759. * @rsvd: reserved byte(s)
  1760. */
  1761. struct ionic_lif_getattr_cmd {
  1762. u8 opcode;
  1763. u8 attr;
  1764. __le16 index;
  1765. u8 rsvd[60];
  1766. };
  1767. /**
  1768. * struct ionic_lif_getattr_comp - LIF get attr command completion
  1769. * @status: Status of the command (enum ionic_status_code)
  1770. * @rsvd: reserved byte(s)
  1771. * @comp_index: Index in the descriptor ring for which this is the completion
  1772. * @state: LIF state (enum ionic_lif_state)
  1773. * @mtu: Mtu
  1774. * @mac: Station mac
  1775. * @features: Features (enum ionic_eth_hw_features)
  1776. * @txstamp_mode: TX Timestamping Mode (enum ionic_txstamp_mode)
  1777. * @rsvd2: reserved byte(s)
  1778. * @color: Color bit
  1779. */
  1780. struct ionic_lif_getattr_comp {
  1781. u8 status;
  1782. u8 rsvd;
  1783. __le16 comp_index;
  1784. union {
  1785. u8 state;
  1786. __le32 mtu;
  1787. u8 mac[6];
  1788. __le64 features;
  1789. __le16 txstamp_mode;
  1790. u8 rsvd2[11];
  1791. } __packed;
  1792. u8 color;
  1793. };
  1794. /**
  1795. * struct ionic_lif_setphc_cmd - Set LIF PTP Hardware Clock
  1796. * @opcode: Opcode
  1797. * @rsvd1: reserved byte(s)
  1798. * @lif_index: LIF index
  1799. * @rsvd2: reserved byte(s)
  1800. * @tick: Hardware stamp tick of an instant in time.
  1801. * @nsec: Nanosecond stamp of the same instant.
  1802. * @frac: Fractional nanoseconds at the same instant.
  1803. * @mult: Cycle to nanosecond multiplier.
  1804. * @shift: Cycle to nanosecond divisor (power of two).
  1805. * @rsvd3: reserved byte(s)
  1806. */
  1807. struct ionic_lif_setphc_cmd {
  1808. u8 opcode;
  1809. u8 rsvd1;
  1810. __le16 lif_index;
  1811. u8 rsvd2[4];
  1812. __le64 tick;
  1813. __le64 nsec;
  1814. __le64 frac;
  1815. __le32 mult;
  1816. __le32 shift;
  1817. u8 rsvd3[24];
  1818. };
  1819. enum ionic_rx_mode {
  1820. IONIC_RX_MODE_F_UNICAST = BIT(0),
  1821. IONIC_RX_MODE_F_MULTICAST = BIT(1),
  1822. IONIC_RX_MODE_F_BROADCAST = BIT(2),
  1823. IONIC_RX_MODE_F_PROMISC = BIT(3),
  1824. IONIC_RX_MODE_F_ALLMULTI = BIT(4),
  1825. IONIC_RX_MODE_F_RDMA_SNIFFER = BIT(5),
  1826. };
  1827. /**
  1828. * struct ionic_rx_mode_set_cmd - Set LIF's Rx mode command
  1829. * @opcode: opcode
  1830. * @rsvd: reserved byte(s)
  1831. * @lif_index: LIF index
  1832. * @rx_mode: Rx mode flags:
  1833. * IONIC_RX_MODE_F_UNICAST: Accept known unicast packets
  1834. * IONIC_RX_MODE_F_MULTICAST: Accept known multicast packets
  1835. * IONIC_RX_MODE_F_BROADCAST: Accept broadcast packets
  1836. * IONIC_RX_MODE_F_PROMISC: Accept any packets
  1837. * IONIC_RX_MODE_F_ALLMULTI: Accept any multicast packets
  1838. * IONIC_RX_MODE_F_RDMA_SNIFFER: Sniff RDMA packets
  1839. * @rsvd2: reserved byte(s)
  1840. */
  1841. struct ionic_rx_mode_set_cmd {
  1842. u8 opcode;
  1843. u8 rsvd;
  1844. __le16 lif_index;
  1845. __le16 rx_mode;
  1846. __le16 rsvd2[29];
  1847. };
  1848. typedef struct ionic_admin_comp ionic_rx_mode_set_comp;
  1849. enum ionic_rx_filter_match_type {
  1850. IONIC_RX_FILTER_MATCH_VLAN = 0x0,
  1851. IONIC_RX_FILTER_MATCH_MAC = 0x1,
  1852. IONIC_RX_FILTER_MATCH_MAC_VLAN = 0x2,
  1853. IONIC_RX_FILTER_STEER_PKTCLASS = 0x10,
  1854. };
  1855. /**
  1856. * struct ionic_rx_filter_add_cmd - Add LIF Rx filter command
  1857. * @opcode: opcode
  1858. * @qtype: Queue type
  1859. * @lif_index: LIF index
  1860. * @qid: Queue ID
  1861. * @match: Rx filter match type (see IONIC_RX_FILTER_MATCH_xxx)
  1862. * @vlan: VLAN filter
  1863. * @vlan.vlan: VLAN ID
  1864. * @mac: MAC filter
  1865. * @mac.addr: MAC address (network-byte order)
  1866. * @mac_vlan: MACVLAN filter
  1867. * @mac_vlan.vlan: VLAN ID
  1868. * @mac_vlan.addr: MAC address (network-byte order)
  1869. * @pkt_class: Packet classification filter
  1870. * @rsvd: reserved byte(s)
  1871. */
  1872. struct ionic_rx_filter_add_cmd {
  1873. u8 opcode;
  1874. u8 qtype;
  1875. __le16 lif_index;
  1876. __le32 qid;
  1877. __le16 match;
  1878. union {
  1879. struct {
  1880. __le16 vlan;
  1881. } vlan;
  1882. struct {
  1883. u8 addr[6];
  1884. } mac;
  1885. struct {
  1886. __le16 vlan;
  1887. u8 addr[6];
  1888. } mac_vlan;
  1889. __le64 pkt_class;
  1890. u8 rsvd[54];
  1891. } __packed;
  1892. };
  1893. /**
  1894. * struct ionic_rx_filter_add_comp - Add LIF Rx filter command completion
  1895. * @status: Status of the command (enum ionic_status_code)
  1896. * @rsvd: reserved byte(s)
  1897. * @comp_index: Index in the descriptor ring for which this is the completion
  1898. * @filter_id: Filter ID
  1899. * @rsvd2: reserved byte(s)
  1900. * @color: Color bit
  1901. */
  1902. struct ionic_rx_filter_add_comp {
  1903. u8 status;
  1904. u8 rsvd;
  1905. __le16 comp_index;
  1906. __le32 filter_id;
  1907. u8 rsvd2[7];
  1908. u8 color;
  1909. };
  1910. /**
  1911. * struct ionic_rx_filter_del_cmd - Delete LIF Rx filter command
  1912. * @opcode: opcode
  1913. * @rsvd: reserved byte(s)
  1914. * @lif_index: LIF index
  1915. * @filter_id: Filter ID
  1916. * @rsvd2: reserved byte(s)
  1917. */
  1918. struct ionic_rx_filter_del_cmd {
  1919. u8 opcode;
  1920. u8 rsvd;
  1921. __le16 lif_index;
  1922. __le32 filter_id;
  1923. u8 rsvd2[56];
  1924. };
  1925. typedef struct ionic_admin_comp ionic_rx_filter_del_comp;
  1926. enum ionic_vf_attr {
  1927. IONIC_VF_ATTR_SPOOFCHK = 1,
  1928. IONIC_VF_ATTR_TRUST = 2,
  1929. IONIC_VF_ATTR_MAC = 3,
  1930. IONIC_VF_ATTR_LINKSTATE = 4,
  1931. IONIC_VF_ATTR_VLAN = 5,
  1932. IONIC_VF_ATTR_RATE = 6,
  1933. IONIC_VF_ATTR_STATSADDR = 7,
  1934. };
  1935. /**
  1936. * enum ionic_vf_link_status - Virtual Function link status
  1937. * @IONIC_VF_LINK_STATUS_AUTO: Use link state of the uplink
  1938. * @IONIC_VF_LINK_STATUS_UP: Link always up
  1939. * @IONIC_VF_LINK_STATUS_DOWN: Link always down
  1940. */
  1941. enum ionic_vf_link_status {
  1942. IONIC_VF_LINK_STATUS_AUTO = 0,
  1943. IONIC_VF_LINK_STATUS_UP = 1,
  1944. IONIC_VF_LINK_STATUS_DOWN = 2,
  1945. };
  1946. /**
  1947. * struct ionic_vf_setattr_cmd - Set VF attributes on the NIC
  1948. * @opcode: Opcode
  1949. * @attr: Attribute type (enum ionic_vf_attr)
  1950. * @vf_index: VF index
  1951. * @macaddr: mac address
  1952. * @vlanid: vlan ID
  1953. * @maxrate: max Tx rate in Mbps
  1954. * @spoofchk: enable address spoof checking
  1955. * @trust: enable VF trust
  1956. * @linkstate: set link up or down
  1957. * @stats_pa: set DMA address for VF stats
  1958. * @pad: reserved byte(s)
  1959. */
  1960. struct ionic_vf_setattr_cmd {
  1961. u8 opcode;
  1962. u8 attr;
  1963. __le16 vf_index;
  1964. union {
  1965. u8 macaddr[6];
  1966. __le16 vlanid;
  1967. __le32 maxrate;
  1968. u8 spoofchk;
  1969. u8 trust;
  1970. u8 linkstate;
  1971. __le64 stats_pa;
  1972. u8 pad[60];
  1973. } __packed;
  1974. };
  1975. struct ionic_vf_setattr_comp {
  1976. u8 status;
  1977. u8 attr;
  1978. __le16 vf_index;
  1979. __le16 comp_index;
  1980. u8 rsvd[9];
  1981. u8 color;
  1982. };
  1983. /**
  1984. * struct ionic_vf_getattr_cmd - Get VF attributes from the NIC
  1985. * @opcode: Opcode
  1986. * @attr: Attribute type (enum ionic_vf_attr)
  1987. * @vf_index: VF index
  1988. * @rsvd: reserved byte(s)
  1989. */
  1990. struct ionic_vf_getattr_cmd {
  1991. u8 opcode;
  1992. u8 attr;
  1993. __le16 vf_index;
  1994. u8 rsvd[60];
  1995. };
  1996. struct ionic_vf_getattr_comp {
  1997. u8 status;
  1998. u8 attr;
  1999. __le16 vf_index;
  2000. union {
  2001. u8 macaddr[6];
  2002. __le16 vlanid;
  2003. __le32 maxrate;
  2004. u8 spoofchk;
  2005. u8 trust;
  2006. u8 linkstate;
  2007. __le64 stats_pa;
  2008. u8 pad[11];
  2009. } __packed;
  2010. u8 color;
  2011. };
  2012. enum ionic_vf_ctrl_opcode {
  2013. IONIC_VF_CTRL_START_ALL = 0,
  2014. IONIC_VF_CTRL_START = 1,
  2015. };
  2016. /**
  2017. * struct ionic_vf_ctrl_cmd - VF control command
  2018. * @opcode: Opcode for the command
  2019. * @ctrl_opcode: VF control operation type
  2020. * @vf_index: VF Index. It is unused if op START_ALL is used.
  2021. */
  2022. struct ionic_vf_ctrl_cmd {
  2023. u8 opcode;
  2024. u8 ctrl_opcode;
  2025. __le16 vf_index;
  2026. /* private: */
  2027. u8 rsvd1[60];
  2028. };
  2029. /**
  2030. * struct ionic_vf_ctrl_comp - VF_CTRL command completion.
  2031. * @status: Status of the command (enum ionic_status_code)
  2032. */
  2033. struct ionic_vf_ctrl_comp {
  2034. u8 status;
  2035. /* private: */
  2036. u8 rsvd[15];
  2037. };
  2038. /**
  2039. * struct ionic_qos_identify_cmd - QoS identify command
  2040. * @opcode: opcode
  2041. * @ver: Highest version of identify supported by driver
  2042. * @rsvd: reserved byte(s)
  2043. */
  2044. struct ionic_qos_identify_cmd {
  2045. u8 opcode;
  2046. u8 ver;
  2047. u8 rsvd[62];
  2048. };
  2049. /**
  2050. * struct ionic_qos_identify_comp - QoS identify command completion
  2051. * @status: Status of the command (enum ionic_status_code)
  2052. * @ver: Version of identify returned by device
  2053. * @rsvd: reserved byte(s)
  2054. */
  2055. struct ionic_qos_identify_comp {
  2056. u8 status;
  2057. u8 ver;
  2058. u8 rsvd[14];
  2059. };
  2060. #define IONIC_QOS_TC_MAX 8
  2061. #define IONIC_QOS_ALL_TC 0xFF
  2062. /* Capri max supported, should be renamed. */
  2063. #define IONIC_QOS_CLASS_MAX 7
  2064. #define IONIC_QOS_PCP_MAX 8
  2065. #define IONIC_QOS_CLASS_NAME_SZ 32
  2066. #define IONIC_QOS_DSCP_MAX 64
  2067. #define IONIC_QOS_ALL_PCP 0xFF
  2068. #define IONIC_DSCP_BLOCK_SIZE 8
  2069. /*
  2070. * enum ionic_qos_class
  2071. */
  2072. enum ionic_qos_class {
  2073. IONIC_QOS_CLASS_DEFAULT = 0,
  2074. IONIC_QOS_CLASS_USER_DEFINED_1 = 1,
  2075. IONIC_QOS_CLASS_USER_DEFINED_2 = 2,
  2076. IONIC_QOS_CLASS_USER_DEFINED_3 = 3,
  2077. IONIC_QOS_CLASS_USER_DEFINED_4 = 4,
  2078. IONIC_QOS_CLASS_USER_DEFINED_5 = 5,
  2079. IONIC_QOS_CLASS_USER_DEFINED_6 = 6,
  2080. };
  2081. /**
  2082. * enum ionic_qos_class_type - Traffic classification criteria
  2083. * @IONIC_QOS_CLASS_TYPE_NONE: No QoS
  2084. * @IONIC_QOS_CLASS_TYPE_PCP: Dot1Q PCP
  2085. * @IONIC_QOS_CLASS_TYPE_DSCP: IP DSCP
  2086. */
  2087. enum ionic_qos_class_type {
  2088. IONIC_QOS_CLASS_TYPE_NONE = 0,
  2089. IONIC_QOS_CLASS_TYPE_PCP = 1,
  2090. IONIC_QOS_CLASS_TYPE_DSCP = 2,
  2091. };
  2092. /**
  2093. * enum ionic_qos_sched_type - QoS class scheduling type
  2094. * @IONIC_QOS_SCHED_TYPE_STRICT: Strict priority
  2095. * @IONIC_QOS_SCHED_TYPE_DWRR: Deficit weighted round-robin
  2096. */
  2097. enum ionic_qos_sched_type {
  2098. IONIC_QOS_SCHED_TYPE_STRICT = 0,
  2099. IONIC_QOS_SCHED_TYPE_DWRR = 1,
  2100. };
  2101. /**
  2102. * union ionic_qos_config - QoS configuration structure
  2103. * @flags: Configuration flags
  2104. * IONIC_QOS_CONFIG_F_ENABLE enable
  2105. * IONIC_QOS_CONFIG_F_NO_DROP drop/nodrop
  2106. * IONIC_QOS_CONFIG_F_RW_DOT1Q_PCP enable dot1q pcp rewrite
  2107. * IONIC_QOS_CONFIG_F_RW_IP_DSCP enable ip dscp rewrite
  2108. * IONIC_QOS_CONFIG_F_NON_DISRUPTIVE Non-disruptive TC update
  2109. * @sched_type: QoS class scheduling type (enum ionic_qos_sched_type)
  2110. * @class_type: QoS class type (enum ionic_qos_class_type)
  2111. * @pause_type: QoS pause type (enum ionic_qos_pause_type)
  2112. * @name: QoS class name
  2113. * @mtu: MTU of the class
  2114. * @pfc_cos: Priority-Flow Control class of service
  2115. * @dwrr_weight: QoS class scheduling weight
  2116. * @strict_rlmt: Rate limit for strict priority scheduling
  2117. * @rw_dot1q_pcp: Rewrite dot1q pcp to value (valid iff F_RW_DOT1Q_PCP)
  2118. * @rw_ip_dscp: Rewrite ip dscp to value (valid iff F_RW_IP_DSCP)
  2119. * @dot1q_pcp: Dot1q pcp value
  2120. * @ndscp: Number of valid dscp values in the ip_dscp field
  2121. * @ip_dscp: IP dscp values
  2122. * @words: word access to struct contents
  2123. */
  2124. union ionic_qos_config {
  2125. struct {
  2126. #define IONIC_QOS_CONFIG_F_ENABLE BIT(0)
  2127. #define IONIC_QOS_CONFIG_F_NO_DROP BIT(1)
  2128. /* Used to rewrite PCP or DSCP value. */
  2129. #define IONIC_QOS_CONFIG_F_RW_DOT1Q_PCP BIT(2)
  2130. #define IONIC_QOS_CONFIG_F_RW_IP_DSCP BIT(3)
  2131. /* Non-disruptive TC update */
  2132. #define IONIC_QOS_CONFIG_F_NON_DISRUPTIVE BIT(4)
  2133. u8 flags;
  2134. u8 sched_type;
  2135. u8 class_type;
  2136. u8 pause_type;
  2137. char name[IONIC_QOS_CLASS_NAME_SZ];
  2138. __le32 mtu;
  2139. /* flow control */
  2140. u8 pfc_cos;
  2141. /* scheduler */
  2142. union {
  2143. u8 dwrr_weight;
  2144. __le64 strict_rlmt;
  2145. };
  2146. /* marking */
  2147. /* Used to rewrite PCP or DSCP value. */
  2148. union {
  2149. u8 rw_dot1q_pcp;
  2150. u8 rw_ip_dscp;
  2151. };
  2152. /* classification */
  2153. union {
  2154. u8 dot1q_pcp;
  2155. struct {
  2156. u8 ndscp;
  2157. u8 ip_dscp[IONIC_QOS_DSCP_MAX];
  2158. };
  2159. };
  2160. };
  2161. __le32 words[64];
  2162. };
  2163. /**
  2164. * union ionic_qos_identity - QoS identity structure
  2165. * @version: Version of the identify structure
  2166. * @type: QoS system type
  2167. * @rsvd: reserved byte(s)
  2168. * @config: Current configuration of classes
  2169. * @words: word access to struct contents
  2170. */
  2171. union ionic_qos_identity {
  2172. struct {
  2173. u8 version;
  2174. u8 type;
  2175. u8 rsvd[62];
  2176. union ionic_qos_config config[IONIC_QOS_CLASS_MAX];
  2177. };
  2178. __le32 words[478];
  2179. };
  2180. /**
  2181. * struct ionic_qos_init_cmd - QoS config init command
  2182. * @opcode: Opcode
  2183. * @group: QoS class id
  2184. * @rsvd: reserved byte(s)
  2185. * @info_pa: destination address for qos info
  2186. * @rsvd1: reserved byte(s)
  2187. */
  2188. struct ionic_qos_init_cmd {
  2189. u8 opcode;
  2190. u8 group;
  2191. u8 rsvd[6];
  2192. __le64 info_pa;
  2193. u8 rsvd1[48];
  2194. };
  2195. typedef struct ionic_admin_comp ionic_qos_init_comp;
  2196. /**
  2197. * struct ionic_qos_reset_cmd - QoS config reset command
  2198. * @opcode: Opcode
  2199. * @group: QoS class id
  2200. * @rsvd: reserved byte(s)
  2201. */
  2202. struct ionic_qos_reset_cmd {
  2203. u8 opcode;
  2204. u8 group;
  2205. u8 rsvd[62];
  2206. };
  2207. /**
  2208. * struct ionic_qos_clear_stats_cmd - Qos config reset command
  2209. * @opcode: Opcode
  2210. * @group_bitmap: bitmap of groups to be cleared
  2211. * @rsvd: reserved byte(s)
  2212. */
  2213. struct ionic_qos_clear_stats_cmd {
  2214. u8 opcode;
  2215. u8 group_bitmap;
  2216. u8 rsvd[62];
  2217. };
  2218. typedef struct ionic_admin_comp ionic_qos_reset_comp;
  2219. /**
  2220. * struct ionic_fw_download_cmd - Firmware download command
  2221. * @opcode: opcode
  2222. * @rsvd: reserved byte(s)
  2223. * @addr: dma address of the firmware buffer
  2224. * @offset: offset of the firmware buffer within the full image
  2225. * @length: number of valid bytes in the firmware buffer
  2226. */
  2227. struct ionic_fw_download_cmd {
  2228. u8 opcode;
  2229. u8 rsvd[3];
  2230. __le32 offset;
  2231. __le64 addr;
  2232. __le32 length;
  2233. };
  2234. typedef struct ionic_admin_comp ionic_fw_download_comp;
  2235. /**
  2236. * enum ionic_fw_control_oper - FW control operations
  2237. * @IONIC_FW_RESET: Reset firmware
  2238. * @IONIC_FW_INSTALL: Install firmware
  2239. * @IONIC_FW_ACTIVATE: Activate firmware
  2240. * @IONIC_FW_INSTALL_ASYNC: Install firmware asynchronously
  2241. * @IONIC_FW_INSTALL_STATUS: Firmware installation status
  2242. * @IONIC_FW_ACTIVATE_ASYNC: Activate firmware asynchronously
  2243. * @IONIC_FW_ACTIVATE_STATUS: Firmware activate status
  2244. * @IONIC_FW_UPDATE_CLEANUP: Clean up after an interrupted fw update
  2245. */
  2246. enum ionic_fw_control_oper {
  2247. IONIC_FW_RESET = 0,
  2248. IONIC_FW_INSTALL = 1,
  2249. IONIC_FW_ACTIVATE = 2,
  2250. IONIC_FW_INSTALL_ASYNC = 3,
  2251. IONIC_FW_INSTALL_STATUS = 4,
  2252. IONIC_FW_ACTIVATE_ASYNC = 5,
  2253. IONIC_FW_ACTIVATE_STATUS = 6,
  2254. IONIC_FW_UPDATE_CLEANUP = 7,
  2255. };
  2256. /**
  2257. * struct ionic_fw_control_cmd - Firmware control command
  2258. * @opcode: opcode
  2259. * @rsvd: reserved byte(s)
  2260. * @oper: firmware control operation (enum ionic_fw_control_oper)
  2261. * @slot: slot to activate
  2262. * @rsvd1: reserved byte(s)
  2263. */
  2264. struct ionic_fw_control_cmd {
  2265. u8 opcode;
  2266. u8 rsvd[3];
  2267. u8 oper;
  2268. u8 slot;
  2269. u8 rsvd1[58];
  2270. };
  2271. /**
  2272. * struct ionic_fw_control_comp - Firmware control copletion
  2273. * @status: Status of the command (enum ionic_status_code)
  2274. * @rsvd: reserved byte(s)
  2275. * @comp_index: Index in the descriptor ring for which this is the completion
  2276. * @slot: Slot where the firmware was installed
  2277. * @rsvd1: reserved byte(s)
  2278. * @color: Color bit
  2279. */
  2280. struct ionic_fw_control_comp {
  2281. u8 status;
  2282. u8 rsvd;
  2283. __le16 comp_index;
  2284. u8 slot;
  2285. u8 rsvd1[10];
  2286. u8 color;
  2287. };
  2288. /******************************************************************
  2289. ******************* RDMA Commands ********************************
  2290. ******************************************************************/
  2291. /**
  2292. * struct ionic_rdma_reset_cmd - Reset RDMA LIF cmd
  2293. * @opcode: opcode
  2294. * @rsvd: reserved byte(s)
  2295. * @lif_index: LIF index
  2296. * @rsvd2: reserved byte(s)
  2297. *
  2298. * There is no RDMA specific dev command completion struct. Completion uses
  2299. * the common struct ionic_admin_comp. Only the status is indicated.
  2300. * Nonzero status means the LIF does not support RDMA.
  2301. **/
  2302. struct ionic_rdma_reset_cmd {
  2303. u8 opcode;
  2304. u8 rsvd;
  2305. __le16 lif_index;
  2306. u8 rsvd2[60];
  2307. };
  2308. /**
  2309. * struct ionic_rdma_queue_cmd - Create RDMA Queue command
  2310. * @opcode: opcode, 52, 53
  2311. * @rsvd: reserved byte(s)
  2312. * @lif_index: LIF index
  2313. * @qid_ver: (qid | (RDMA version << 24))
  2314. * @cid: intr, eq_id, or cq_id
  2315. * @dbid: doorbell page id
  2316. * @depth_log2: log base two of queue depth
  2317. * @stride_log2: log base two of queue stride
  2318. * @dma_addr: address of the queue memory
  2319. * @rsvd2: reserved byte(s)
  2320. *
  2321. * The same command struct is used to create an RDMA event queue, completion
  2322. * queue, or RDMA admin queue. The cid is an interrupt number for an event
  2323. * queue, an event queue id for a completion queue, or a completion queue id
  2324. * for an RDMA admin queue.
  2325. *
  2326. * The queue created via a dev command must be contiguous in dma space.
  2327. *
  2328. * The dev commands are intended only to be used during driver initialization,
  2329. * to create queues supporting the RDMA admin queue. Other queues, and other
  2330. * types of RDMA resources like memory regions, will be created and registered
  2331. * via the RDMA admin queue, and will support a more complete interface
  2332. * providing scatter gather lists for larger, scattered queue buffers and
  2333. * memory registration.
  2334. *
  2335. * There is no RDMA specific dev command completion struct. Completion uses
  2336. * the common struct ionic_admin_comp. Only the status is indicated.
  2337. **/
  2338. struct ionic_rdma_queue_cmd {
  2339. u8 opcode;
  2340. u8 rsvd;
  2341. __le16 lif_index;
  2342. __le32 qid_ver;
  2343. __le32 cid;
  2344. __le16 dbid;
  2345. u8 depth_log2;
  2346. u8 stride_log2;
  2347. __le64 dma_addr;
  2348. u8 rsvd2[40];
  2349. };
  2350. /******************************************************************
  2351. ******************* Notify Events ********************************
  2352. ******************************************************************/
  2353. /**
  2354. * struct ionic_notifyq_event - Generic event reporting structure
  2355. * @eid: event number
  2356. * @ecode: event code
  2357. * @data: unspecified data about the event
  2358. *
  2359. * This is the generic event report struct from which the other
  2360. * actual events will be formed.
  2361. */
  2362. struct ionic_notifyq_event {
  2363. __le64 eid;
  2364. __le16 ecode;
  2365. u8 data[54];
  2366. };
  2367. /**
  2368. * struct ionic_link_change_event - Link change event notification
  2369. * @eid: event number
  2370. * @ecode: event code = IONIC_EVENT_LINK_CHANGE
  2371. * @link_status: link up/down, with error bits (enum ionic_port_status)
  2372. * @link_speed: speed of the network link
  2373. * @rsvd: reserved byte(s)
  2374. *
  2375. * Sent when the network link state changes between UP and DOWN
  2376. */
  2377. struct ionic_link_change_event {
  2378. __le64 eid;
  2379. __le16 ecode;
  2380. __le16 link_status;
  2381. __le32 link_speed; /* units of 1Mbps: e.g. 10000 = 10Gbps */
  2382. u8 rsvd[48];
  2383. };
  2384. /**
  2385. * struct ionic_reset_event - Reset event notification
  2386. * @eid: event number
  2387. * @ecode: event code = IONIC_EVENT_RESET
  2388. * @reset_code: reset type
  2389. * @state: 0=pending, 1=complete, 2=error
  2390. * @rsvd: reserved byte(s)
  2391. *
  2392. * Sent when the NIC or some subsystem is going to be or
  2393. * has been reset.
  2394. */
  2395. struct ionic_reset_event {
  2396. __le64 eid;
  2397. __le16 ecode;
  2398. u8 reset_code;
  2399. u8 state;
  2400. u8 rsvd[52];
  2401. };
  2402. /**
  2403. * struct ionic_heartbeat_event - Sent periodically by NIC to indicate health
  2404. * @eid: event number
  2405. * @ecode: event code = IONIC_EVENT_HEARTBEAT
  2406. * @rsvd: reserved byte(s)
  2407. */
  2408. struct ionic_heartbeat_event {
  2409. __le64 eid;
  2410. __le16 ecode;
  2411. u8 rsvd[54];
  2412. };
  2413. /**
  2414. * struct ionic_log_event - Sent to notify the driver of an internal error
  2415. * @eid: event number
  2416. * @ecode: event code = IONIC_EVENT_LOG
  2417. * @data: log data
  2418. */
  2419. struct ionic_log_event {
  2420. __le64 eid;
  2421. __le16 ecode;
  2422. u8 data[54];
  2423. };
  2424. /**
  2425. * struct ionic_xcvr_event - Transceiver change event
  2426. * @eid: event number
  2427. * @ecode: event code = IONIC_EVENT_XCVR
  2428. * @rsvd: reserved byte(s)
  2429. */
  2430. struct ionic_xcvr_event {
  2431. __le64 eid;
  2432. __le16 ecode;
  2433. u8 rsvd[54];
  2434. };
  2435. /*
  2436. * struct ionic_port_stats - Port statistics structure
  2437. */
  2438. struct ionic_port_stats {
  2439. __le64 frames_rx_ok;
  2440. __le64 frames_rx_all;
  2441. __le64 frames_rx_bad_fcs;
  2442. __le64 frames_rx_bad_all;
  2443. __le64 octets_rx_ok;
  2444. __le64 octets_rx_all;
  2445. __le64 frames_rx_unicast;
  2446. __le64 frames_rx_multicast;
  2447. __le64 frames_rx_broadcast;
  2448. __le64 frames_rx_pause;
  2449. __le64 frames_rx_bad_length;
  2450. __le64 frames_rx_undersized;
  2451. __le64 frames_rx_oversized;
  2452. __le64 frames_rx_fragments;
  2453. __le64 frames_rx_jabber;
  2454. __le64 frames_rx_pripause;
  2455. __le64 frames_rx_stomped_crc;
  2456. __le64 frames_rx_too_long;
  2457. __le64 frames_rx_vlan_good;
  2458. __le64 frames_rx_dropped;
  2459. __le64 frames_rx_less_than_64b;
  2460. __le64 frames_rx_64b;
  2461. __le64 frames_rx_65b_127b;
  2462. __le64 frames_rx_128b_255b;
  2463. __le64 frames_rx_256b_511b;
  2464. __le64 frames_rx_512b_1023b;
  2465. __le64 frames_rx_1024b_1518b;
  2466. __le64 frames_rx_1519b_2047b;
  2467. __le64 frames_rx_2048b_4095b;
  2468. __le64 frames_rx_4096b_8191b;
  2469. __le64 frames_rx_8192b_9215b;
  2470. __le64 frames_rx_other;
  2471. __le64 frames_tx_ok;
  2472. __le64 frames_tx_all;
  2473. __le64 frames_tx_bad;
  2474. __le64 octets_tx_ok;
  2475. __le64 octets_tx_total;
  2476. __le64 frames_tx_unicast;
  2477. __le64 frames_tx_multicast;
  2478. __le64 frames_tx_broadcast;
  2479. __le64 frames_tx_pause;
  2480. __le64 frames_tx_pripause;
  2481. __le64 frames_tx_vlan;
  2482. __le64 frames_tx_less_than_64b;
  2483. __le64 frames_tx_64b;
  2484. __le64 frames_tx_65b_127b;
  2485. __le64 frames_tx_128b_255b;
  2486. __le64 frames_tx_256b_511b;
  2487. __le64 frames_tx_512b_1023b;
  2488. __le64 frames_tx_1024b_1518b;
  2489. __le64 frames_tx_1519b_2047b;
  2490. __le64 frames_tx_2048b_4095b;
  2491. __le64 frames_tx_4096b_8191b;
  2492. __le64 frames_tx_8192b_9215b;
  2493. __le64 frames_tx_other;
  2494. __le64 frames_tx_pri_0;
  2495. __le64 frames_tx_pri_1;
  2496. __le64 frames_tx_pri_2;
  2497. __le64 frames_tx_pri_3;
  2498. __le64 frames_tx_pri_4;
  2499. __le64 frames_tx_pri_5;
  2500. __le64 frames_tx_pri_6;
  2501. __le64 frames_tx_pri_7;
  2502. __le64 frames_rx_pri_0;
  2503. __le64 frames_rx_pri_1;
  2504. __le64 frames_rx_pri_2;
  2505. __le64 frames_rx_pri_3;
  2506. __le64 frames_rx_pri_4;
  2507. __le64 frames_rx_pri_5;
  2508. __le64 frames_rx_pri_6;
  2509. __le64 frames_rx_pri_7;
  2510. __le64 tx_pripause_0_1us_count;
  2511. __le64 tx_pripause_1_1us_count;
  2512. __le64 tx_pripause_2_1us_count;
  2513. __le64 tx_pripause_3_1us_count;
  2514. __le64 tx_pripause_4_1us_count;
  2515. __le64 tx_pripause_5_1us_count;
  2516. __le64 tx_pripause_6_1us_count;
  2517. __le64 tx_pripause_7_1us_count;
  2518. __le64 rx_pripause_0_1us_count;
  2519. __le64 rx_pripause_1_1us_count;
  2520. __le64 rx_pripause_2_1us_count;
  2521. __le64 rx_pripause_3_1us_count;
  2522. __le64 rx_pripause_4_1us_count;
  2523. __le64 rx_pripause_5_1us_count;
  2524. __le64 rx_pripause_6_1us_count;
  2525. __le64 rx_pripause_7_1us_count;
  2526. __le64 rx_pause_1us_count;
  2527. __le64 frames_tx_truncated;
  2528. };
  2529. struct ionic_mgmt_port_stats {
  2530. __le64 frames_rx_ok;
  2531. __le64 frames_rx_all;
  2532. __le64 frames_rx_bad_fcs;
  2533. __le64 frames_rx_bad_all;
  2534. __le64 octets_rx_ok;
  2535. __le64 octets_rx_all;
  2536. __le64 frames_rx_unicast;
  2537. __le64 frames_rx_multicast;
  2538. __le64 frames_rx_broadcast;
  2539. __le64 frames_rx_pause;
  2540. __le64 frames_rx_bad_length;
  2541. __le64 frames_rx_undersized;
  2542. __le64 frames_rx_oversized;
  2543. __le64 frames_rx_fragments;
  2544. __le64 frames_rx_jabber;
  2545. __le64 frames_rx_64b;
  2546. __le64 frames_rx_65b_127b;
  2547. __le64 frames_rx_128b_255b;
  2548. __le64 frames_rx_256b_511b;
  2549. __le64 frames_rx_512b_1023b;
  2550. __le64 frames_rx_1024b_1518b;
  2551. __le64 frames_rx_gt_1518b;
  2552. __le64 frames_rx_fifo_full;
  2553. __le64 frames_tx_ok;
  2554. __le64 frames_tx_all;
  2555. __le64 frames_tx_bad;
  2556. __le64 octets_tx_ok;
  2557. __le64 octets_tx_total;
  2558. __le64 frames_tx_unicast;
  2559. __le64 frames_tx_multicast;
  2560. __le64 frames_tx_broadcast;
  2561. __le64 frames_tx_pause;
  2562. };
  2563. enum ionic_pb_buffer_drop_stats {
  2564. IONIC_BUFFER_INTRINSIC_DROP = 0,
  2565. IONIC_BUFFER_DISCARDED,
  2566. IONIC_BUFFER_ADMITTED,
  2567. IONIC_BUFFER_OUT_OF_CELLS_DROP,
  2568. IONIC_BUFFER_OUT_OF_CELLS_DROP_2,
  2569. IONIC_BUFFER_OUT_OF_CREDIT_DROP,
  2570. IONIC_BUFFER_TRUNCATION_DROP,
  2571. IONIC_BUFFER_PORT_DISABLED_DROP,
  2572. IONIC_BUFFER_COPY_TO_CPU_TAIL_DROP,
  2573. IONIC_BUFFER_SPAN_TAIL_DROP,
  2574. IONIC_BUFFER_MIN_SIZE_VIOLATION_DROP,
  2575. IONIC_BUFFER_ENQUEUE_ERROR_DROP,
  2576. IONIC_BUFFER_INVALID_PORT_DROP,
  2577. IONIC_BUFFER_INVALID_OUTPUT_QUEUE_DROP,
  2578. IONIC_BUFFER_DROP_MAX,
  2579. };
  2580. enum ionic_oflow_drop_stats {
  2581. IONIC_OFLOW_OCCUPANCY_DROP,
  2582. IONIC_OFLOW_EMERGENCY_STOP_DROP,
  2583. IONIC_OFLOW_WRITE_BUFFER_ACK_FILL_UP_DROP,
  2584. IONIC_OFLOW_WRITE_BUFFER_ACK_FULL_DROP,
  2585. IONIC_OFLOW_WRITE_BUFFER_FULL_DROP,
  2586. IONIC_OFLOW_CONTROL_FIFO_FULL_DROP,
  2587. IONIC_OFLOW_DROP_MAX,
  2588. };
  2589. /* struct ionic_port_pb_stats - packet buffers system stats
  2590. * uses ionic_pb_buffer_drop_stats for drop_counts[]
  2591. */
  2592. struct ionic_port_pb_stats {
  2593. __le64 sop_count_in;
  2594. __le64 eop_count_in;
  2595. __le64 sop_count_out;
  2596. __le64 eop_count_out;
  2597. __le64 drop_counts[IONIC_BUFFER_DROP_MAX];
  2598. __le64 input_queue_buffer_occupancy[IONIC_QOS_TC_MAX];
  2599. __le64 input_queue_port_monitor[IONIC_QOS_TC_MAX];
  2600. __le64 output_queue_port_monitor[IONIC_QOS_TC_MAX];
  2601. __le64 oflow_drop_counts[IONIC_OFLOW_DROP_MAX];
  2602. __le64 input_queue_good_pkts_in[IONIC_QOS_TC_MAX];
  2603. __le64 input_queue_good_pkts_out[IONIC_QOS_TC_MAX];
  2604. __le64 input_queue_err_pkts_in[IONIC_QOS_TC_MAX];
  2605. __le64 input_queue_fifo_depth[IONIC_QOS_TC_MAX];
  2606. __le64 input_queue_max_fifo_depth[IONIC_QOS_TC_MAX];
  2607. __le64 input_queue_peak_occupancy[IONIC_QOS_TC_MAX];
  2608. __le64 output_queue_buffer_occupancy[IONIC_QOS_TC_MAX];
  2609. };
  2610. /**
  2611. * struct ionic_port_identity - port identity structure
  2612. * @version: identity structure version
  2613. * @type: type of port (enum ionic_port_type)
  2614. * @num_lanes: number of lanes for the port
  2615. * @autoneg: autoneg supported
  2616. * @min_frame_size: minimum frame size supported
  2617. * @max_frame_size: maximum frame size supported
  2618. * @fec_type: supported fec types
  2619. * @pause_type: supported pause types
  2620. * @loopback_mode: supported loopback mode
  2621. * @speeds: supported speeds
  2622. * @rsvd2: reserved byte(s)
  2623. * @config: current port configuration
  2624. * @words: word access to struct contents
  2625. */
  2626. union ionic_port_identity {
  2627. struct {
  2628. u8 version;
  2629. u8 type;
  2630. u8 num_lanes;
  2631. u8 autoneg;
  2632. __le32 min_frame_size;
  2633. __le32 max_frame_size;
  2634. u8 fec_type[4];
  2635. u8 pause_type[2];
  2636. u8 loopback_mode[2];
  2637. __le32 speeds[16];
  2638. u8 rsvd2[44];
  2639. union ionic_port_config config;
  2640. };
  2641. __le32 words[478];
  2642. };
  2643. /**
  2644. * struct ionic_port_info - port info structure
  2645. * @config: Port configuration data
  2646. * @status: Port status data
  2647. * @stats: Port statistics data
  2648. * @mgmt_stats: Port management statistics data
  2649. * @rsvd: reserved byte(s)
  2650. * @pb_stats: uplink pb drop stats
  2651. */
  2652. struct ionic_port_info {
  2653. union ionic_port_config config;
  2654. struct ionic_port_status status;
  2655. union {
  2656. struct ionic_port_stats stats;
  2657. struct ionic_mgmt_port_stats mgmt_stats;
  2658. };
  2659. /* room for pb_stats to start at 2k offset */
  2660. u8 rsvd[760];
  2661. struct ionic_port_pb_stats pb_stats;
  2662. };
  2663. /*
  2664. * struct ionic_lif_stats - LIF statistics structure
  2665. */
  2666. struct ionic_lif_stats {
  2667. /* RX */
  2668. __le64 rx_ucast_bytes;
  2669. __le64 rx_ucast_packets;
  2670. __le64 rx_mcast_bytes;
  2671. __le64 rx_mcast_packets;
  2672. __le64 rx_bcast_bytes;
  2673. __le64 rx_bcast_packets;
  2674. __le64 rsvd0;
  2675. __le64 rsvd1;
  2676. /* RX drops */
  2677. __le64 rx_ucast_drop_bytes;
  2678. __le64 rx_ucast_drop_packets;
  2679. __le64 rx_mcast_drop_bytes;
  2680. __le64 rx_mcast_drop_packets;
  2681. __le64 rx_bcast_drop_bytes;
  2682. __le64 rx_bcast_drop_packets;
  2683. __le64 rx_dma_error;
  2684. __le64 rsvd2;
  2685. /* TX */
  2686. __le64 tx_ucast_bytes;
  2687. __le64 tx_ucast_packets;
  2688. __le64 tx_mcast_bytes;
  2689. __le64 tx_mcast_packets;
  2690. __le64 tx_bcast_bytes;
  2691. __le64 tx_bcast_packets;
  2692. __le64 rsvd3;
  2693. __le64 rsvd4;
  2694. /* TX drops */
  2695. __le64 tx_ucast_drop_bytes;
  2696. __le64 tx_ucast_drop_packets;
  2697. __le64 tx_mcast_drop_bytes;
  2698. __le64 tx_mcast_drop_packets;
  2699. __le64 tx_bcast_drop_bytes;
  2700. __le64 tx_bcast_drop_packets;
  2701. __le64 tx_dma_error;
  2702. __le64 rsvd5;
  2703. /* Rx Queue/Ring drops */
  2704. __le64 rx_queue_disabled;
  2705. __le64 rx_queue_empty;
  2706. __le64 rx_queue_error;
  2707. __le64 rx_desc_fetch_error;
  2708. __le64 rx_desc_data_error;
  2709. __le64 rsvd6;
  2710. __le64 rsvd7;
  2711. __le64 rsvd8;
  2712. /* Tx Queue/Ring drops */
  2713. __le64 tx_queue_disabled;
  2714. __le64 tx_queue_error;
  2715. __le64 tx_desc_fetch_error;
  2716. __le64 tx_desc_data_error;
  2717. __le64 tx_queue_empty;
  2718. __le64 rsvd10;
  2719. __le64 rsvd11;
  2720. __le64 rsvd12;
  2721. /* RDMA/ROCE TX */
  2722. __le64 tx_rdma_ucast_bytes;
  2723. __le64 tx_rdma_ucast_packets;
  2724. __le64 tx_rdma_mcast_bytes;
  2725. __le64 tx_rdma_mcast_packets;
  2726. __le64 tx_rdma_cnp_packets;
  2727. __le64 rsvd13;
  2728. __le64 rsvd14;
  2729. __le64 rsvd15;
  2730. /* RDMA/ROCE RX */
  2731. __le64 rx_rdma_ucast_bytes;
  2732. __le64 rx_rdma_ucast_packets;
  2733. __le64 rx_rdma_mcast_bytes;
  2734. __le64 rx_rdma_mcast_packets;
  2735. __le64 rx_rdma_cnp_packets;
  2736. __le64 rx_rdma_ecn_packets;
  2737. __le64 rsvd16;
  2738. __le64 rsvd17;
  2739. __le64 rsvd18;
  2740. __le64 rsvd19;
  2741. __le64 rsvd20;
  2742. __le64 rsvd21;
  2743. __le64 rsvd22;
  2744. __le64 rsvd23;
  2745. __le64 rsvd24;
  2746. __le64 rsvd25;
  2747. __le64 rsvd26;
  2748. __le64 rsvd27;
  2749. __le64 rsvd28;
  2750. __le64 rsvd29;
  2751. __le64 rsvd30;
  2752. __le64 rsvd31;
  2753. __le64 rsvd32;
  2754. __le64 rsvd33;
  2755. __le64 rsvd34;
  2756. __le64 rsvd35;
  2757. __le64 rsvd36;
  2758. __le64 rsvd37;
  2759. __le64 rsvd38;
  2760. __le64 rsvd39;
  2761. __le64 rsvd40;
  2762. __le64 rsvd41;
  2763. __le64 rsvd42;
  2764. __le64 rsvd43;
  2765. __le64 rsvd44;
  2766. __le64 rsvd45;
  2767. __le64 rsvd46;
  2768. __le64 rsvd47;
  2769. __le64 rsvd48;
  2770. __le64 rsvd49;
  2771. /* RDMA/ROCE REQ Error/Debugs (768 - 895) */
  2772. __le64 rdma_req_rx_pkt_seq_err;
  2773. __le64 rdma_req_rx_rnr_retry_err;
  2774. __le64 rdma_req_rx_remote_access_err;
  2775. __le64 rdma_req_rx_remote_inv_req_err;
  2776. __le64 rdma_req_rx_remote_oper_err;
  2777. __le64 rdma_req_rx_implied_nak_seq_err;
  2778. __le64 rdma_req_rx_cqe_err;
  2779. __le64 rdma_req_rx_cqe_flush_err;
  2780. __le64 rdma_req_rx_dup_responses;
  2781. __le64 rdma_req_rx_invalid_packets;
  2782. __le64 rdma_req_tx_local_access_err;
  2783. __le64 rdma_req_tx_local_oper_err;
  2784. __le64 rdma_req_tx_memory_mgmt_err;
  2785. __le64 rsvd52;
  2786. __le64 rsvd53;
  2787. __le64 rsvd54;
  2788. /* RDMA/ROCE RESP Error/Debugs (896 - 1023) */
  2789. __le64 rdma_resp_rx_dup_requests;
  2790. __le64 rdma_resp_rx_out_of_buffer;
  2791. __le64 rdma_resp_rx_out_of_seq_pkts;
  2792. __le64 rdma_resp_rx_cqe_err;
  2793. __le64 rdma_resp_rx_cqe_flush_err;
  2794. __le64 rdma_resp_rx_local_len_err;
  2795. __le64 rdma_resp_rx_inv_request_err;
  2796. __le64 rdma_resp_rx_local_qp_oper_err;
  2797. __le64 rdma_resp_rx_out_of_atomic_resource;
  2798. __le64 rdma_resp_tx_pkt_seq_err;
  2799. __le64 rdma_resp_tx_remote_inv_req_err;
  2800. __le64 rdma_resp_tx_remote_access_err;
  2801. __le64 rdma_resp_tx_remote_oper_err;
  2802. __le64 rdma_resp_tx_rnr_retry_err;
  2803. __le64 rsvd57;
  2804. __le64 rsvd58;
  2805. };
  2806. /**
  2807. * struct ionic_lif_info - LIF info structure
  2808. * @config: LIF configuration structure
  2809. * @status: LIF status structure
  2810. * @stats: LIF statistics structure
  2811. */
  2812. struct ionic_lif_info {
  2813. union ionic_lif_config config;
  2814. struct ionic_lif_status status;
  2815. struct ionic_lif_stats stats;
  2816. };
  2817. union ionic_dev_cmd {
  2818. u32 words[16];
  2819. struct ionic_admin_cmd cmd;
  2820. struct ionic_nop_cmd nop;
  2821. struct ionic_dev_identify_cmd identify;
  2822. struct ionic_dev_init_cmd init;
  2823. struct ionic_dev_reset_cmd reset;
  2824. struct ionic_dev_getattr_cmd getattr;
  2825. struct ionic_dev_setattr_cmd setattr;
  2826. struct ionic_port_identify_cmd port_identify;
  2827. struct ionic_port_init_cmd port_init;
  2828. struct ionic_port_reset_cmd port_reset;
  2829. struct ionic_port_getattr_cmd port_getattr;
  2830. struct ionic_port_setattr_cmd port_setattr;
  2831. struct ionic_vf_setattr_cmd vf_setattr;
  2832. struct ionic_vf_getattr_cmd vf_getattr;
  2833. struct ionic_vf_ctrl_cmd vf_ctrl;
  2834. struct ionic_lif_identify_cmd lif_identify;
  2835. struct ionic_lif_init_cmd lif_init;
  2836. struct ionic_lif_reset_cmd lif_reset;
  2837. struct ionic_qos_identify_cmd qos_identify;
  2838. struct ionic_qos_init_cmd qos_init;
  2839. struct ionic_qos_reset_cmd qos_reset;
  2840. struct ionic_qos_clear_stats_cmd qos_clear_stats;
  2841. struct ionic_q_identify_cmd q_identify;
  2842. struct ionic_q_init_cmd q_init;
  2843. struct ionic_q_control_cmd q_control;
  2844. struct ionic_fw_download_cmd fw_download;
  2845. struct ionic_fw_control_cmd fw_control;
  2846. };
  2847. union ionic_dev_cmd_comp {
  2848. u32 words[4];
  2849. u8 status;
  2850. struct ionic_admin_comp comp;
  2851. struct ionic_nop_comp nop;
  2852. struct ionic_dev_identify_comp identify;
  2853. struct ionic_dev_init_comp init;
  2854. struct ionic_dev_reset_comp reset;
  2855. struct ionic_dev_getattr_comp getattr;
  2856. struct ionic_dev_setattr_comp setattr;
  2857. struct ionic_port_identify_comp port_identify;
  2858. struct ionic_port_init_comp port_init;
  2859. struct ionic_port_reset_comp port_reset;
  2860. struct ionic_port_getattr_comp port_getattr;
  2861. struct ionic_port_setattr_comp port_setattr;
  2862. struct ionic_vf_setattr_comp vf_setattr;
  2863. struct ionic_vf_getattr_comp vf_getattr;
  2864. struct ionic_vf_ctrl_comp vf_ctrl;
  2865. struct ionic_lif_identify_comp lif_identify;
  2866. struct ionic_lif_init_comp lif_init;
  2867. ionic_lif_reset_comp lif_reset;
  2868. struct ionic_qos_identify_comp qos_identify;
  2869. ionic_qos_init_comp qos_init;
  2870. ionic_qos_reset_comp qos_reset;
  2871. struct ionic_q_identify_comp q_identify;
  2872. struct ionic_q_init_comp q_init;
  2873. ionic_fw_download_comp fw_download;
  2874. struct ionic_fw_control_comp fw_control;
  2875. };
  2876. /**
  2877. * struct ionic_hwstamp_regs - Hardware current timestamp registers
  2878. * @tick_low: Low 32 bits of hardware timestamp
  2879. * @tick_high: High 32 bits of hardware timestamp
  2880. */
  2881. struct ionic_hwstamp_regs {
  2882. u32 tick_low;
  2883. u32 tick_high;
  2884. };
  2885. /**
  2886. * union ionic_dev_info_regs - Device info register format (read-only)
  2887. * @signature: Signature value of 0x44455649 ('DEVI')
  2888. * @version: Current version of info
  2889. * @asic_type: Asic type
  2890. * @asic_rev: Asic revision
  2891. * @fw_status: Firmware status
  2892. * bit 0 - 1 = fw running
  2893. * bit 4-7 - 4 bit generation number, changes on fw restart
  2894. * @fw_heartbeat: Firmware heartbeat counter
  2895. * @serial_num: Serial number
  2896. * @rsvd_pad1024: reserved byte(s)
  2897. * @fw_version: Firmware version
  2898. * @hwstamp: Hardware current timestamp registers
  2899. * @words: word access to struct contents
  2900. */
  2901. union ionic_dev_info_regs {
  2902. #define IONIC_DEVINFO_FWVERS_BUFLEN 32
  2903. #define IONIC_DEVINFO_SERIAL_BUFLEN 32
  2904. struct {
  2905. u32 signature;
  2906. u8 version;
  2907. u8 asic_type;
  2908. u8 asic_rev;
  2909. #define IONIC_FW_STS_F_RUNNING 0x01
  2910. #define IONIC_FW_STS_F_GENERATION 0xF0
  2911. u8 fw_status;
  2912. u32 fw_heartbeat;
  2913. char fw_version[IONIC_DEVINFO_FWVERS_BUFLEN];
  2914. char serial_num[IONIC_DEVINFO_SERIAL_BUFLEN];
  2915. u8 rsvd_pad1024[948];
  2916. struct ionic_hwstamp_regs hwstamp;
  2917. };
  2918. u32 words[512];
  2919. };
  2920. /**
  2921. * union ionic_dev_cmd_regs - Device command register format (read-write)
  2922. * @doorbell: Device Cmd Doorbell, write-only
  2923. * Write a 1 to signal device to process cmd,
  2924. * poll done for completion.
  2925. * @done: Done indicator, bit 0 == 1 when command is complete
  2926. * @cmd: Opcode-specific command bytes
  2927. * @comp: Opcode-specific response bytes
  2928. * @rsvd: reserved byte(s)
  2929. * @data: Opcode-specific side-data
  2930. * @words: word access to struct contents
  2931. */
  2932. union ionic_dev_cmd_regs {
  2933. struct {
  2934. u32 doorbell;
  2935. u32 done;
  2936. union ionic_dev_cmd cmd;
  2937. union ionic_dev_cmd_comp comp;
  2938. u8 rsvd[48];
  2939. u32 data[478];
  2940. } __packed;
  2941. u32 words[512];
  2942. };
  2943. /**
  2944. * union ionic_dev_regs - Device register format for bar 0 page 0
  2945. * @info: Device info registers
  2946. * @devcmd: Device command registers
  2947. * @words: word access to struct contents
  2948. */
  2949. union ionic_dev_regs {
  2950. struct {
  2951. union ionic_dev_info_regs info;
  2952. union ionic_dev_cmd_regs devcmd;
  2953. } __packed;
  2954. __le32 words[1024];
  2955. };
  2956. union ionic_adminq_cmd {
  2957. struct ionic_admin_cmd cmd;
  2958. struct ionic_nop_cmd nop;
  2959. struct ionic_q_identify_cmd q_identify;
  2960. struct ionic_q_init_cmd q_init;
  2961. struct ionic_q_control_cmd q_control;
  2962. struct ionic_lif_setattr_cmd lif_setattr;
  2963. struct ionic_lif_getattr_cmd lif_getattr;
  2964. struct ionic_lif_setphc_cmd lif_setphc;
  2965. struct ionic_rx_mode_set_cmd rx_mode_set;
  2966. struct ionic_rx_filter_add_cmd rx_filter_add;
  2967. struct ionic_rx_filter_del_cmd rx_filter_del;
  2968. struct ionic_rdma_reset_cmd rdma_reset;
  2969. struct ionic_rdma_queue_cmd rdma_queue;
  2970. struct ionic_fw_download_cmd fw_download;
  2971. struct ionic_fw_control_cmd fw_control;
  2972. };
  2973. union ionic_adminq_comp {
  2974. struct ionic_admin_comp comp;
  2975. struct ionic_nop_comp nop;
  2976. struct ionic_q_identify_comp q_identify;
  2977. struct ionic_q_init_comp q_init;
  2978. struct ionic_lif_setattr_comp lif_setattr;
  2979. struct ionic_lif_getattr_comp lif_getattr;
  2980. struct ionic_admin_comp lif_setphc;
  2981. struct ionic_rx_filter_add_comp rx_filter_add;
  2982. struct ionic_fw_control_comp fw_control;
  2983. };
  2984. #define IONIC_BARS_MAX 6
  2985. #define IONIC_PCI_BAR_DBELL 1
  2986. #define IONIC_PCI_BAR_CMB 2
  2987. #define IONIC_BAR0_SIZE 0x8000
  2988. #define IONIC_BAR2_SIZE 0x800000
  2989. #define IONIC_BAR0_DEV_INFO_REGS_OFFSET 0x0000
  2990. #define IONIC_BAR0_DEV_CMD_REGS_OFFSET 0x0800
  2991. #define IONIC_BAR0_DEV_CMD_DATA_REGS_OFFSET 0x0c00
  2992. #define IONIC_BAR0_INTR_STATUS_OFFSET 0x1000
  2993. #define IONIC_BAR0_INTR_CTRL_OFFSET 0x2000
  2994. #define IONIC_DEV_CMD_DONE 0x00000001
  2995. #define IONIC_ASIC_TYPE_CAPRI 0
  2996. /**
  2997. * struct ionic_doorbell - Doorbell register layout
  2998. * @p_index: Producer index
  2999. * @ring: Selects the specific ring of the queue to update
  3000. * Type-specific meaning:
  3001. * ring=0: Default producer/consumer queue
  3002. * ring=1: (CQ, EQ) Re-Arm queue. RDMA CQs
  3003. * send events to EQs when armed. EQs send
  3004. * interrupts when armed.
  3005. * @qid_lo: Queue destination for the producer index and flags (low bits)
  3006. * @qid_hi: Queue destination for the producer index and flags (high bits)
  3007. * @rsvd2: reserved byte(s)
  3008. */
  3009. struct ionic_doorbell {
  3010. __le16 p_index;
  3011. u8 ring;
  3012. u8 qid_lo;
  3013. __le16 qid_hi;
  3014. u16 rsvd2;
  3015. };
  3016. struct ionic_intr_status {
  3017. u32 status[2];
  3018. };
  3019. struct ionic_notifyq_cmd {
  3020. __le32 data; /* Not used but needed for qcq structure */
  3021. };
  3022. union ionic_notifyq_comp {
  3023. struct ionic_notifyq_event event;
  3024. struct ionic_link_change_event link_change;
  3025. struct ionic_reset_event reset;
  3026. struct ionic_heartbeat_event heartbeat;
  3027. struct ionic_log_event log;
  3028. };
  3029. /* Deprecate */
  3030. struct ionic_identity {
  3031. union ionic_drv_identity drv;
  3032. union ionic_dev_identity dev;
  3033. union ionic_lif_identity lif;
  3034. union ionic_port_identity port;
  3035. union ionic_qos_identity qos;
  3036. union ionic_q_identity txq;
  3037. };
  3038. #endif /* _IONIC_IF_H_ */