Lines Matching refs:emac

44 void prueth_cleanup_rx_chns(struct prueth_emac *emac,  in prueth_cleanup_rx_chns()  argument
56 void prueth_cleanup_tx_chns(struct prueth_emac *emac) in prueth_cleanup_tx_chns() argument
60 for (i = 0; i < emac->tx_ch_num; i++) { in prueth_cleanup_tx_chns()
61 struct prueth_tx_chn *tx_chn = &emac->tx_chns[i]; in prueth_cleanup_tx_chns()
77 void prueth_ndev_del_tx_napi(struct prueth_emac *emac, int num) in prueth_ndev_del_tx_napi() argument
82 struct prueth_tx_chn *tx_chn = &emac->tx_chns[i]; in prueth_ndev_del_tx_napi()
128 int emac_tx_complete_packets(struct prueth_emac *emac, int chn, in emac_tx_complete_packets() argument
131 struct net_device *ndev = emac->ndev; in emac_tx_complete_packets()
141 tx_chn = &emac->tx_chns[chn]; in emac_tx_complete_packets()
150 if (atomic_dec_and_test(&emac->tdown_cnt)) in emac_tx_complete_packets()
151 complete(&emac->tdown_complete); in emac_tx_complete_packets()
161 if (emac->is_sr1 && *(swdata) == emac->cmd_data) { in emac_tx_complete_packets()
210 struct prueth_emac *emac = tx_chn->emac; in emac_napi_tx_poll() local
214 num_tx_packets = emac_tx_complete_packets(emac, tx_chn->id, budget, in emac_napi_tx_poll()
243 int prueth_ndev_add_tx_napi(struct prueth_emac *emac) in prueth_ndev_add_tx_napi() argument
245 struct prueth *prueth = emac->prueth; in prueth_ndev_add_tx_napi()
248 for (i = 0; i < emac->tx_ch_num; i++) { in prueth_ndev_add_tx_napi()
249 struct prueth_tx_chn *tx_chn = &emac->tx_chns[i]; in prueth_ndev_add_tx_napi()
251 netif_napi_add_tx(emac->ndev, &tx_chn->napi_tx, emac_napi_tx_poll); in prueth_ndev_add_tx_napi()
268 prueth_ndev_del_tx_napi(emac, i); in prueth_ndev_add_tx_napi()
273 int prueth_init_tx_chns(struct prueth_emac *emac) in prueth_init_tx_chns() argument
282 struct device *dev = emac->prueth->dev; in prueth_init_tx_chns()
283 struct net_device *ndev = emac->ndev; in prueth_init_tx_chns()
287 slice = prueth_emac_slice(emac); in prueth_init_tx_chns()
291 init_completion(&emac->tdown_complete); in prueth_init_tx_chns()
300 for (i = 0; i < emac->tx_ch_num; i++) { in prueth_init_tx_chns()
301 struct prueth_tx_chn *tx_chn = &emac->tx_chns[i]; in prueth_init_tx_chns()
307 tx_chn->emac = emac; in prueth_init_tx_chns()
349 prueth_cleanup_tx_chns(emac); in prueth_init_tx_chns()
354 int prueth_init_rx_chns(struct prueth_emac *emac, in prueth_init_rx_chns() argument
360 struct device *dev = emac->prueth->dev; in prueth_init_rx_chns()
361 struct net_device *ndev = emac->ndev; in prueth_init_rx_chns()
366 slice = prueth_emac_slice(emac); in prueth_init_rx_chns()
406 if (emac->is_sr1 && !strcmp(name, "rxmgm")) { in prueth_init_rx_chns()
407 emac->rx_mgm_flow_id_base = flow_id_base; in prueth_init_rx_chns()
410 emac->rx_flow_id_base = flow_id_base; in prueth_init_rx_chns()
436 rx_flow_cfg.rxfdq_cfg.mode = emac->prueth->pdata.fdqring_mode; in prueth_init_rx_chns()
459 prueth_cleanup_rx_chns(emac, rx_chn, max_rflows); in prueth_init_rx_chns()
464 int prueth_dma_rx_push(struct prueth_emac *emac, in prueth_dma_rx_push() argument
468 struct net_device *ndev = emac->ndev; in prueth_dma_rx_push()
518 void emac_rx_timestamp(struct prueth_emac *emac, in emac_rx_timestamp() argument
524 if (emac->is_sr1) { in emac_rx_timestamp()
527 u32 hi_sw = readl(emac->prueth->shram.va + in emac_rx_timestamp()
538 static int emac_rx_packet(struct prueth_emac *emac, u32 flow_id) in emac_rx_packet() argument
540 struct prueth_rx_chn *rx_chn = &emac->rx_chns; in emac_rx_packet()
542 struct net_device *ndev = emac->ndev; in emac_rx_packet()
567 if (emac->rx_ts_enabled) in emac_rx_packet()
568 emac_rx_timestamp(emac, skb, psdata); in emac_rx_packet()
591 if (emac->prueth->is_switch_mode) in emac_rx_packet()
592 skb->offload_fwd_mark = emac->offload_fwd_mark; in emac_rx_packet()
594 napi_gro_receive(&emac->napi_rx, skb); in emac_rx_packet()
600 ret = prueth_dma_rx_push(emac, new_skb, &emac->rx_chns); in emac_rx_packet()
632 static int prueth_tx_ts_cookie_get(struct prueth_emac *emac) in prueth_tx_ts_cookie_get() argument
638 if (!emac->tx_ts_skb[i]) { in prueth_tx_ts_cookie_get()
639 emac->tx_ts_skb[i] = ERR_PTR(-EBUSY); /* reserve slot */ in prueth_tx_ts_cookie_get()
662 struct prueth_emac *emac = netdev_priv(ndev); in icssg_ndo_start_xmit() local
663 struct prueth *prueth = emac->prueth; in icssg_ndo_start_xmit()
677 tx_chn = &emac->tx_chns[q_idx]; in icssg_ndo_start_xmit()
702 emac->tx_ts_enabled) { in icssg_ndo_start_xmit()
703 tx_ts_cookie = prueth_tx_ts_cookie_get(emac); in icssg_ndo_start_xmit()
709 emac->tx_ts_skb[tx_ts_cookie] = skb_get(skb); in icssg_ndo_start_xmit()
719 dst_tag_id = emac->port_id | (q_idx << 8); in icssg_ndo_start_xmit()
787 atomic_inc(&emac->tx_ts_pending); in icssg_ndo_start_xmit()
803 dev_kfree_skb_any(emac->tx_ts_skb[tx_ts_cookie]); in icssg_ndo_start_xmit()
804 emac->tx_ts_skb[tx_ts_cookie] = NULL; in icssg_ndo_start_xmit()
821 dev_kfree_skb_any(emac->tx_ts_skb[tx_ts_cookie]); in icssg_ndo_start_xmit()
822 emac->tx_ts_skb[tx_ts_cookie] = NULL; in icssg_ndo_start_xmit()
849 struct prueth_emac *emac = dev_id; in prueth_rx_irq() local
852 napi_schedule(&emac->napi_rx); in prueth_rx_irq()
858 void prueth_emac_stop(struct prueth_emac *emac) in prueth_emac_stop() argument
860 struct prueth *prueth = emac->prueth; in prueth_emac_stop()
863 switch (emac->port_id) { in prueth_emac_stop()
871 netdev_err(emac->ndev, "invalid port\n"); in prueth_emac_stop()
875 emac->fw_running = 0; in prueth_emac_stop()
876 if (!emac->is_sr1) in prueth_emac_stop()
883 void prueth_cleanup_tx_ts(struct prueth_emac *emac) in prueth_cleanup_tx_ts() argument
888 if (emac->tx_ts_skb[i]) { in prueth_cleanup_tx_ts()
889 dev_kfree_skb_any(emac->tx_ts_skb[i]); in prueth_cleanup_tx_ts()
890 emac->tx_ts_skb[i] = NULL; in prueth_cleanup_tx_ts()
898 struct prueth_emac *emac = prueth_napi_to_emac(napi_rx); in icssg_napi_rx_poll() local
899 int rx_flow = emac->is_sr1 ? in icssg_napi_rx_poll()
901 int flow = emac->is_sr1 ? in icssg_napi_rx_poll()
911 ret = emac_rx_packet(emac, flow); in icssg_napi_rx_poll()
922 if (unlikely(emac->rx_pace_timeout_ns)) { in icssg_napi_rx_poll()
923 hrtimer_start(&emac->rx_hrtimer, in icssg_napi_rx_poll()
924 ns_to_ktime(emac->rx_pace_timeout_ns), in icssg_napi_rx_poll()
927 enable_irq(emac->rx_chns.irq[rx_flow]); in icssg_napi_rx_poll()
935 int prueth_prepare_rx_chan(struct prueth_emac *emac, in prueth_prepare_rx_chan() argument
947 ret = prueth_dma_rx_push(emac, skb, chn); in prueth_prepare_rx_chan()
949 netdev_err(emac->ndev, in prueth_prepare_rx_chan()
961 void prueth_reset_tx_chan(struct prueth_emac *emac, int ch_num, in prueth_reset_tx_chan() argument
968 k3_udma_glue_reset_tx_chn(emac->tx_chns[i].tx_chn, in prueth_reset_tx_chan()
969 &emac->tx_chns[i], in prueth_reset_tx_chan()
971 k3_udma_glue_disable_tx_chn(emac->tx_chns[i].tx_chn); in prueth_reset_tx_chan()
997 struct prueth_emac *emac = netdev_priv(ndev); in emac_set_ts_config() local
1005 emac->tx_ts_enabled = 0; in emac_set_ts_config()
1008 emac->tx_ts_enabled = 1; in emac_set_ts_config()
1016 emac->rx_ts_enabled = 0; in emac_set_ts_config()
1033 emac->rx_ts_enabled = 1; in emac_set_ts_config()
1046 struct prueth_emac *emac = netdev_priv(ndev); in emac_get_ts_config() local
1050 config.tx_type = emac->tx_ts_enabled ? HWTSTAMP_TX_ON : HWTSTAMP_TX_OFF; in emac_get_ts_config()
1051 config.rx_filter = emac->rx_ts_enabled ? HWTSTAMP_FILTER_ALL : HWTSTAMP_FILTER_NONE; in emac_get_ts_config()
1075 struct prueth_emac *emac = netdev_priv(ndev); in icssg_ndo_get_stats64() local
1077 emac_update_hardware_stats(emac); in icssg_ndo_get_stats64()
1079 stats->rx_packets = emac_get_stat_by_name(emac, "rx_packets"); in icssg_ndo_get_stats64()
1080 stats->rx_bytes = emac_get_stat_by_name(emac, "rx_bytes"); in icssg_ndo_get_stats64()
1081 stats->tx_packets = emac_get_stat_by_name(emac, "tx_packets"); in icssg_ndo_get_stats64()
1082 stats->tx_bytes = emac_get_stat_by_name(emac, "tx_bytes"); in icssg_ndo_get_stats64()
1083 stats->rx_crc_errors = emac_get_stat_by_name(emac, "rx_crc_errors"); in icssg_ndo_get_stats64()
1084 stats->rx_over_errors = emac_get_stat_by_name(emac, "rx_over_errors"); in icssg_ndo_get_stats64()
1085 stats->multicast = emac_get_stat_by_name(emac, "rx_multicast_frames"); in icssg_ndo_get_stats64()
1097 struct prueth_emac *emac = netdev_priv(ndev); in icssg_ndo_get_phys_port_name() local
1100 ret = snprintf(name, len, "p%d", emac->port_id); in icssg_ndo_get_phys_port_name()
1149 struct prueth_emac *emac; in prueth_netdev_exit() local
1156 emac = prueth->emac[mac]; in prueth_netdev_exit()
1157 if (!emac) in prueth_netdev_exit()
1160 if (of_phy_is_fixed_link(emac->phy_node)) in prueth_netdev_exit()
1161 of_phy_deregister_fixed_link(emac->phy_node); in prueth_netdev_exit()
1163 netif_napi_del(&emac->napi_rx); in prueth_netdev_exit()
1165 pruss_release_mem_region(prueth->pruss, &emac->dram); in prueth_netdev_exit()
1166 destroy_workqueue(emac->cmd_wq); in prueth_netdev_exit()
1167 free_netdev(emac->ndev); in prueth_netdev_exit()
1168 prueth->emac[mac] = NULL; in prueth_netdev_exit()