diff options
Diffstat (limited to 'drivers/net/sky2.h')
-rw-r--r-- | drivers/net/sky2.h | 55 |
1 files changed, 47 insertions, 8 deletions
diff --git a/drivers/net/sky2.h b/drivers/net/sky2.h index 61891a6cacc2..318c9ae7bf91 100644 --- a/drivers/net/sky2.h +++ b/drivers/net/sky2.h | |||
@@ -1194,7 +1194,7 @@ enum { | |||
1194 | 1194 | ||
1195 | PHY_ST_PRE_SUP = 1<<6, /* Bit 6: Preamble Suppression */ | 1195 | PHY_ST_PRE_SUP = 1<<6, /* Bit 6: Preamble Suppression */ |
1196 | PHY_ST_AN_OVER = 1<<5, /* Bit 5: Auto-Negotiation Over */ | 1196 | PHY_ST_AN_OVER = 1<<5, /* Bit 5: Auto-Negotiation Over */ |
1197 | PHY_ST_REM_FLT = 1<<4, /* Bit 4: Remote Fault Condition Occured */ | 1197 | PHY_ST_REM_FLT = 1<<4, /* Bit 4: Remote Fault Condition Occurred */ |
1198 | PHY_ST_AN_CAP = 1<<3, /* Bit 3: Auto-Negotiation Capability */ | 1198 | PHY_ST_AN_CAP = 1<<3, /* Bit 3: Auto-Negotiation Capability */ |
1199 | PHY_ST_LSYNC = 1<<2, /* Bit 2: Link Synchronized */ | 1199 | PHY_ST_LSYNC = 1<<2, /* Bit 2: Link Synchronized */ |
1200 | PHY_ST_JAB_DET = 1<<1, /* Bit 1: Jabber Detected */ | 1200 | PHY_ST_JAB_DET = 1<<1, /* Bit 1: Jabber Detected */ |
@@ -1725,8 +1725,8 @@ enum { | |||
1725 | GM_GPSR_LINK_UP = 1<<12, /* Bit 12: Link Up Status */ | 1725 | GM_GPSR_LINK_UP = 1<<12, /* Bit 12: Link Up Status */ |
1726 | GM_GPSR_PAUSE = 1<<11, /* Bit 11: Pause State */ | 1726 | GM_GPSR_PAUSE = 1<<11, /* Bit 11: Pause State */ |
1727 | GM_GPSR_TX_ACTIVE = 1<<10, /* Bit 10: Tx in Progress */ | 1727 | GM_GPSR_TX_ACTIVE = 1<<10, /* Bit 10: Tx in Progress */ |
1728 | GM_GPSR_EXC_COL = 1<<9, /* Bit 9: Excessive Collisions Occured */ | 1728 | GM_GPSR_EXC_COL = 1<<9, /* Bit 9: Excessive Collisions Occurred */ |
1729 | GM_GPSR_LAT_COL = 1<<8, /* Bit 8: Late Collisions Occured */ | 1729 | GM_GPSR_LAT_COL = 1<<8, /* Bit 8: Late Collisions Occurred */ |
1730 | 1730 | ||
1731 | GM_GPSR_PHY_ST_CH = 1<<5, /* Bit 5: PHY Status Change */ | 1731 | GM_GPSR_PHY_ST_CH = 1<<5, /* Bit 5: PHY Status Change */ |
1732 | GM_GPSR_GIG_SPEED = 1<<4, /* Bit 4: Gigabit Speed (1 = 1000 Mbps) */ | 1732 | GM_GPSR_GIG_SPEED = 1<<4, /* Bit 4: Gigabit Speed (1 = 1000 Mbps) */ |
@@ -2200,6 +2200,12 @@ enum flow_control { | |||
2200 | FC_BOTH = 3, | 2200 | FC_BOTH = 3, |
2201 | }; | 2201 | }; |
2202 | 2202 | ||
2203 | struct sky2_stats { | ||
2204 | struct u64_stats_sync syncp; | ||
2205 | u64 packets; | ||
2206 | u64 bytes; | ||
2207 | }; | ||
2208 | |||
2203 | struct sky2_port { | 2209 | struct sky2_port { |
2204 | struct sky2_hw *hw; | 2210 | struct sky2_hw *hw; |
2205 | struct net_device *netdev; | 2211 | struct net_device *netdev; |
@@ -2209,6 +2215,8 @@ struct sky2_port { | |||
2209 | 2215 | ||
2210 | struct tx_ring_info *tx_ring; | 2216 | struct tx_ring_info *tx_ring; |
2211 | struct sky2_tx_le *tx_le; | 2217 | struct sky2_tx_le *tx_le; |
2218 | struct sky2_stats tx_stats; | ||
2219 | |||
2212 | u16 tx_ring_size; | 2220 | u16 tx_ring_size; |
2213 | u16 tx_cons; /* next le to check */ | 2221 | u16 tx_cons; /* next le to check */ |
2214 | u16 tx_prod; /* next le to use */ | 2222 | u16 tx_prod; /* next le to use */ |
@@ -2221,17 +2229,15 @@ struct sky2_port { | |||
2221 | 2229 | ||
2222 | struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp; | 2230 | struct rx_ring_info *rx_ring ____cacheline_aligned_in_smp; |
2223 | struct sky2_rx_le *rx_le; | 2231 | struct sky2_rx_le *rx_le; |
2232 | struct sky2_stats rx_stats; | ||
2224 | 2233 | ||
2225 | u16 rx_next; /* next re to check */ | 2234 | u16 rx_next; /* next re to check */ |
2226 | u16 rx_put; /* next le index to use */ | 2235 | u16 rx_put; /* next le index to use */ |
2227 | u16 rx_pending; | 2236 | u16 rx_pending; |
2228 | u16 rx_data_size; | 2237 | u16 rx_data_size; |
2229 | u16 rx_nfrags; | 2238 | u16 rx_nfrags; |
2230 | |||
2231 | #ifdef SKY2_VLAN_TAG_USED | ||
2232 | u16 rx_tag; | 2239 | u16 rx_tag; |
2233 | struct vlan_group *vlgrp; | 2240 | |
2234 | #endif | ||
2235 | struct { | 2241 | struct { |
2236 | unsigned long last; | 2242 | unsigned long last; |
2237 | u32 mac_rp; | 2243 | u32 mac_rp; |
@@ -2248,7 +2254,6 @@ struct sky2_port { | |||
2248 | u8 wol; /* WAKE_ bits */ | 2254 | u8 wol; /* WAKE_ bits */ |
2249 | u8 duplex; /* DUPLEX_HALF, DUPLEX_FULL */ | 2255 | u8 duplex; /* DUPLEX_HALF, DUPLEX_FULL */ |
2250 | u16 flags; | 2256 | u16 flags; |
2251 | #define SKY2_FLAG_RX_CHECKSUM 0x0001 | ||
2252 | #define SKY2_FLAG_AUTO_SPEED 0x0002 | 2257 | #define SKY2_FLAG_AUTO_SPEED 0x0002 |
2253 | #define SKY2_FLAG_AUTO_PAUSE 0x0004 | 2258 | #define SKY2_FLAG_AUTO_PAUSE 0x0004 |
2254 | 2259 | ||
@@ -2275,6 +2280,7 @@ struct sky2_hw { | |||
2275 | #define SKY2_HW_AUTO_TX_SUM 0x00000040 /* new IP decode for Tx */ | 2280 | #define SKY2_HW_AUTO_TX_SUM 0x00000040 /* new IP decode for Tx */ |
2276 | #define SKY2_HW_ADV_POWER_CTL 0x00000080 /* additional PHY power regs */ | 2281 | #define SKY2_HW_ADV_POWER_CTL 0x00000080 /* additional PHY power regs */ |
2277 | #define SKY2_HW_RSS_BROKEN 0x00000100 | 2282 | #define SKY2_HW_RSS_BROKEN 0x00000100 |
2283 | #define SKY2_HW_VLAN_BROKEN 0x00000200 | ||
2278 | 2284 | ||
2279 | u8 chip_id; | 2285 | u8 chip_id; |
2280 | u8 chip_rev; | 2286 | u8 chip_rev; |
@@ -2346,6 +2352,39 @@ static inline u32 gma_read32(struct sky2_hw *hw, unsigned port, unsigned reg) | |||
2346 | | (u32) sky2_read16(hw, base+4) << 16; | 2352 | | (u32) sky2_read16(hw, base+4) << 16; |
2347 | } | 2353 | } |
2348 | 2354 | ||
2355 | static inline u64 gma_read64(struct sky2_hw *hw, unsigned port, unsigned reg) | ||
2356 | { | ||
2357 | unsigned base = SK_GMAC_REG(port, reg); | ||
2358 | |||
2359 | return (u64) sky2_read16(hw, base) | ||
2360 | | (u64) sky2_read16(hw, base+4) << 16 | ||
2361 | | (u64) sky2_read16(hw, base+8) << 32 | ||
2362 | | (u64) sky2_read16(hw, base+12) << 48; | ||
2363 | } | ||
2364 | |||
2365 | /* There is no way to atomically read32 bit values from PHY, so retry */ | ||
2366 | static inline u32 get_stats32(struct sky2_hw *hw, unsigned port, unsigned reg) | ||
2367 | { | ||
2368 | u32 val; | ||
2369 | |||
2370 | do { | ||
2371 | val = gma_read32(hw, port, reg); | ||
2372 | } while (gma_read32(hw, port, reg) != val); | ||
2373 | |||
2374 | return val; | ||
2375 | } | ||
2376 | |||
2377 | static inline u64 get_stats64(struct sky2_hw *hw, unsigned port, unsigned reg) | ||
2378 | { | ||
2379 | u64 val; | ||
2380 | |||
2381 | do { | ||
2382 | val = gma_read64(hw, port, reg); | ||
2383 | } while (gma_read64(hw, port, reg) != val); | ||
2384 | |||
2385 | return val; | ||
2386 | } | ||
2387 | |||
2349 | static inline void gma_write16(const struct sky2_hw *hw, unsigned port, int r, u16 v) | 2388 | static inline void gma_write16(const struct sky2_hw *hw, unsigned port, int r, u16 v) |
2350 | { | 2389 | { |
2351 | sky2_write16(hw, SK_GMAC_REG(port,r), v); | 2390 | sky2_write16(hw, SK_GMAC_REG(port,r), v); |