diff options
author | Sebastian Poehn <sebastian.poehn@belden.com> | 2011-06-20 16:57:59 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-06-20 16:57:59 -0400 |
commit | 4aa3a715551c93eda32d79bd52042ce500bd5383 (patch) | |
tree | 68a67ba35f2a4c27cef326ce87a9d97593416fae /drivers/net/gianfar.h | |
parent | d13d6bffb418a660c06a5a12afcf7e7081489548 (diff) |
gianfar v5: implement nfc
This patch adds all missing functionalities for nfc except GRXFH. There is so much code because hardware has not a TCAM.
Further hardware rule space is very limited. So I had to extensively use
optimization features. Both reasons lead to the necessity to hold all
online flows in a linked-list.
Change-log:
# Some suggestions by Joe Perches applied (thanks!)
# Shorted some logs
# Use memcmp() for comparing
Signed-off-by: Sebastian Poehn <sebastian.poehn@belden.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/gianfar.h')
-rw-r--r-- | drivers/net/gianfar.h | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index fc86f5195445..a4e690a9aeb9 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -47,6 +47,16 @@ | |||
47 | #include <linux/workqueue.h> | 47 | #include <linux/workqueue.h> |
48 | #include <linux/ethtool.h> | 48 | #include <linux/ethtool.h> |
49 | 49 | ||
50 | struct ethtool_flow_spec_container { | ||
51 | struct ethtool_rx_flow_spec fs; | ||
52 | struct list_head list; | ||
53 | }; | ||
54 | |||
55 | struct ethtool_rx_list { | ||
56 | struct list_head list; | ||
57 | unsigned int count; | ||
58 | }; | ||
59 | |||
50 | /* The maximum number of packets to be handled in one call of gfar_poll */ | 60 | /* The maximum number of packets to be handled in one call of gfar_poll */ |
51 | #define GFAR_DEV_WEIGHT 64 | 61 | #define GFAR_DEV_WEIGHT 64 |
52 | 62 | ||
@@ -168,6 +178,7 @@ extern const char gfar_driver_version[]; | |||
168 | #define MACCFG2_LENGTHCHECK 0x00000010 | 178 | #define MACCFG2_LENGTHCHECK 0x00000010 |
169 | #define MACCFG2_MPEN 0x00000008 | 179 | #define MACCFG2_MPEN 0x00000008 |
170 | 180 | ||
181 | #define ECNTRL_FIFM 0x00008000 | ||
171 | #define ECNTRL_INIT_SETTINGS 0x00001000 | 182 | #define ECNTRL_INIT_SETTINGS 0x00001000 |
172 | #define ECNTRL_TBI_MODE 0x00000020 | 183 | #define ECNTRL_TBI_MODE 0x00000020 |
173 | #define ECNTRL_REDUCED_MODE 0x00000010 | 184 | #define ECNTRL_REDUCED_MODE 0x00000010 |
@@ -271,6 +282,7 @@ extern const char gfar_driver_version[]; | |||
271 | #define RCTRL_TUCSEN 0x00000100 | 282 | #define RCTRL_TUCSEN 0x00000100 |
272 | #define RCTRL_PRSDEP_MASK 0x000000c0 | 283 | #define RCTRL_PRSDEP_MASK 0x000000c0 |
273 | #define RCTRL_PRSDEP_INIT 0x000000c0 | 284 | #define RCTRL_PRSDEP_INIT 0x000000c0 |
285 | #define RCTRL_PRSFM 0x00000020 | ||
274 | #define RCTRL_PROM 0x00000008 | 286 | #define RCTRL_PROM 0x00000008 |
275 | #define RCTRL_EMEN 0x00000002 | 287 | #define RCTRL_EMEN 0x00000002 |
276 | #define RCTRL_REQ_PARSER (RCTRL_VLEX | RCTRL_IPCSEN | \ | 288 | #define RCTRL_REQ_PARSER (RCTRL_VLEX | RCTRL_IPCSEN | \ |
@@ -1066,6 +1078,9 @@ struct gfar_private { | |||
1066 | 1078 | ||
1067 | struct vlan_group *vlgrp; | 1079 | struct vlan_group *vlgrp; |
1068 | 1080 | ||
1081 | /* RX queue filer rule set*/ | ||
1082 | struct ethtool_rx_list rx_list; | ||
1083 | struct mutex rx_queue_access; | ||
1069 | 1084 | ||
1070 | /* Hash registers and their width */ | 1085 | /* Hash registers and their width */ |
1071 | u32 __iomem *hash_regs[16]; | 1086 | u32 __iomem *hash_regs[16]; |
@@ -1140,6 +1155,16 @@ static inline void gfar_write_filer(struct gfar_private *priv, | |||
1140 | gfar_write(®s->rqfpr, fpr); | 1155 | gfar_write(®s->rqfpr, fpr); |
1141 | } | 1156 | } |
1142 | 1157 | ||
1158 | static inline void gfar_read_filer(struct gfar_private *priv, | ||
1159 | unsigned int far, unsigned int *fcr, unsigned int *fpr) | ||
1160 | { | ||
1161 | struct gfar __iomem *regs = priv->gfargrp[0].regs; | ||
1162 | |||
1163 | gfar_write(®s->rqfar, far); | ||
1164 | *fcr = gfar_read(®s->rqfcr); | ||
1165 | *fpr = gfar_read(®s->rqfpr); | ||
1166 | } | ||
1167 | |||
1143 | extern void lock_rx_qs(struct gfar_private *priv); | 1168 | extern void lock_rx_qs(struct gfar_private *priv); |
1144 | extern void lock_tx_qs(struct gfar_private *priv); | 1169 | extern void lock_tx_qs(struct gfar_private *priv); |
1145 | extern void unlock_rx_qs(struct gfar_private *priv); | 1170 | extern void unlock_rx_qs(struct gfar_private *priv); |
@@ -1157,4 +1182,32 @@ int gfar_set_features(struct net_device *dev, u32 features); | |||
1157 | 1182 | ||
1158 | extern const struct ethtool_ops gfar_ethtool_ops; | 1183 | extern const struct ethtool_ops gfar_ethtool_ops; |
1159 | 1184 | ||
1185 | #define MAX_FILER_CACHE_IDX (2*(MAX_FILER_IDX)) | ||
1186 | |||
1187 | #define RQFCR_PID_PRI_MASK 0xFFFFFFF8 | ||
1188 | #define RQFCR_PID_L4P_MASK 0xFFFFFF00 | ||
1189 | #define RQFCR_PID_VID_MASK 0xFFFFF000 | ||
1190 | #define RQFCR_PID_PORT_MASK 0xFFFF0000 | ||
1191 | #define RQFCR_PID_MAC_MASK 0xFF000000 | ||
1192 | |||
1193 | struct gfar_mask_entry { | ||
1194 | unsigned int mask; /* The mask value which is valid form start to end */ | ||
1195 | unsigned int start; | ||
1196 | unsigned int end; | ||
1197 | unsigned int block; /* Same block values indicate depended entries */ | ||
1198 | }; | ||
1199 | |||
1200 | /* Represents a receive filer table entry */ | ||
1201 | struct gfar_filer_entry { | ||
1202 | u32 ctrl; | ||
1203 | u32 prop; | ||
1204 | }; | ||
1205 | |||
1206 | |||
1207 | /* The 20 additional entries are a shadow for one extra element */ | ||
1208 | struct filer_table { | ||
1209 | u32 index; | ||
1210 | struct gfar_filer_entry fe[MAX_FILER_CACHE_IDX + 20]; | ||
1211 | }; | ||
1212 | |||
1160 | #endif /* __GIANFAR_H */ | 1213 | #endif /* __GIANFAR_H */ |