Lines Matching refs:mse

92 #define to_mse102x_spi(mse) container_of((mse), struct mse102x_net_spi, mse102x)  argument
148 static void mse102x_tx_cmd_spi(struct mse102x_net *mse, u16 cmd) in mse102x_tx_cmd_spi() argument
150 struct mse102x_net_spi *mses = to_mse102x_spi(mse); in mse102x_tx_cmd_spi()
165 netdev_err(mse->ndev, "%s: spi_sync() failed: %d\n", in mse102x_tx_cmd_spi()
167 mse->stats.xfer_err++; in mse102x_tx_cmd_spi()
171 static int mse102x_rx_cmd_spi(struct mse102x_net *mse, u8 *rxb) in mse102x_rx_cmd_spi() argument
173 struct mse102x_net_spi *mses = to_mse102x_spi(mse); in mse102x_rx_cmd_spi()
176 __be16 *txb = (__be16 *)mse->txd; in mse102x_rx_cmd_spi()
177 __be16 *cmd = (__be16 *)mse->rxd; in mse102x_rx_cmd_spi()
178 u8 *trx = mse->rxd; in mse102x_rx_cmd_spi()
190 netdev_err(mse->ndev, "%s: spi_sync() failed: %d\n", in mse102x_rx_cmd_spi()
192 mse->stats.xfer_err++; in mse102x_rx_cmd_spi()
196 mse->stats.invalid_cmd++; in mse102x_rx_cmd_spi()
219 static int mse102x_tx_frame_spi(struct mse102x_net *mse, struct sk_buff *txp, in mse102x_tx_frame_spi() argument
222 struct mse102x_net_spi *mses = to_mse102x_spi(mse); in mse102x_tx_frame_spi()
228 netif_dbg(mse, tx_queued, mse->ndev, "%s: skb %p, %d@%p\n", in mse102x_tx_frame_spi()
255 netdev_err(mse->ndev, "%s: spi_sync() failed: %d\n", in mse102x_tx_frame_spi()
257 mse->stats.xfer_err++; in mse102x_tx_frame_spi()
263 static int mse102x_rx_frame_spi(struct mse102x_net *mse, u8 *buff, in mse102x_rx_frame_spi() argument
266 struct mse102x_net_spi *mses = to_mse102x_spi(mse); in mse102x_rx_frame_spi()
279 netdev_err(mse->ndev, "%s: spi_sync() failed: %d\n", in mse102x_rx_frame_spi()
281 mse->stats.xfer_err++; in mse102x_rx_frame_spi()
283 netdev_dbg(mse->ndev, "%s: SPI start of frame is invalid (0x%04x)\n", in mse102x_rx_frame_spi()
285 mse->stats.invalid_sof++; in mse102x_rx_frame_spi()
288 netdev_dbg(mse->ndev, "%s: SPI frame tail is invalid (0x%04x)\n", in mse102x_rx_frame_spi()
290 mse->stats.invalid_dft++; in mse102x_rx_frame_spi()
304 static void mse102x_rx_pkt_spi(struct mse102x_net *mse) in mse102x_rx_pkt_spi() argument
314 mse102x_tx_cmd_spi(mse, CMD_CTR); in mse102x_rx_pkt_spi()
315 ret = mse102x_rx_cmd_spi(mse, (u8 *)&rx); in mse102x_rx_pkt_spi()
321 mse102x_tx_cmd_spi(mse, CMD_CTR); in mse102x_rx_pkt_spi()
322 ret = mse102x_rx_cmd_spi(mse, (u8 *)&rx); in mse102x_rx_pkt_spi()
330 mse->stats.invalid_rts++; in mse102x_rx_pkt_spi()
341 mse->stats.invalid_len++; in mse102x_rx_pkt_spi()
346 skb = netdev_alloc_skb_ip_align(mse->ndev, rxalign); in mse102x_rx_pkt_spi()
355 if (mse102x_rx_frame_spi(mse, rxpkt, rxlen)) { in mse102x_rx_pkt_spi()
356 mse->ndev->stats.rx_errors++; in mse102x_rx_pkt_spi()
361 if (netif_msg_pktdata(mse)) in mse102x_rx_pkt_spi()
364 skb->protocol = eth_type_trans(skb, mse->ndev); in mse102x_rx_pkt_spi()
367 mse->ndev->stats.rx_packets++; in mse102x_rx_pkt_spi()
368 mse->ndev->stats.rx_bytes += rxlen; in mse102x_rx_pkt_spi()
371 static int mse102x_tx_pkt_spi(struct mse102x_net *mse, struct sk_buff *txb, in mse102x_tx_pkt_spi() argument
384 mse102x_tx_cmd_spi(mse, CMD_RTS | (txb->len + pad)); in mse102x_tx_pkt_spi()
385 ret = mse102x_rx_cmd_spi(mse, (u8 *)&rx); in mse102x_tx_pkt_spi()
395 mse->stats.invalid_ctr++; in mse102x_tx_pkt_spi()
407 netif_stop_queue(mse->ndev); in mse102x_tx_pkt_spi()
416 ret = mse102x_tx_frame_spi(mse, txb, pad); in mse102x_tx_pkt_spi()
431 struct mse102x_net *mse; in mse102x_tx_work() local
436 mse = &mses->mse102x; in mse102x_tx_work()
438 while ((txb = skb_dequeue(&mse->txq))) { in mse102x_tx_work()
440 ret = mse102x_tx_pkt_spi(mse, txb, work_timeout); in mse102x_tx_work()
443 mse->ndev->stats.tx_dropped++; in mse102x_tx_work()
445 mse->ndev->stats.tx_bytes += txb->len; in mse102x_tx_work()
446 mse->ndev->stats.tx_packets++; in mse102x_tx_work()
453 if (netif_msg_timer(mse)) in mse102x_tx_work()
454 netdev_err(mse->ndev, "tx work timeout\n"); in mse102x_tx_work()
456 mse->stats.tx_timeout++; in mse102x_tx_work()
459 netif_wake_queue(mse->ndev); in mse102x_tx_work()
465 struct mse102x_net *mse = netdev_priv(ndev); in mse102x_start_xmit_spi() local
466 struct mse102x_net_spi *mses = to_mse102x_spi(mse); in mse102x_start_xmit_spi()
468 netif_dbg(mse, tx_queued, ndev, in mse102x_start_xmit_spi()
471 skb_queue_tail(&mse->txq, skb); in mse102x_start_xmit_spi()
473 if (skb_queue_len(&mse->txq) >= TX_QUEUE_MAX) in mse102x_start_xmit_spi()
481 static void mse102x_init_mac(struct mse102x_net *mse, struct device_node *np) in mse102x_init_mac() argument
483 struct net_device *ndev = mse->ndev; in mse102x_init_mac()
496 struct mse102x_net *mse = _mse; in mse102x_irq() local
497 struct mse102x_net_spi *mses = to_mse102x_spi(mse); in mse102x_irq()
500 mse102x_rx_pkt_spi(mse); in mse102x_irq()
508 struct mse102x_net *mse = netdev_priv(ndev); in mse102x_net_open() local
512 ndev->name, mse); in mse102x_net_open()
518 netif_dbg(mse, ifup, ndev, "opening\n"); in mse102x_net_open()
524 netif_dbg(mse, ifup, ndev, "network device up\n"); in mse102x_net_open()
531 struct mse102x_net *mse = netdev_priv(ndev); in mse102x_net_stop() local
532 struct mse102x_net_spi *mses = to_mse102x_spi(mse); in mse102x_net_stop()
534 netif_info(mse, ifdown, ndev, "shutting down\n"); in mse102x_net_stop()
536 netif_carrier_off(mse->ndev); in mse102x_net_stop()
543 skb_queue_purge(&mse->txq); in mse102x_net_stop()
545 free_irq(ndev->irq, mse); in mse102x_net_stop()
569 struct mse102x_net *mse = netdev_priv(ndev); in mse102x_get_msglevel() local
571 return mse->msg_enable; in mse102x_get_msglevel()
576 struct mse102x_net *mse = netdev_priv(ndev); in mse102x_set_msglevel() local
578 mse->msg_enable = to; in mse102x_set_msglevel()
584 struct mse102x_net *mse = netdev_priv(ndev); in mse102x_get_ethtool_stats() local
585 struct mse102x_stats *st = &mse->stats; in mse102x_get_ethtool_stats()
629 struct mse102x_net *mse = dev_get_drvdata(dev); in mse102x_suspend() local
630 struct net_device *ndev = mse->ndev; in mse102x_suspend()
642 struct mse102x_net *mse = dev_get_drvdata(dev); in mse102x_resume() local
643 struct net_device *ndev = mse->ndev; in mse102x_resume()
661 struct mse102x_net *mse; in mse102x_probe_spi() local
694 mse = netdev_priv(ndev); in mse102x_probe_spi()
695 mses = to_mse102x_spi(mse); in mse102x_probe_spi()
706 mse->ndev = ndev; in mse102x_probe_spi()
709 mse->msg_enable = netif_msg_init(-1, MSG_DEFAULT); in mse102x_probe_spi()
711 skb_queue_head_init(&mse->txq); in mse102x_probe_spi()
715 dev_set_drvdata(dev, mse); in mse102x_probe_spi()
717 netif_carrier_off(mse->ndev); in mse102x_probe_spi()
721 mse102x_init_mac(mse, dev->of_node); in mse102x_probe_spi()
736 struct mse102x_net *mse = dev_get_drvdata(&spi->dev); in mse102x_remove_spi() local
737 struct mse102x_net_spi *mses = to_mse102x_spi(mse); in mse102x_remove_spi()
739 if (netif_msg_drv(mse)) in mse102x_remove_spi()
743 unregister_netdev(mse->ndev); in mse102x_remove_spi()