aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar.h
diff options
context:
space:
mode:
authorSandeep Gopalpet <Sandeep.Kumar@freescale.com>2009-11-02 02:03:00 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-03 02:40:55 -0500
commita12f801d4b349bc57622584e70e45a4ccbef53b6 (patch)
tree1b081795127d9e47aa5bac516fededa736dfc394 /drivers/net/gianfar.h
parent123b43e9716115302a0095e14f2c545811712715 (diff)
gianfar: Add per queue structure support
This patch introduces per tx and per rx queue structures. Earlier the members of these structures were inside the gfar_private structure. Moving forward if we want to support multiple queues, we need to refactor the gfar_private structure so that introduction of multiple queues is easier. Signed-off-by: Sandeep Gopalpet <Sandeep.Kumar@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gianfar.h')
-rw-r--r--drivers/net/gianfar.h116
1 files changed, 75 insertions, 41 deletions
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 05732faa2f90..a60f93f1ae07 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -7,8 +7,9 @@
7 * 7 *
8 * Author: Andy Fleming 8 * Author: Andy Fleming
9 * Maintainer: Kumar Gala 9 * Maintainer: Kumar Gala
10 * Modifier: Sandeep Gopalpet <sandeep.kumar@freescale.com>
10 * 11 *
11 * Copyright (c) 2002-2004 Freescale Semiconductor, Inc. 12 * Copyright 2002-2009 Freescale Semiconductor, Inc.
12 * 13 *
13 * This program is free software; you can redistribute it and/or modify it 14 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the 15 * under the terms of the GNU General Public License as published by the
@@ -699,6 +700,76 @@ struct gfar {
699#define FSL_GIANFAR_DEV_HAS_BD_STASHING 0x00000200 700#define FSL_GIANFAR_DEV_HAS_BD_STASHING 0x00000200
700#define FSL_GIANFAR_DEV_HAS_BUF_STASHING 0x00000400 701#define FSL_GIANFAR_DEV_HAS_BUF_STASHING 0x00000400
701 702
703/**
704 * struct gfar_priv_tx_q - per tx queue structure
705 * @txlock: per queue tx spin lock
706 * @tx_skbuff:skb pointers
707 * @skb_curtx: to be used skb pointer
708 * @skb_dirtytx:the last used skb pointer
709 * @qindex: index of this queue
710 * @dev: back pointer to the dev structure
711 * @grp: back pointer to the group to which this queue belongs
712 * @tx_bd_base: First tx buffer descriptor
713 * @cur_tx: Next free ring entry
714 * @dirty_tx: First buffer in line to be transmitted
715 * @tx_ring_size: Tx ring size
716 * @num_txbdfree: number of free TxBds
717 * @txcoalescing: enable/disable tx coalescing
718 * @txic: transmit interrupt coalescing value
719 * @txcount: coalescing value if based on tx frame count
720 * @txtime: coalescing value if based on time
721 */
722struct gfar_priv_tx_q {
723 spinlock_t txlock __attribute__ ((aligned (SMP_CACHE_BYTES)));
724 struct sk_buff ** tx_skbuff;
725 /* Buffer descriptor pointers */
726 dma_addr_t tx_bd_dma_base;
727 struct txbd8 *tx_bd_base;
728 struct txbd8 *cur_tx;
729 struct txbd8 *dirty_tx;
730 struct net_device *dev;
731 u16 skb_curtx;
732 u16 skb_dirtytx;
733 u16 qindex;
734 unsigned int tx_ring_size;
735 unsigned int num_txbdfree;
736 /* Configuration info for the coalescing features */
737 unsigned char txcoalescing;
738 unsigned long txic;
739 unsigned short txcount;
740 unsigned short txtime;
741};
742
743/**
744 * struct gfar_priv_rx_q - per rx queue structure
745 * @rxlock: per queue rx spin lock
746 * @napi: the napi poll function
747 * @rx_skbuff: skb pointers
748 * @skb_currx: currently use skb pointer
749 * @rx_bd_base: First rx buffer descriptor
750 * @cur_rx: Next free rx ring entry
751 * @qindex: index of this queue
752 * @dev: back pointer to the dev structure
753 * @rx_ring_size: Rx ring size
754 * @rxcoalescing: enable/disable rx-coalescing
755 * @rxic: receive interrupt coalescing vlaue
756 */
757
758struct gfar_priv_rx_q {
759 spinlock_t rxlock __attribute__ ((aligned (SMP_CACHE_BYTES)));
760 struct napi_struct napi;
761 struct sk_buff ** rx_skbuff;
762 struct rxbd8 *rx_bd_base;
763 struct rxbd8 *cur_rx;
764 struct net_device *dev;
765 u16 skb_currx;
766 u16 qindex;
767 unsigned int rx_ring_size;
768 /* RX Coalescing values */
769 unsigned char rxcoalescing;
770 unsigned long rxic;
771};
772
702/* Struct stolen almost completely (and shamelessly) from the FCC enet source 773/* Struct stolen almost completely (and shamelessly) from the FCC enet source
703 * (Ok, that's not so true anymore, but there is a family resemblence) 774 * (Ok, that's not so true anymore, but there is a family resemblence)
704 * The GFAR buffer descriptors track the ring buffers. The rx_bd_base 775 * The GFAR buffer descriptors track the ring buffers. The rx_bd_base
@@ -709,52 +780,15 @@ struct gfar {
709 * the buffer descriptor determines the actual condition. 780 * the buffer descriptor determines the actual condition.
710 */ 781 */
711struct gfar_private { 782struct gfar_private {
712 /* Fields controlled by TX lock */
713 spinlock_t txlock;
714
715 /* Pointer to the array of skbuffs */
716 struct sk_buff ** tx_skbuff;
717
718 /* next free skb in the array */
719 u16 skb_curtx;
720
721 /* First skb in line to be transmitted */
722 u16 skb_dirtytx;
723
724 /* Configuration info for the coalescing features */
725 unsigned char txcoalescing;
726 unsigned long txic;
727
728 /* Buffer descriptor pointers */
729 dma_addr_t tx_bd_dma_base;
730 struct txbd8 *tx_bd_base; /* First tx buffer descriptor */
731 struct txbd8 *cur_tx; /* Next free ring entry */
732 struct txbd8 *dirty_tx; /* First buffer in line
733 to be transmitted */
734 unsigned int tx_ring_size;
735 unsigned int num_txbdfree; /* number of TxBDs free */
736
737 /* RX Locked fields */
738 spinlock_t rxlock;
739 783
740 struct device_node *node; 784 struct device_node *node;
741 struct net_device *ndev; 785 struct net_device *ndev;
742 struct of_device *ofdev; 786 struct of_device *ofdev;
743 struct napi_struct napi;
744
745 /* skb array and index */
746 struct sk_buff ** rx_skbuff;
747 u16 skb_currx;
748
749 /* RX Coalescing values */
750 unsigned char rxcoalescing;
751 unsigned long rxic;
752 787
753 struct rxbd8 *rx_bd_base; /* First Rx buffers */ 788 struct gfar_priv_tx_q *tx_queue;
754 struct rxbd8 *cur_rx; /* Next free rx ring entry */ 789 struct gfar_priv_rx_q *rx_queue;
755 790
756 /* RX parameters */ 791 /* RX per device parameters */
757 unsigned int rx_ring_size;
758 unsigned int rx_buffer_size; 792 unsigned int rx_buffer_size;
759 unsigned int rx_stash_size; 793 unsigned int rx_stash_size;
760 unsigned int rx_stash_index; 794 unsigned int rx_stash_index;