cpsw_priv.h 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /*
  3. * Texas Instruments Ethernet Switch Driver
  4. */
  5. #ifndef DRIVERS_NET_ETHERNET_TI_CPSW_PRIV_H_
  6. #define DRIVERS_NET_ETHERNET_TI_CPSW_PRIV_H_
  7. #include <uapi/linux/bpf.h>
  8. #include "davinci_cpdma.h"
  9. #define CPSW_DEBUG (NETIF_MSG_HW | NETIF_MSG_WOL | \
  10. NETIF_MSG_DRV | NETIF_MSG_LINK | \
  11. NETIF_MSG_IFUP | NETIF_MSG_INTR | \
  12. NETIF_MSG_PROBE | NETIF_MSG_TIMER | \
  13. NETIF_MSG_IFDOWN | NETIF_MSG_RX_ERR | \
  14. NETIF_MSG_TX_ERR | NETIF_MSG_TX_DONE | \
  15. NETIF_MSG_PKTDATA | NETIF_MSG_TX_QUEUED | \
  16. NETIF_MSG_RX_STATUS)
  17. #define cpsw_info(priv, type, format, ...) \
  18. do { \
  19. if (netif_msg_##type(priv) && net_ratelimit()) \
  20. dev_info(priv->dev, format, ## __VA_ARGS__); \
  21. } while (0)
  22. #define cpsw_err(priv, type, format, ...) \
  23. do { \
  24. if (netif_msg_##type(priv) && net_ratelimit()) \
  25. dev_err(priv->dev, format, ## __VA_ARGS__); \
  26. } while (0)
  27. #define cpsw_dbg(priv, type, format, ...) \
  28. do { \
  29. if (netif_msg_##type(priv) && net_ratelimit()) \
  30. dev_dbg(priv->dev, format, ## __VA_ARGS__); \
  31. } while (0)
  32. #define cpsw_notice(priv, type, format, ...) \
  33. do { \
  34. if (netif_msg_##type(priv) && net_ratelimit()) \
  35. dev_notice(priv->dev, format, ## __VA_ARGS__); \
  36. } while (0)
  37. #define ALE_ALL_PORTS 0x7
  38. #define CPSW_MAJOR_VERSION(reg) (reg >> 8 & 0x7)
  39. #define CPSW_MINOR_VERSION(reg) (reg & 0xff)
  40. #define CPSW_RTL_VERSION(reg) ((reg >> 11) & 0x1f)
  41. #define CPSW_VERSION_1 0x19010a
  42. #define CPSW_VERSION_2 0x19010c
  43. #define CPSW_VERSION_3 0x19010f
  44. #define CPSW_VERSION_4 0x190112
  45. #define HOST_PORT_NUM 0
  46. #define CPSW_ALE_PORTS_NUM 3
  47. #define CPSW_SLAVE_PORTS_NUM 2
  48. #define SLIVER_SIZE 0x40
  49. #define CPSW1_HOST_PORT_OFFSET 0x028
  50. #define CPSW1_SLAVE_OFFSET 0x050
  51. #define CPSW1_SLAVE_SIZE 0x040
  52. #define CPSW1_CPDMA_OFFSET 0x100
  53. #define CPSW1_STATERAM_OFFSET 0x200
  54. #define CPSW1_HW_STATS 0x400
  55. #define CPSW1_CPTS_OFFSET 0x500
  56. #define CPSW1_ALE_OFFSET 0x600
  57. #define CPSW1_SLIVER_OFFSET 0x700
  58. #define CPSW1_WR_OFFSET 0x900
  59. #define CPSW2_HOST_PORT_OFFSET 0x108
  60. #define CPSW2_SLAVE_OFFSET 0x200
  61. #define CPSW2_SLAVE_SIZE 0x100
  62. #define CPSW2_CPDMA_OFFSET 0x800
  63. #define CPSW2_HW_STATS 0x900
  64. #define CPSW2_STATERAM_OFFSET 0xa00
  65. #define CPSW2_CPTS_OFFSET 0xc00
  66. #define CPSW2_ALE_OFFSET 0xd00
  67. #define CPSW2_SLIVER_OFFSET 0xd80
  68. #define CPSW2_BD_OFFSET 0x2000
  69. #define CPSW2_WR_OFFSET 0x1200
  70. #define CPDMA_RXTHRESH 0x0c0
  71. #define CPDMA_RXFREE 0x0e0
  72. #define CPDMA_TXHDP 0x00
  73. #define CPDMA_RXHDP 0x20
  74. #define CPDMA_TXCP 0x40
  75. #define CPDMA_RXCP 0x60
  76. #define CPSW_RX_VLAN_ENCAP_HDR_SIZE 4
  77. #define CPSW_MIN_PACKET_SIZE_VLAN (VLAN_ETH_ZLEN)
  78. #define CPSW_MIN_PACKET_SIZE (ETH_ZLEN)
  79. #define CPSW_MAX_PACKET_SIZE (VLAN_ETH_FRAME_LEN +\
  80. ETH_FCS_LEN +\
  81. CPSW_RX_VLAN_ENCAP_HDR_SIZE)
  82. #define RX_PRIORITY_MAPPING 0x76543210
  83. #define TX_PRIORITY_MAPPING 0x33221100
  84. #define CPDMA_TX_PRIORITY_MAP 0x76543210
  85. #define CPSW_VLAN_AWARE BIT(1)
  86. #define CPSW_RX_VLAN_ENCAP BIT(2)
  87. #define CPSW_ALE_VLAN_AWARE 1
  88. #define CPSW_FIFO_NORMAL_MODE (0 << 16)
  89. #define CPSW_FIFO_DUAL_MAC_MODE (1 << 16)
  90. #define CPSW_FIFO_RATE_LIMIT_MODE (2 << 16)
  91. #define CPSW_INTPACEEN (0x3f << 16)
  92. #define CPSW_INTPRESCALE_MASK (0x7FF << 0)
  93. #define CPSW_CMINTMAX_CNT 63
  94. #define CPSW_CMINTMIN_CNT 2
  95. #define CPSW_CMINTMAX_INTVL (1000 / CPSW_CMINTMIN_CNT)
  96. #define CPSW_CMINTMIN_INTVL ((1000 / CPSW_CMINTMAX_CNT) + 1)
  97. #define IRQ_NUM 2
  98. #define CPSW_MAX_QUEUES 8
  99. #define CPSW_CPDMA_DESCS_POOL_SIZE_DEFAULT 256
  100. #define CPSW_ALE_AGEOUT_DEFAULT 10 /* sec */
  101. #define CPSW_FIFO_QUEUE_TYPE_SHIFT 16
  102. #define CPSW_FIFO_SHAPE_EN_SHIFT 16
  103. #define CPSW_FIFO_RATE_EN_SHIFT 20
  104. #define CPSW_TC_NUM 4
  105. #define CPSW_FIFO_SHAPERS_NUM (CPSW_TC_NUM - 1)
  106. #define CPSW_PCT_MASK 0x7f
  107. #define CPSW_BD_RAM_SIZE 0x2000
  108. #define CPSW_RX_VLAN_ENCAP_HDR_PRIO_SHIFT 29
  109. #define CPSW_RX_VLAN_ENCAP_HDR_PRIO_MSK GENMASK(2, 0)
  110. #define CPSW_RX_VLAN_ENCAP_HDR_VID_SHIFT 16
  111. #define CPSW_RX_VLAN_ENCAP_HDR_PKT_TYPE_SHIFT 8
  112. #define CPSW_RX_VLAN_ENCAP_HDR_PKT_TYPE_MSK GENMASK(1, 0)
  113. enum {
  114. CPSW_RX_VLAN_ENCAP_HDR_PKT_VLAN_TAG = 0,
  115. CPSW_RX_VLAN_ENCAP_HDR_PKT_RESERV,
  116. CPSW_RX_VLAN_ENCAP_HDR_PKT_PRIO_TAG,
  117. CPSW_RX_VLAN_ENCAP_HDR_PKT_UNTAG,
  118. };
  119. struct cpsw_wr_regs {
  120. u32 id_ver;
  121. u32 soft_reset;
  122. u32 control;
  123. u32 int_control;
  124. u32 rx_thresh_en;
  125. u32 rx_en;
  126. u32 tx_en;
  127. u32 misc_en;
  128. u32 mem_allign1[8];
  129. u32 rx_thresh_stat;
  130. u32 rx_stat;
  131. u32 tx_stat;
  132. u32 misc_stat;
  133. u32 mem_allign2[8];
  134. u32 rx_imax;
  135. u32 tx_imax;
  136. };
  137. struct cpsw_ss_regs {
  138. u32 id_ver;
  139. u32 control;
  140. u32 soft_reset;
  141. u32 stat_port_en;
  142. u32 ptype;
  143. u32 soft_idle;
  144. u32 thru_rate;
  145. u32 gap_thresh;
  146. u32 tx_start_wds;
  147. u32 flow_control;
  148. u32 vlan_ltype;
  149. u32 ts_ltype;
  150. u32 dlr_ltype;
  151. };
  152. /* CPSW_PORT_V1 */
  153. #define CPSW1_MAX_BLKS 0x00 /* Maximum FIFO Blocks */
  154. #define CPSW1_BLK_CNT 0x04 /* FIFO Block Usage Count (Read Only) */
  155. #define CPSW1_TX_IN_CTL 0x08 /* Transmit FIFO Control */
  156. #define CPSW1_PORT_VLAN 0x0c /* VLAN Register */
  157. #define CPSW1_TX_PRI_MAP 0x10 /* Tx Header Priority to Switch Pri Mapping */
  158. #define CPSW1_TS_CTL 0x14 /* Time Sync Control */
  159. #define CPSW1_TS_SEQ_LTYPE 0x18 /* Time Sync Sequence ID Offset and Msg Type */
  160. #define CPSW1_TS_VLAN 0x1c /* Time Sync VLAN1 and VLAN2 */
  161. /* CPSW_PORT_V2 */
  162. #define CPSW2_CONTROL 0x00 /* Control Register */
  163. #define CPSW2_MAX_BLKS 0x08 /* Maximum FIFO Blocks */
  164. #define CPSW2_BLK_CNT 0x0c /* FIFO Block Usage Count (Read Only) */
  165. #define CPSW2_TX_IN_CTL 0x10 /* Transmit FIFO Control */
  166. #define CPSW2_PORT_VLAN 0x14 /* VLAN Register */
  167. #define CPSW2_TX_PRI_MAP 0x18 /* Tx Header Priority to Switch Pri Mapping */
  168. #define CPSW2_TS_SEQ_MTYPE 0x1c /* Time Sync Sequence ID Offset and Msg Type */
  169. /* CPSW_PORT_V1 and V2 */
  170. #define SA_LO 0x20 /* CPGMAC_SL Source Address Low */
  171. #define SA_HI 0x24 /* CPGMAC_SL Source Address High */
  172. #define SEND_PERCENT 0x28 /* Transmit Queue Send Percentages */
  173. /* CPSW_PORT_V2 only */
  174. #define RX_DSCP_PRI_MAP0 0x30 /* Rx DSCP Priority to Rx Packet Mapping */
  175. #define RX_DSCP_PRI_MAP1 0x34 /* Rx DSCP Priority to Rx Packet Mapping */
  176. #define RX_DSCP_PRI_MAP2 0x38 /* Rx DSCP Priority to Rx Packet Mapping */
  177. #define RX_DSCP_PRI_MAP3 0x3c /* Rx DSCP Priority to Rx Packet Mapping */
  178. #define RX_DSCP_PRI_MAP4 0x40 /* Rx DSCP Priority to Rx Packet Mapping */
  179. #define RX_DSCP_PRI_MAP5 0x44 /* Rx DSCP Priority to Rx Packet Mapping */
  180. #define RX_DSCP_PRI_MAP6 0x48 /* Rx DSCP Priority to Rx Packet Mapping */
  181. #define RX_DSCP_PRI_MAP7 0x4c /* Rx DSCP Priority to Rx Packet Mapping */
  182. /* Bit definitions for the CPSW2_CONTROL register */
  183. #define PASS_PRI_TAGGED BIT(24) /* Pass Priority Tagged */
  184. #define VLAN_LTYPE2_EN BIT(21) /* VLAN LTYPE 2 enable */
  185. #define VLAN_LTYPE1_EN BIT(20) /* VLAN LTYPE 1 enable */
  186. #define DSCP_PRI_EN BIT(16) /* DSCP Priority Enable */
  187. #define TS_107 BIT(15) /* Tyme Sync Dest IP Address 107 */
  188. #define TS_320 BIT(14) /* Time Sync Dest Port 320 enable */
  189. #define TS_319 BIT(13) /* Time Sync Dest Port 319 enable */
  190. #define TS_132 BIT(12) /* Time Sync Dest IP Addr 132 enable */
  191. #define TS_131 BIT(11) /* Time Sync Dest IP Addr 131 enable */
  192. #define TS_130 BIT(10) /* Time Sync Dest IP Addr 130 enable */
  193. #define TS_129 BIT(9) /* Time Sync Dest IP Addr 129 enable */
  194. #define TS_TTL_NONZERO BIT(8) /* Time Sync Time To Live Non-zero enable */
  195. #define TS_ANNEX_F_EN BIT(6) /* Time Sync Annex F enable */
  196. #define TS_ANNEX_D_EN BIT(4) /* Time Sync Annex D enable */
  197. #define TS_LTYPE2_EN BIT(3) /* Time Sync LTYPE 2 enable */
  198. #define TS_LTYPE1_EN BIT(2) /* Time Sync LTYPE 1 enable */
  199. #define TS_TX_EN BIT(1) /* Time Sync Transmit Enable */
  200. #define TS_RX_EN BIT(0) /* Time Sync Receive Enable */
  201. #define CTRL_V2_TS_BITS \
  202. (TS_320 | TS_319 | TS_132 | TS_131 | TS_130 | TS_129 |\
  203. TS_TTL_NONZERO | TS_ANNEX_D_EN | TS_LTYPE1_EN | VLAN_LTYPE1_EN)
  204. #define CTRL_V2_ALL_TS_MASK (CTRL_V2_TS_BITS | TS_TX_EN | TS_RX_EN)
  205. #define CTRL_V2_TX_TS_BITS (CTRL_V2_TS_BITS | TS_TX_EN)
  206. #define CTRL_V2_RX_TS_BITS (CTRL_V2_TS_BITS | TS_RX_EN)
  207. #define CTRL_V3_TS_BITS \
  208. (TS_107 | TS_320 | TS_319 | TS_132 | TS_131 | TS_130 | TS_129 |\
  209. TS_TTL_NONZERO | TS_ANNEX_F_EN | TS_ANNEX_D_EN |\
  210. TS_LTYPE1_EN | VLAN_LTYPE1_EN)
  211. #define CTRL_V3_ALL_TS_MASK (CTRL_V3_TS_BITS | TS_TX_EN | TS_RX_EN)
  212. #define CTRL_V3_TX_TS_BITS (CTRL_V3_TS_BITS | TS_TX_EN)
  213. #define CTRL_V3_RX_TS_BITS (CTRL_V3_TS_BITS | TS_RX_EN)
  214. /* Bit definitions for the CPSW2_TS_SEQ_MTYPE register */
  215. #define TS_SEQ_ID_OFFSET_SHIFT (16) /* Time Sync Sequence ID Offset */
  216. #define TS_SEQ_ID_OFFSET_MASK (0x3f)
  217. #define TS_MSG_TYPE_EN_SHIFT (0) /* Time Sync Message Type Enable */
  218. #define TS_MSG_TYPE_EN_MASK (0xffff)
  219. /* The PTP event messages - Sync, Delay_Req, Pdelay_Req, and Pdelay_Resp. */
  220. #define EVENT_MSG_BITS ((1<<0) | (1<<1) | (1<<2) | (1<<3))
  221. /* Bit definitions for the CPSW1_TS_CTL register */
  222. #define CPSW_V1_TS_RX_EN BIT(0)
  223. #define CPSW_V1_TS_TX_EN BIT(4)
  224. #define CPSW_V1_MSG_TYPE_OFS 16
  225. /* Bit definitions for the CPSW1_TS_SEQ_LTYPE register */
  226. #define CPSW_V1_SEQ_ID_OFS_SHIFT 16
  227. #define CPSW_MAX_BLKS_TX 15
  228. #define CPSW_MAX_BLKS_TX_SHIFT 4
  229. #define CPSW_MAX_BLKS_RX 5
  230. struct cpsw_host_regs {
  231. u32 max_blks;
  232. u32 blk_cnt;
  233. u32 tx_in_ctl;
  234. u32 port_vlan;
  235. u32 tx_pri_map;
  236. u32 cpdma_tx_pri_map;
  237. u32 cpdma_rx_chan_map;
  238. };
  239. struct cpsw_slave_data {
  240. struct device_node *slave_node;
  241. struct device_node *phy_node;
  242. char phy_id[MII_BUS_ID_SIZE];
  243. phy_interface_t phy_if;
  244. u8 mac_addr[ETH_ALEN];
  245. u16 dual_emac_res_vlan; /* Reserved VLAN for DualEMAC */
  246. struct phy *ifphy;
  247. bool disabled;
  248. };
  249. struct cpsw_platform_data {
  250. struct cpsw_slave_data *slave_data;
  251. u32 ss_reg_ofs; /* Subsystem control register offset */
  252. u32 channels; /* number of cpdma channels (symmetric) */
  253. u32 slaves; /* number of slave cpgmac ports */
  254. u32 active_slave;/* time stamping, ethtool and SIOCGMIIPHY slave */
  255. u32 bd_ram_size; /*buffer descriptor ram size */
  256. u32 mac_control; /* Mac control register */
  257. u16 default_vlan; /* Def VLAN for ALE lookup in VLAN aware mode*/
  258. bool dual_emac; /* Enable Dual EMAC mode */
  259. };
  260. struct cpsw_slave {
  261. void __iomem *regs;
  262. int slave_num;
  263. u32 mac_control;
  264. struct cpsw_slave_data *data;
  265. struct phy_device *phy;
  266. struct net_device *ndev;
  267. u32 port_vlan;
  268. struct cpsw_sl *mac_sl;
  269. };
  270. static inline u32 slave_read(struct cpsw_slave *slave, u32 offset)
  271. {
  272. return readl_relaxed(slave->regs + offset);
  273. }
  274. static inline void slave_write(struct cpsw_slave *slave, u32 val, u32 offset)
  275. {
  276. writel_relaxed(val, slave->regs + offset);
  277. }
  278. struct cpsw_vector {
  279. struct cpdma_chan *ch;
  280. int budget;
  281. };
  282. struct cpsw_common {
  283. struct device *dev;
  284. struct cpsw_platform_data data;
  285. struct napi_struct napi_rx;
  286. struct napi_struct napi_tx;
  287. struct cpsw_ss_regs __iomem *regs;
  288. struct cpsw_wr_regs __iomem *wr_regs;
  289. u8 __iomem *hw_stats;
  290. struct cpsw_host_regs __iomem *host_port_regs;
  291. u32 version;
  292. u32 coal_intvl;
  293. u32 bus_freq_mhz;
  294. int rx_packet_max;
  295. int descs_pool_size;
  296. struct cpsw_slave *slaves;
  297. struct cpdma_ctlr *dma;
  298. struct cpsw_vector txv[CPSW_MAX_QUEUES];
  299. struct cpsw_vector rxv[CPSW_MAX_QUEUES];
  300. struct cpsw_ale *ale;
  301. bool quirk_irq;
  302. bool rx_irq_disabled;
  303. bool tx_irq_disabled;
  304. u32 irqs_table[IRQ_NUM];
  305. int misc_irq;
  306. struct cpts *cpts;
  307. struct devlink *devlink;
  308. int rx_ch_num, tx_ch_num;
  309. int speed;
  310. int usage_count;
  311. struct page_pool *page_pool[CPSW_MAX_QUEUES];
  312. u8 br_members;
  313. struct net_device *hw_bridge_dev;
  314. bool ale_bypass;
  315. u8 base_mac[ETH_ALEN];
  316. };
  317. struct cpsw_ale_ratelimit {
  318. unsigned long cookie;
  319. u64 rate_packet_ps;
  320. };
  321. struct cpsw_priv {
  322. struct net_device *ndev;
  323. struct device *dev;
  324. u32 msg_enable;
  325. u8 mac_addr[ETH_ALEN];
  326. bool rx_pause;
  327. bool tx_pause;
  328. bool mqprio_hw;
  329. int fifo_bw[CPSW_TC_NUM];
  330. int shp_cfg_speed;
  331. int tx_ts_enabled;
  332. int rx_ts_enabled;
  333. struct bpf_prog *xdp_prog;
  334. struct xdp_rxq_info xdp_rxq[CPSW_MAX_QUEUES];
  335. struct xdp_attachment_info xdpi;
  336. u32 emac_port;
  337. struct cpsw_common *cpsw;
  338. int offload_fwd_mark;
  339. u32 tx_packet_min;
  340. struct cpsw_ale_ratelimit ale_bc_ratelimit;
  341. struct cpsw_ale_ratelimit ale_mc_ratelimit;
  342. };
  343. #define ndev_to_cpsw(ndev) (((struct cpsw_priv *)netdev_priv(ndev))->cpsw)
  344. #define napi_to_cpsw(napi) container_of(napi, struct cpsw_common, napi)
  345. extern int (*cpsw_slave_index)(struct cpsw_common *cpsw,
  346. struct cpsw_priv *priv);
  347. struct addr_sync_ctx {
  348. struct net_device *ndev;
  349. const u8 *addr; /* address to be synched */
  350. int consumed; /* number of address instances */
  351. int flush; /* flush flag */
  352. };
  353. #define CPSW_XMETA_OFFSET ALIGN(sizeof(struct xdp_frame), sizeof(long))
  354. #define CPSW_XDP_CONSUMED 1
  355. #define CPSW_XDP_PASS 0
  356. struct __aligned(sizeof(long)) cpsw_meta_xdp {
  357. struct net_device *ndev;
  358. int ch;
  359. };
  360. /* The buf includes headroom compatible with both skb and xdpf */
  361. #define CPSW_HEADROOM_NA (max(XDP_PACKET_HEADROOM, NET_SKB_PAD) + NET_IP_ALIGN)
  362. static inline int cpsw_is_xdpf_handle(void *handle)
  363. {
  364. return (unsigned long)handle & BIT(0);
  365. }
  366. static inline void *cpsw_xdpf_to_handle(struct xdp_frame *xdpf)
  367. {
  368. return (void *)((unsigned long)xdpf | BIT(0));
  369. }
  370. static inline struct xdp_frame *cpsw_handle_to_xdpf(void *handle)
  371. {
  372. return (struct xdp_frame *)((unsigned long)handle & ~BIT(0));
  373. }
  374. int cpsw_init_common(struct cpsw_common *cpsw, void __iomem *ss_regs,
  375. int ale_ageout, phys_addr_t desc_mem_phys,
  376. int descs_pool_size);
  377. void cpsw_split_res(struct cpsw_common *cpsw);
  378. int cpsw_fill_rx_channels(struct cpsw_priv *priv);
  379. void cpsw_intr_enable(struct cpsw_common *cpsw);
  380. void cpsw_intr_disable(struct cpsw_common *cpsw);
  381. void cpsw_tx_handler(void *token, int len, int status);
  382. int cpsw_create_xdp_rxqs(struct cpsw_common *cpsw);
  383. void cpsw_destroy_xdp_rxqs(struct cpsw_common *cpsw);
  384. int cpsw_ndo_bpf(struct net_device *ndev, struct netdev_bpf *bpf);
  385. int cpsw_xdp_tx_frame(struct cpsw_priv *priv, struct xdp_frame *xdpf,
  386. struct page *page, int port);
  387. int cpsw_run_xdp(struct cpsw_priv *priv, int ch, struct xdp_buff *xdp,
  388. struct page *page, int port, int *len);
  389. irqreturn_t cpsw_tx_interrupt(int irq, void *dev_id);
  390. irqreturn_t cpsw_rx_interrupt(int irq, void *dev_id);
  391. irqreturn_t cpsw_misc_interrupt(int irq, void *dev_id);
  392. int cpsw_tx_mq_poll(struct napi_struct *napi_tx, int budget);
  393. int cpsw_tx_poll(struct napi_struct *napi_tx, int budget);
  394. int cpsw_rx_mq_poll(struct napi_struct *napi_rx, int budget);
  395. int cpsw_rx_poll(struct napi_struct *napi_rx, int budget);
  396. void cpsw_rx_vlan_encap(struct sk_buff *skb);
  397. void soft_reset(const char *module, void __iomem *reg);
  398. void cpsw_set_slave_mac(struct cpsw_slave *slave, struct cpsw_priv *priv);
  399. void cpsw_ndo_tx_timeout(struct net_device *ndev, unsigned int txqueue);
  400. int cpsw_need_resplit(struct cpsw_common *cpsw);
  401. int cpsw_ndo_ioctl(struct net_device *dev, struct ifreq *req, int cmd);
  402. int cpsw_ndo_set_tx_maxrate(struct net_device *ndev, int queue, u32 rate);
  403. int cpsw_ndo_setup_tc(struct net_device *ndev, enum tc_setup_type type,
  404. void *type_data);
  405. bool cpsw_shp_is_off(struct cpsw_priv *priv);
  406. void cpsw_cbs_resume(struct cpsw_slave *slave, struct cpsw_priv *priv);
  407. void cpsw_mqprio_resume(struct cpsw_slave *slave, struct cpsw_priv *priv);
  408. void cpsw_qos_clsflower_resume(struct cpsw_priv *priv);
  409. /* ethtool */
  410. u32 cpsw_get_msglevel(struct net_device *ndev);
  411. void cpsw_set_msglevel(struct net_device *ndev, u32 value);
  412. int cpsw_get_coalesce(struct net_device *ndev, struct ethtool_coalesce *coal,
  413. struct kernel_ethtool_coalesce *kernel_coal,
  414. struct netlink_ext_ack *extack);
  415. int cpsw_set_coalesce(struct net_device *ndev, struct ethtool_coalesce *coal,
  416. struct kernel_ethtool_coalesce *kernel_coal,
  417. struct netlink_ext_ack *extack);
  418. int cpsw_get_sset_count(struct net_device *ndev, int sset);
  419. void cpsw_get_strings(struct net_device *ndev, u32 stringset, u8 *data);
  420. void cpsw_get_ethtool_stats(struct net_device *ndev,
  421. struct ethtool_stats *stats, u64 *data);
  422. void cpsw_get_pauseparam(struct net_device *ndev,
  423. struct ethtool_pauseparam *pause);
  424. void cpsw_get_wol(struct net_device *ndev, struct ethtool_wolinfo *wol);
  425. int cpsw_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol);
  426. int cpsw_get_regs_len(struct net_device *ndev);
  427. void cpsw_get_regs(struct net_device *ndev, struct ethtool_regs *regs, void *p);
  428. int cpsw_ethtool_op_begin(struct net_device *ndev);
  429. void cpsw_ethtool_op_complete(struct net_device *ndev);
  430. void cpsw_get_channels(struct net_device *ndev, struct ethtool_channels *ch);
  431. int cpsw_get_link_ksettings(struct net_device *ndev,
  432. struct ethtool_link_ksettings *ecmd);
  433. int cpsw_set_link_ksettings(struct net_device *ndev,
  434. const struct ethtool_link_ksettings *ecmd);
  435. int cpsw_get_eee(struct net_device *ndev, struct ethtool_eee *edata);
  436. int cpsw_set_eee(struct net_device *ndev, struct ethtool_eee *edata);
  437. int cpsw_nway_reset(struct net_device *ndev);
  438. void cpsw_get_ringparam(struct net_device *ndev,
  439. struct ethtool_ringparam *ering,
  440. struct kernel_ethtool_ringparam *kernel_ering,
  441. struct netlink_ext_ack *extack);
  442. int cpsw_set_ringparam(struct net_device *ndev,
  443. struct ethtool_ringparam *ering,
  444. struct kernel_ethtool_ringparam *kernel_ering,
  445. struct netlink_ext_ack *extack);
  446. int cpsw_set_channels_common(struct net_device *ndev,
  447. struct ethtool_channels *chs,
  448. cpdma_handler_fn rx_handler);
  449. int cpsw_get_ts_info(struct net_device *ndev, struct ethtool_ts_info *info);
  450. #endif /* DRIVERS_NET_ETHERNET_TI_CPSW_PRIV_H_ */