Searched refs:c2_port (Results 1 - 2 of 2) sorted by relevance

/linux-4.1.27/drivers/infiniband/hw/amso1100/
H A Dc2.c81 static void c2_reset(struct c2_port *c2_port);
95 static void c2_set_rxbufsize(struct c2_port *c2_port) c2_set_rxbufsize() argument
97 struct net_device *netdev = c2_port->netdev; c2_set_rxbufsize()
100 c2_port->rx_buf_size = c2_set_rxbufsize()
104 c2_port->rx_buf_size = sizeof(struct c2_rxp_hdr) + RX_BUF_SIZE; c2_set_rxbufsize()
209 static inline int c2_rx_alloc(struct c2_port *c2_port, struct c2_element *elem) c2_rx_alloc() argument
211 struct c2_dev *c2dev = c2_port->c2dev; c2_rx_alloc()
218 skb = dev_alloc_skb(c2_port->rx_buf_size); c2_rx_alloc()
221 c2_port->netdev->name); c2_rx_alloc()
228 skb->dev = c2_port->netdev; c2_rx_alloc()
230 maplen = c2_port->rx_buf_size; c2_rx_alloc()
258 static int c2_rx_fill(struct c2_port *c2_port) c2_rx_fill() argument
260 struct c2_ring *rx_ring = &c2_port->rx_ring; c2_rx_fill()
266 if (c2_rx_alloc(c2_port, elem)) { c2_rx_fill()
277 static void c2_rx_clean(struct c2_port *c2_port) c2_rx_clean() argument
279 struct c2_dev *c2dev = c2_port->c2dev; c2_rx_clean()
280 struct c2_ring *rx_ring = &c2_port->rx_ring; c2_rx_clean()
324 static void c2_tx_clean(struct c2_port *c2_port) c2_tx_clean() argument
326 struct c2_ring *tx_ring = &c2_port->tx_ring; c2_tx_clean()
332 spin_lock_irqsave(&c2_port->tx_lock, flags); c2_tx_clean()
350 c2_port->netdev->stats.tx_dropped++; c2_tx_clean()
361 c2_tx_free(c2_port->c2dev, elem); c2_tx_clean()
366 c2_port->tx_avail = c2_port->tx_ring.count - 1; c2_tx_clean()
367 c2_port->c2dev->cur_tx = tx_ring->to_use - tx_ring->start; c2_tx_clean()
369 if (c2_port->tx_avail > MAX_SKB_FRAGS + 1) c2_tx_clean()
370 netif_wake_queue(c2_port->netdev); c2_tx_clean()
372 spin_unlock_irqrestore(&c2_port->tx_lock, flags); c2_tx_clean()
381 struct c2_port *c2_port = netdev_priv(netdev); c2_tx_interrupt() local
382 struct c2_dev *c2dev = c2_port->c2dev; c2_tx_interrupt()
383 struct c2_ring *tx_ring = &c2_port->tx_ring; c2_tx_interrupt()
387 spin_lock(&c2_port->tx_lock); c2_tx_interrupt()
397 if (netif_msg_tx_done(c2_port)) { c2_tx_interrupt()
408 ++(c2_port->tx_avail); c2_tx_interrupt()
414 && c2_port->tx_avail > MAX_SKB_FRAGS + 1) c2_tx_interrupt()
417 spin_unlock(&c2_port->tx_lock); c2_tx_interrupt()
420 static void c2_rx_error(struct c2_port *c2_port, struct c2_element *elem) c2_rx_error() argument
430 elem - c2_port->rx_ring.start); c2_rx_error()
458 c2_port->netdev->stats.rx_dropped++; c2_rx_error()
463 struct c2_port *c2_port = netdev_priv(netdev); c2_rx_interrupt() local
464 struct c2_dev *c2dev = c2_port->c2dev; c2_rx_interrupt()
465 struct c2_ring *rx_ring = &c2_port->rx_ring; c2_rx_interrupt()
494 c2_rx_error(c2_port, elem); c2_rx_interrupt()
502 if (c2_rx_alloc(c2_port, elem)) { c2_rx_interrupt()
503 c2_rx_error(c2_port, elem); c2_rx_interrupt()
587 struct c2_port *c2_port = netdev_priv(netdev); c2_up() local
588 struct c2_dev *c2dev = c2_port->c2dev; c2_up()
596 if (netif_msg_ifup(c2_port)) c2_up()
600 c2_set_rxbufsize(c2_port); c2_up()
603 rx_size = c2_port->rx_ring.count * sizeof(struct c2_rx_desc); c2_up()
604 tx_size = c2_port->tx_ring.count * sizeof(struct c2_tx_desc); c2_up()
606 c2_port->mem_size = tx_size + rx_size; c2_up()
607 c2_port->mem = pci_zalloc_consistent(c2dev->pcidev, c2_port->mem_size, c2_up()
608 &c2_port->dma); c2_up()
609 if (c2_port->mem == NULL) { c2_up()
617 c2_rx_ring_alloc(&c2_port->rx_ring, c2_port->mem, c2_port->dma, c2_up()
624 if (c2_rx_fill(c2_port)) { c2_up()
630 if ((ret = c2_tx_ring_alloc(&c2_port->tx_ring, c2_port->mem + rx_size, c2_up()
631 c2_port->dma + rx_size, c2_up()
638 c2_port->tx_avail = c2_port->tx_ring.count - 1; c2_up()
639 c2_port->tx_ring.to_use = c2_port->tx_ring.to_clean = c2_up()
640 c2_port->tx_ring.start + c2dev->cur_tx; c2_up()
644 BUG_ON(c2_port->tx_ring.to_use != c2_port->tx_ring.to_clean); c2_up()
647 c2_reset(c2_port); c2_up()
650 for (i = 0, elem = c2_port->rx_ring.start; i < c2_port->rx_ring.count; c2_up()
679 c2_rx_clean(c2_port); c2_up()
680 kfree(c2_port->rx_ring.start); c2_up()
683 pci_free_consistent(c2dev->pcidev, c2_port->mem_size, c2_port->mem, c2_up()
684 c2_port->dma); c2_up()
691 struct c2_port *c2_port = netdev_priv(netdev); c2_down() local
692 struct c2_dev *c2dev = c2_port->c2dev; c2_down()
694 if (netif_msg_ifdown(c2_port)) c2_down()
713 c2_reset(c2_port); c2_down()
718 c2_tx_clean(c2_port); c2_down()
719 c2_rx_clean(c2_port); c2_down()
722 kfree(c2_port->rx_ring.start); c2_down()
723 kfree(c2_port->tx_ring.start); c2_down()
724 pci_free_consistent(c2dev->pcidev, c2_port->mem_size, c2_port->mem, c2_down()
725 c2_port->dma); c2_down()
730 static void c2_reset(struct c2_port *c2_port) c2_reset() argument
732 struct c2_dev *c2dev = c2_port->c2dev; c2_reset()
758 struct c2_port *c2_port = netdev_priv(netdev); c2_xmit_frame() local
759 struct c2_dev *c2dev = c2_port->c2dev; c2_xmit_frame()
760 struct c2_ring *tx_ring = &c2_port->tx_ring; c2_xmit_frame()
767 spin_lock_irqsave(&c2_port->tx_lock, flags); c2_xmit_frame()
769 if (unlikely(c2_port->tx_avail < (skb_shinfo(skb)->nr_frags + 1))) { c2_xmit_frame()
771 spin_unlock_irqrestore(&c2_port->tx_lock, flags); c2_xmit_frame()
824 c2_port->tx_avail -= (skb_shinfo(skb)->nr_frags + 1); c2_xmit_frame()
826 if (c2_port->tx_avail <= MAX_SKB_FRAGS + 1) { c2_xmit_frame()
828 if (netif_msg_tx_queued(c2_port)) c2_xmit_frame()
833 spin_unlock_irqrestore(&c2_port->tx_lock, flags); c2_xmit_frame()
842 struct c2_port *c2_port = netdev_priv(netdev); c2_tx_timeout() local
844 if (netif_msg_timer(c2_port)) c2_tx_timeout()
847 c2_tx_clean(c2_port); c2_tx_timeout()
882 struct c2_port *c2_port = NULL; c2_devinit() local
883 struct net_device *netdev = alloc_etherdev(sizeof(*c2_port)); c2_devinit()
886 pr_debug("c2_port etherdev alloc failed"); c2_devinit()
896 c2_port = netdev_priv(netdev); c2_devinit()
897 c2_port->netdev = netdev; c2_devinit()
898 c2_port->c2dev = c2dev; c2_devinit()
899 c2_port->msg_enable = netif_msg_init(debug, default_msg); c2_devinit()
900 c2_port->tx_ring.count = C2_NUM_TX_DESC; c2_devinit()
901 c2_port->rx_ring.count = C2_NUM_RX_DESC; c2_devinit()
903 spin_lock_init(&c2_port->tx_lock); c2_devinit()
H A Dc2.h356 struct c2_port { struct

Completed in 92 milliseconds