aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/gianfar.h
diff options
context:
space:
mode:
authorSandeep Gopalpet <Sandeep.Kumar@freescale.com>2009-11-02 02:03:34 -0500
committerDavid S. Miller <davem@davemloft.net>2009-11-03 02:40:59 -0500
commit46ceb60ca80fa07703bc6eb8f4651f900dff5a82 (patch)
tree9bd694c3b1559cbd0fa72bff1f521ce4bcc95aa6 /drivers/net/gianfar.h
parent2e0246c72fa2e2b61865a2d5aaff1cc9155b9447 (diff)
gianfar: Add Multiple group Support
This patch introduces multiple group support for etsec2.0 devices. Multiple group support is provided by mapping the set of enabled queues to different groups and then programming the per group regsiters imask, ievent, rstat, tstat. The queues corresponding to a group are indicated by programming isrg (interrupt steering) registers. 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.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h
index 08518c205035..a2c1f963cdd6 100644
--- a/drivers/net/gianfar.h
+++ b/drivers/net/gianfar.h
@@ -79,6 +79,9 @@ extern const char gfar_driver_version[];
79#define MAX_TX_QS 0x8 79#define MAX_TX_QS 0x8
80#define MAX_RX_QS 0x8 80#define MAX_RX_QS 0x8
81 81
82/* MAXIMUM NUMBER OF GROUPS SUPPORTED */
83#define MAXGROUPS 0x2
84
82/* These need to be powers of 2 for this driver */ 85/* These need to be powers of 2 for this driver */
83#define DEFAULT_TX_RING_SIZE 256 86#define DEFAULT_TX_RING_SIZE 256
84#define DEFAULT_RX_RING_SIZE 256 87#define DEFAULT_RX_RING_SIZE 256
@@ -795,7 +798,24 @@ struct gfar {
795#define FSL_GIANFAR_DEV_HAS_BD_STASHING 0x00000200 798#define FSL_GIANFAR_DEV_HAS_BD_STASHING 0x00000200
796#define FSL_GIANFAR_DEV_HAS_BUF_STASHING 0x00000400 799#define FSL_GIANFAR_DEV_HAS_BUF_STASHING 0x00000400
797 800
801#if (MAXGROUPS == 2)
802#define DEFAULT_MAPPING 0xAA
803#else
798#define DEFAULT_MAPPING 0xFF 804#define DEFAULT_MAPPING 0xFF
805#endif
806
807#define ISRG_SHIFT_TX 0x10
808#define ISRG_SHIFT_RX 0x18
809
810/* The same driver can operate in two modes */
811/* SQ_SG_MODE: Single Queue Single Group Mode
812 * (Backward compatible mode)
813 * MQ_MG_MODE: Multi Queue Multi Group mode
814 */
815enum {
816 SQ_SG_MODE = 0,
817 MQ_MG_MODE
818};
799 819
800/** 820/**
801 * struct gfar_priv_tx_q - per tx queue structure 821 * struct gfar_priv_tx_q - per tx queue structure
@@ -825,6 +845,7 @@ struct gfar_priv_tx_q {
825 struct txbd8 *cur_tx; 845 struct txbd8 *cur_tx;
826 struct txbd8 *dirty_tx; 846 struct txbd8 *dirty_tx;
827 struct net_device *dev; 847 struct net_device *dev;
848 struct gfar_priv_grp *grp;
828 u16 skb_curtx; 849 u16 skb_curtx;
829 u16 skb_dirtytx; 850 u16 skb_dirtytx;
830 u16 qindex; 851 u16 qindex;
@@ -858,6 +879,7 @@ struct gfar_priv_rx_q {
858 struct rxbd8 *rx_bd_base; 879 struct rxbd8 *rx_bd_base;
859 struct rxbd8 *cur_rx; 880 struct rxbd8 *cur_rx;
860 struct net_device *dev; 881 struct net_device *dev;
882 struct gfar_priv_grp *grp;
861 u16 skb_currx; 883 u16 skb_currx;
862 u16 qindex; 884 u16 qindex;
863 unsigned int rx_ring_size; 885 unsigned int rx_ring_size;
@@ -885,6 +907,7 @@ struct gfar_priv_grp {
885 struct napi_struct napi; 907 struct napi_struct napi;
886 struct gfar_private *priv; 908 struct gfar_private *priv;
887 struct gfar __iomem *regs; 909 struct gfar __iomem *regs;
910 unsigned int grp_id;
888 unsigned int rx_bit_map; 911 unsigned int rx_bit_map;
889 unsigned int tx_bit_map; 912 unsigned int tx_bit_map;
890 unsigned int num_tx_queues; 913 unsigned int num_tx_queues;
@@ -916,6 +939,8 @@ struct gfar_private {
916 /* Indicates how many tx, rx queues are enabled */ 939 /* Indicates how many tx, rx queues are enabled */
917 unsigned int num_tx_queues; 940 unsigned int num_tx_queues;
918 unsigned int num_rx_queues; 941 unsigned int num_rx_queues;
942 unsigned int num_grps;
943 unsigned int mode;
919 944
920 /* The total tx and rx ring size for the enabled queues */ 945 /* The total tx and rx ring size for the enabled queues */
921 unsigned int total_tx_ring_size; 946 unsigned int total_tx_ring_size;
@@ -925,7 +950,7 @@ struct gfar_private {
925 struct net_device *ndev; 950 struct net_device *ndev;
926 struct of_device *ofdev; 951 struct of_device *ofdev;
927 952
928 struct gfar_priv_grp gfargrp; 953 struct gfar_priv_grp gfargrp[MAXGROUPS];
929 struct gfar_priv_tx_q *tx_queue[MAX_TX_QS]; 954 struct gfar_priv_tx_q *tx_queue[MAX_TX_QS];
930 struct gfar_priv_rx_q *rx_queue[MAX_RX_QS]; 955 struct gfar_priv_rx_q *rx_queue[MAX_RX_QS];
931 956
@@ -999,6 +1024,8 @@ extern void stop_gfar(struct net_device *dev);
999extern void gfar_halt(struct net_device *dev); 1024extern void gfar_halt(struct net_device *dev);
1000extern void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev, 1025extern void gfar_phy_test(struct mii_bus *bus, struct phy_device *phydev,
1001 int enable, u32 regnum, u32 read); 1026 int enable, u32 regnum, u32 read);
1027extern void gfar_configure_coalescing(struct gfar_private *priv,
1028 unsigned int tx_mask, unsigned int rx_mask);
1002void gfar_init_sysfs(struct net_device *dev); 1029void gfar_init_sysfs(struct net_device *dev);
1003 1030
1004extern const struct ethtool_ops gfar_ethtool_ops; 1031extern const struct ethtool_ops gfar_ethtool_ops;