hns_dsaf_mac.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476
  1. /*
  2. * Copyright (c) 2014-2015 Hisilicon Limited.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 2 of the License, or
  7. * (at your option) any later version.
  8. */
  9. #ifndef _HNS_DSAF_MAC_H
  10. #define _HNS_DSAF_MAC_H
  11. #include <linux/if_vlan.h>
  12. #include <linux/kernel.h>
  13. #include <linux/phy.h>
  14. #include <linux/regmap.h>
  15. #include "hns_dsaf_main.h"
  16. struct dsaf_device;
  17. #define MAC_GMAC_SUPPORTED \
  18. (SUPPORTED_10baseT_Half \
  19. | SUPPORTED_10baseT_Full \
  20. | SUPPORTED_100baseT_Half \
  21. | SUPPORTED_100baseT_Full \
  22. | SUPPORTED_Autoneg)
  23. #define MAC_DEFAULT_MTU (ETH_HLEN + ETH_FCS_LEN + VLAN_HLEN + ETH_DATA_LEN)
  24. #define MAC_MAX_MTU 9600
  25. #define MAC_MAX_MTU_V2 9728
  26. #define MAC_MIN_MTU 68
  27. #define MAC_MAX_MTU_DBG MAC_DEFAULT_MTU
  28. #define MAC_DEFAULT_PAUSE_TIME 0xffff
  29. #define MAC_GMAC_IDX 0
  30. #define MAC_XGMAC_IDX 1
  31. #define ETH_STATIC_REG 1
  32. #define ETH_DUMP_REG 5
  33. /* check mac addr broadcast */
  34. #define MAC_IS_BROADCAST(p) ((*(p) == 0xff) && (*((p) + 1) == 0xff) && \
  35. (*((p) + 2) == 0xff) && (*((p) + 3) == 0xff) && \
  36. (*((p) + 4) == 0xff) && (*((p) + 5) == 0xff))
  37. /* check mac addr is 01-00-5e-xx-xx-xx*/
  38. #define MAC_IS_L3_MULTICAST(p) ((*((p) + 0) == 0x01) && \
  39. (*((p) + 1) == 0x00) && \
  40. (*((p) + 2) == 0x5e))
  41. /*check the mac addr is 0 in all bit*/
  42. #define MAC_IS_ALL_ZEROS(p) ((*(p) == 0) && (*((p) + 1) == 0) && \
  43. (*((p) + 2) == 0) && (*((p) + 3) == 0) && \
  44. (*((p) + 4) == 0) && (*((p) + 5) == 0))
  45. /*check mac addr multicast*/
  46. #define MAC_IS_MULTICAST(p) ((*((u8 *)((p) + 0)) & 0x01) ? (1) : (0))
  47. struct mac_priv {
  48. void *mac;
  49. };
  50. /* net speed */
  51. enum mac_speed {
  52. MAC_SPEED_10 = 10, /**< 10 Mbps */
  53. MAC_SPEED_100 = 100, /**< 100 Mbps */
  54. MAC_SPEED_1000 = 1000, /**< 1000 Mbps = 1 Gbps */
  55. MAC_SPEED_10000 = 10000 /**< 10000 Mbps = 10 Gbps */
  56. };
  57. /*mac interface keyword */
  58. enum mac_intf {
  59. MAC_IF_NONE = 0x00000000, /**< interface not invalid */
  60. MAC_IF_MII = 0x00010000, /**< MII interface */
  61. MAC_IF_RMII = 0x00020000, /**< RMII interface */
  62. MAC_IF_SMII = 0x00030000, /**< SMII interface */
  63. MAC_IF_GMII = 0x00040000, /**< GMII interface */
  64. MAC_IF_RGMII = 0x00050000, /**< RGMII interface */
  65. MAC_IF_TBI = 0x00060000, /**< TBI interface */
  66. MAC_IF_RTBI = 0x00070000, /**< RTBI interface */
  67. MAC_IF_SGMII = 0x00080000, /**< SGMII interface */
  68. MAC_IF_XGMII = 0x00090000, /**< XGMII interface */
  69. MAC_IF_QSGMII = 0x000a0000 /**< QSGMII interface */
  70. };
  71. /*mac mode */
  72. enum mac_mode {
  73. /**< Invalid Ethernet mode */
  74. MAC_MODE_INVALID = 0,
  75. /**< 10 Mbps MII */
  76. MAC_MODE_MII_10 = (MAC_IF_MII | MAC_SPEED_10),
  77. /**< 100 Mbps MII */
  78. MAC_MODE_MII_100 = (MAC_IF_MII | MAC_SPEED_100),
  79. /**< 10 Mbps RMII */
  80. MAC_MODE_RMII_10 = (MAC_IF_RMII | MAC_SPEED_10),
  81. /**< 100 Mbps RMII */
  82. MAC_MODE_RMII_100 = (MAC_IF_RMII | MAC_SPEED_100),
  83. /**< 10 Mbps SMII */
  84. MAC_MODE_SMII_10 = (MAC_IF_SMII | MAC_SPEED_10),
  85. /**< 100 Mbps SMII */
  86. MAC_MODE_SMII_100 = (MAC_IF_SMII | MAC_SPEED_100),
  87. /**< 1000 Mbps GMII */
  88. MAC_MODE_GMII_1000 = (MAC_IF_GMII | MAC_SPEED_1000),
  89. /**< 10 Mbps RGMII */
  90. MAC_MODE_RGMII_10 = (MAC_IF_RGMII | MAC_SPEED_10),
  91. /**< 100 Mbps RGMII */
  92. MAC_MODE_RGMII_100 = (MAC_IF_RGMII | MAC_SPEED_100),
  93. /**< 1000 Mbps RGMII */
  94. MAC_MODE_RGMII_1000 = (MAC_IF_RGMII | MAC_SPEED_1000),
  95. /**< 1000 Mbps TBI */
  96. MAC_MODE_TBI_1000 = (MAC_IF_TBI | MAC_SPEED_1000),
  97. /**< 1000 Mbps RTBI */
  98. MAC_MODE_RTBI_1000 = (MAC_IF_RTBI | MAC_SPEED_1000),
  99. /**< 10 Mbps SGMII */
  100. MAC_MODE_SGMII_10 = (MAC_IF_SGMII | MAC_SPEED_10),
  101. /**< 100 Mbps SGMII */
  102. MAC_MODE_SGMII_100 = (MAC_IF_SGMII | MAC_SPEED_100),
  103. /**< 1000 Mbps SGMII */
  104. MAC_MODE_SGMII_1000 = (MAC_IF_SGMII | MAC_SPEED_1000),
  105. /**< 10000 Mbps XGMII */
  106. MAC_MODE_XGMII_10000 = (MAC_IF_XGMII | MAC_SPEED_10000),
  107. /**< 1000 Mbps QSGMII */
  108. MAC_MODE_QSGMII_1000 = (MAC_IF_QSGMII | MAC_SPEED_1000)
  109. };
  110. /*mac communicate mode*/
  111. enum mac_commom_mode {
  112. MAC_COMM_MODE_NONE = 0, /**< No transmit/receive communication */
  113. MAC_COMM_MODE_RX = 1, /**< Only receive communication */
  114. MAC_COMM_MODE_TX = 2, /**< Only transmit communication */
  115. MAC_COMM_MODE_RX_AND_TX = 3 /**< Both tx and rx communication */
  116. };
  117. /*mac statistics */
  118. struct mac_statistics {
  119. u64 stat_pkts64; /* r-10G tr-DT 64 byte frame counter */
  120. u64 stat_pkts65to127; /* r-10G 65 to 127 byte frame counter */
  121. u64 stat_pkts128to255; /* r-10G 128 to 255 byte frame counter */
  122. u64 stat_pkts256to511; /*r-10G 256 to 511 byte frame counter */
  123. u64 stat_pkts512to1023;/* r-10G 512 to 1023 byte frame counter */
  124. u64 stat_pkts1024to1518; /* r-10G 1024 to 1518 byte frame counter */
  125. u64 stat_pkts1519to1522; /* r-10G 1519 to 1522 byte good frame count*/
  126. /* Total number of packets that were less than 64 octets */
  127. /* long with a wrong CRC.*/
  128. u64 stat_fragments;
  129. /* Total number of packets longer than valid maximum length octets */
  130. u64 stat_jabbers;
  131. /* number of dropped packets due to internal errors of */
  132. /* the MAC Client. */
  133. u64 stat_drop_events;
  134. /* Incremented when frames of correct length but with */
  135. /* CRC error are received.*/
  136. u64 stat_crc_align_errors;
  137. /* Total number of packets that were less than 64 octets */
  138. /* long with a good CRC.*/
  139. u64 stat_undersize_pkts;
  140. u64 stat_oversize_pkts; /**< T,B.D*/
  141. u64 stat_rx_pause; /**< Pause MAC Control received */
  142. u64 stat_tx_pause; /**< Pause MAC Control sent */
  143. u64 in_octets; /**< Total number of byte received. */
  144. u64 in_pkts; /* Total number of packets received.*/
  145. u64 in_mcast_pkts; /* Total number of multicast frame received */
  146. u64 in_bcast_pkts; /* Total number of broadcast frame received */
  147. /* Frames received, but discarded due to */
  148. /* problems within the MAC RX. */
  149. u64 in_discards;
  150. u64 in_errors; /* Number of frames received with error: */
  151. /* - FIFO Overflow Error */
  152. /* - CRC Error */
  153. /* - Frame Too Long Error */
  154. /* - Alignment Error */
  155. u64 out_octets; /*Total number of byte sent. */
  156. u64 out_pkts; /**< Total number of packets sent .*/
  157. u64 out_mcast_pkts; /* Total number of multicast frame sent */
  158. u64 out_bcast_pkts; /* Total number of multicast frame sent */
  159. /* Frames received, but discarded due to problems within */
  160. /* the MAC TX N/A!.*/
  161. u64 out_discards;
  162. u64 out_errors; /*Number of frames transmitted with error: */
  163. /* - FIFO Overflow Error */
  164. /* - FIFO Underflow Error */
  165. /* - Other */
  166. };
  167. /*mac para struct ,mac get param from nic or dsaf when initialize*/
  168. struct mac_params {
  169. char addr[ETH_ALEN];
  170. void *vaddr; /*virtual address*/
  171. struct device *dev;
  172. u8 mac_id;
  173. /**< Ethernet operation mode (MAC-PHY interface and speed) */
  174. enum mac_mode mac_mode;
  175. };
  176. struct mac_info {
  177. u16 speed;/* The forced speed (lower bits) in */
  178. /* *mbps. Please use */
  179. /* * ethtool_cmd_speed()/_set() to */
  180. /* * access it */
  181. u8 duplex; /* Duplex, half or full */
  182. u8 auto_neg; /* Enable or disable autonegotiation */
  183. enum hnae_loop loop_mode;
  184. u8 tx_pause_en;
  185. u8 tx_pause_time;
  186. u8 rx_pause_en;
  187. u8 pad_and_crc_en;
  188. u8 promiscuous_en;
  189. u8 port_en; /*port enable*/
  190. };
  191. struct mac_entry_idx {
  192. u8 addr[ETH_ALEN];
  193. u16 vlan_id:12;
  194. u16 valid:1;
  195. u16 qos:3;
  196. };
  197. struct mac_hw_stats {
  198. u64 rx_good_pkts; /* only for xgmac */
  199. u64 rx_good_bytes;
  200. u64 rx_total_pkts; /* only for xgmac */
  201. u64 rx_total_bytes; /* only for xgmac */
  202. u64 rx_bad_bytes; /* only for gmac */
  203. u64 rx_uc_pkts;
  204. u64 rx_mc_pkts;
  205. u64 rx_bc_pkts;
  206. u64 rx_fragment_err; /* only for xgmac */
  207. u64 rx_undersize; /* only for xgmac */
  208. u64 rx_under_min;
  209. u64 rx_minto64; /* only for gmac */
  210. u64 rx_64bytes;
  211. u64 rx_65to127;
  212. u64 rx_128to255;
  213. u64 rx_256to511;
  214. u64 rx_512to1023;
  215. u64 rx_1024to1518;
  216. u64 rx_1519tomax;
  217. u64 rx_1519tomax_good; /* only for xgmac */
  218. u64 rx_oversize;
  219. u64 rx_jabber_err;
  220. u64 rx_fcs_err;
  221. u64 rx_vlan_pkts; /* only for gmac */
  222. u64 rx_data_err; /* only for gmac */
  223. u64 rx_align_err; /* only for gmac */
  224. u64 rx_long_err; /* only for gmac */
  225. u64 rx_pfc_tc0;
  226. u64 rx_pfc_tc1; /* only for xgmac */
  227. u64 rx_pfc_tc2; /* only for xgmac */
  228. u64 rx_pfc_tc3; /* only for xgmac */
  229. u64 rx_pfc_tc4; /* only for xgmac */
  230. u64 rx_pfc_tc5; /* only for xgmac */
  231. u64 rx_pfc_tc6; /* only for xgmac */
  232. u64 rx_pfc_tc7; /* only for xgmac */
  233. u64 rx_unknown_ctrl;
  234. u64 rx_filter_pkts; /* only for gmac */
  235. u64 rx_filter_bytes; /* only for gmac */
  236. u64 rx_fifo_overrun_err;/* only for gmac */
  237. u64 rx_len_err; /* only for gmac */
  238. u64 rx_comma_err; /* only for gmac */
  239. u64 rx_symbol_err; /* only for xgmac */
  240. u64 tx_good_to_sw; /* only for xgmac */
  241. u64 tx_bad_to_sw; /* only for xgmac */
  242. u64 rx_1731_pkts; /* only for xgmac */
  243. u64 tx_good_bytes;
  244. u64 tx_good_pkts; /* only for xgmac */
  245. u64 tx_total_bytes; /* only for xgmac */
  246. u64 tx_total_pkts; /* only for xgmac */
  247. u64 tx_bad_bytes; /* only for gmac */
  248. u64 tx_bad_pkts; /* only for xgmac */
  249. u64 tx_uc_pkts;
  250. u64 tx_mc_pkts;
  251. u64 tx_bc_pkts;
  252. u64 tx_undersize; /* only for xgmac */
  253. u64 tx_fragment_err; /* only for xgmac */
  254. u64 tx_under_min_pkts; /* only for gmac */
  255. u64 tx_64bytes;
  256. u64 tx_65to127;
  257. u64 tx_128to255;
  258. u64 tx_256to511;
  259. u64 tx_512to1023;
  260. u64 tx_1024to1518;
  261. u64 tx_1519tomax;
  262. u64 tx_1519tomax_good; /* only for xgmac */
  263. u64 tx_oversize; /* only for xgmac */
  264. u64 tx_jabber_err;
  265. u64 tx_underrun_err; /* only for gmac */
  266. u64 tx_vlan; /* only for gmac */
  267. u64 tx_crc_err; /* only for gmac */
  268. u64 tx_pfc_tc0;
  269. u64 tx_pfc_tc1; /* only for xgmac */
  270. u64 tx_pfc_tc2; /* only for xgmac */
  271. u64 tx_pfc_tc3; /* only for xgmac */
  272. u64 tx_pfc_tc4; /* only for xgmac */
  273. u64 tx_pfc_tc5; /* only for xgmac */
  274. u64 tx_pfc_tc6; /* only for xgmac */
  275. u64 tx_pfc_tc7; /* only for xgmac */
  276. u64 tx_ctrl; /* only for xgmac */
  277. u64 tx_1731_pkts; /* only for xgmac */
  278. u64 tx_1588_pkts; /* only for xgmac */
  279. u64 rx_good_from_sw; /* only for xgmac */
  280. u64 rx_bad_from_sw; /* only for xgmac */
  281. };
  282. struct hns_mac_cb {
  283. struct device *dev;
  284. struct dsaf_device *dsaf_dev;
  285. struct mac_priv priv;
  286. struct fwnode_handle *fw_port;
  287. u8 __iomem *vaddr;
  288. u8 __iomem *sys_ctl_vaddr;
  289. u8 __iomem *serdes_vaddr;
  290. struct regmap *serdes_ctrl;
  291. struct regmap *cpld_ctrl;
  292. char mc_mask[ETH_ALEN];
  293. u32 cpld_ctrl_reg;
  294. u32 port_rst_off;
  295. u32 port_mode_off;
  296. struct mac_entry_idx addr_entry_idx[DSAF_MAX_VM_NUM];
  297. u8 sfp_prsnt;
  298. u8 cpld_led_value;
  299. u8 mac_id;
  300. u8 link;
  301. u8 half_duplex;
  302. u16 speed;
  303. u16 max_speed;
  304. u16 max_frm;
  305. u16 tx_pause_frm_time;
  306. u32 if_support;
  307. u64 txpkt_for_led;
  308. u64 rxpkt_for_led;
  309. enum hnae_port_type mac_type;
  310. enum hnae_media_type media_type;
  311. phy_interface_t phy_if;
  312. enum hnae_loop loop_mode;
  313. struct phy_device *phy_dev;
  314. struct mac_hw_stats hw_stats;
  315. };
  316. struct mac_driver {
  317. /*init Mac when init nic or dsaf*/
  318. void (*mac_init)(void *mac_drv);
  319. /*remove mac when remove nic or dsaf*/
  320. void (*mac_free)(void *mac_drv);
  321. /*enable mac when enable nic or dsaf*/
  322. void (*mac_enable)(void *mac_drv, enum mac_commom_mode mode);
  323. /*disable mac when disable nic or dsaf*/
  324. void (*mac_disable)(void *mac_drv, enum mac_commom_mode mode);
  325. /* config mac address*/
  326. void (*set_mac_addr)(void *mac_drv, char *mac_addr);
  327. /*adjust mac mode of port,include speed and duplex*/
  328. int (*adjust_link)(void *mac_drv, enum mac_speed speed,
  329. u32 full_duplex);
  330. /* need adjust link */
  331. bool (*need_adjust_link)(void *mac_drv, enum mac_speed speed,
  332. int duplex);
  333. /* config autoegotaite mode of port*/
  334. void (*set_an_mode)(void *mac_drv, u8 enable);
  335. /* config loopbank mode */
  336. int (*config_loopback)(void *mac_drv, enum hnae_loop loop_mode,
  337. u8 enable);
  338. /* config mtu*/
  339. void (*config_max_frame_length)(void *mac_drv, u16 newval);
  340. /*config PAD and CRC enable */
  341. void (*config_pad_and_crc)(void *mac_drv, u8 newval);
  342. /* config duplex mode*/
  343. void (*config_half_duplex)(void *mac_drv, u8 newval);
  344. /*config tx pause time,if pause_time is zero,disable tx pause enable*/
  345. void (*set_tx_auto_pause_frames)(void *mac_drv, u16 pause_time);
  346. /*config rx pause enable*/
  347. void (*set_rx_ignore_pause_frames)(void *mac_drv, u32 enable);
  348. /* config rx mode for promiscuous*/
  349. void (*set_promiscuous)(void *mac_drv, u8 enable);
  350. void (*mac_pausefrm_cfg)(void *mac_drv, u32 rx_en, u32 tx_en);
  351. void (*autoneg_stat)(void *mac_drv, u32 *enable);
  352. int (*set_pause_enable)(void *mac_drv, u32 rx_en, u32 tx_en);
  353. void (*get_pause_enable)(void *mac_drv, u32 *rx_en, u32 *tx_en);
  354. void (*get_link_status)(void *mac_drv, u32 *link_stat);
  355. /* get the imporant regs*/
  356. void (*get_regs)(void *mac_drv, void *data);
  357. int (*get_regs_count)(void);
  358. /* get strings name for ethtool statistic */
  359. void (*get_strings)(u32 stringset, u8 *data);
  360. /* get the number of strings*/
  361. int (*get_sset_count)(int stringset);
  362. /* get the statistic by ethtools*/
  363. void (*get_ethtool_stats)(void *mac_drv, u64 *data);
  364. /* get mac information */
  365. void (*get_info)(void *mac_drv, struct mac_info *mac_info);
  366. void (*update_stats)(void *mac_drv);
  367. int (*wait_fifo_clean)(void *mac_drv);
  368. enum mac_mode mac_mode;
  369. u8 mac_id;
  370. struct hns_mac_cb *mac_cb;
  371. void __iomem *io_base;
  372. unsigned int mac_en_flg;/*you'd better don't enable mac twice*/
  373. unsigned int virt_dev_num;
  374. struct device *dev;
  375. };
  376. struct mac_stats_string {
  377. const char desc[ETH_GSTRING_LEN];
  378. unsigned long offset;
  379. };
  380. #define MAC_MAKE_MODE(interface, speed) (enum mac_mode)((interface) | (speed))
  381. #define MAC_INTERFACE_FROM_MODE(mode) (enum mac_intf)((mode) & 0xFFFF0000)
  382. #define MAC_SPEED_FROM_MODE(mode) (enum mac_speed)((mode) & 0x0000FFFF)
  383. #define MAC_STATS_FIELD_OFF(field) (offsetof(struct mac_hw_stats, field))
  384. static inline struct mac_driver *hns_mac_get_drv(
  385. const struct hns_mac_cb *mac_cb)
  386. {
  387. return (struct mac_driver *)(mac_cb->priv.mac);
  388. }
  389. void *hns_gmac_config(struct hns_mac_cb *mac_cb,
  390. struct mac_params *mac_param);
  391. void *hns_xgmac_config(struct hns_mac_cb *mac_cb,
  392. struct mac_params *mac_param);
  393. int hns_mac_init(struct dsaf_device *dsaf_dev);
  394. void mac_adjust_link(struct net_device *net_dev);
  395. bool hns_mac_need_adjust_link(struct hns_mac_cb *mac_cb, int speed, int duplex);
  396. void hns_mac_get_link_status(struct hns_mac_cb *mac_cb, u32 *link_status);
  397. int hns_mac_change_vf_addr(struct hns_mac_cb *mac_cb, u32 vmid, char *addr);
  398. int hns_mac_set_multi(struct hns_mac_cb *mac_cb,
  399. u32 port_num, char *addr, bool enable);
  400. int hns_mac_vm_config_bc_en(struct hns_mac_cb *mac_cb, u32 vm, bool enable);
  401. void hns_mac_start(struct hns_mac_cb *mac_cb);
  402. void hns_mac_stop(struct hns_mac_cb *mac_cb);
  403. void hns_mac_uninit(struct dsaf_device *dsaf_dev);
  404. void hns_mac_adjust_link(struct hns_mac_cb *mac_cb, int speed, int duplex);
  405. void hns_mac_reset(struct hns_mac_cb *mac_cb);
  406. void hns_mac_get_autoneg(struct hns_mac_cb *mac_cb, u32 *auto_neg);
  407. void hns_mac_get_pauseparam(struct hns_mac_cb *mac_cb, u32 *rx_en, u32 *tx_en);
  408. int hns_mac_set_autoneg(struct hns_mac_cb *mac_cb, u8 enable);
  409. int hns_mac_set_pauseparam(struct hns_mac_cb *mac_cb, u32 rx_en, u32 tx_en);
  410. int hns_mac_set_mtu(struct hns_mac_cb *mac_cb, u32 new_mtu, u32 buf_size);
  411. int hns_mac_get_port_info(struct hns_mac_cb *mac_cb,
  412. u8 *auto_neg, u16 *speed, u8 *duplex);
  413. int hns_mac_config_mac_loopback(struct hns_mac_cb *mac_cb,
  414. enum hnae_loop loop, int en);
  415. void hns_mac_update_stats(struct hns_mac_cb *mac_cb);
  416. void hns_mac_get_stats(struct hns_mac_cb *mac_cb, u64 *data);
  417. void hns_mac_get_strings(struct hns_mac_cb *mac_cb, int stringset, u8 *data);
  418. int hns_mac_get_sset_count(struct hns_mac_cb *mac_cb, int stringset);
  419. void hns_mac_get_regs(struct hns_mac_cb *mac_cb, void *data);
  420. int hns_mac_get_regs_count(struct hns_mac_cb *mac_cb);
  421. void hns_set_led_opt(struct hns_mac_cb *mac_cb);
  422. int hns_cpld_led_set_id(struct hns_mac_cb *mac_cb,
  423. enum hnae_led_state status);
  424. void hns_mac_set_promisc(struct hns_mac_cb *mac_cb, u8 en);
  425. int hns_mac_get_inner_port_num(struct hns_mac_cb *mac_cb,
  426. u8 vmid, u8 *port_num);
  427. int hns_mac_add_uc_addr(struct hns_mac_cb *mac_cb, u8 vf_id,
  428. const unsigned char *addr);
  429. int hns_mac_rm_uc_addr(struct hns_mac_cb *mac_cb, u8 vf_id,
  430. const unsigned char *addr);
  431. int hns_mac_clr_multicast(struct hns_mac_cb *mac_cb, int vfn);
  432. void hns_mac_enable(struct hns_mac_cb *mac_cb, enum mac_commom_mode mode);
  433. void hns_mac_disable(struct hns_mac_cb *mac_cb, enum mac_commom_mode mode);
  434. int hns_mac_wait_fifo_clean(struct hns_mac_cb *mac_cb);
  435. #endif /* _HNS_DSAF_MAC_H */