diff options
-rw-r--r-- | drivers/net/gianfar.h | 1 | ||||
-rw-r--r-- | drivers/net/gianfar_ethtool.c | 52 |
2 files changed, 29 insertions, 24 deletions
diff --git a/drivers/net/gianfar.h b/drivers/net/gianfar.h index 76f14d044470..27499c606a4a 100644 --- a/drivers/net/gianfar.h +++ b/drivers/net/gianfar.h | |||
@@ -409,6 +409,7 @@ extern const char gfar_driver_version[]; | |||
409 | #define RQFCR_HASHTBL_2 0x00060000 | 409 | #define RQFCR_HASHTBL_2 0x00060000 |
410 | #define RQFCR_HASHTBL_3 0x00080000 | 410 | #define RQFCR_HASHTBL_3 0x00080000 |
411 | #define RQFCR_HASH 0x00010000 | 411 | #define RQFCR_HASH 0x00010000 |
412 | #define RQFCR_QUEUE 0x0000FC00 | ||
412 | #define RQFCR_CLE 0x00000200 | 413 | #define RQFCR_CLE 0x00000200 |
413 | #define RQFCR_RJE 0x00000100 | 414 | #define RQFCR_RJE 0x00000100 |
414 | #define RQFCR_AND 0x00000080 | 415 | #define RQFCR_AND 0x00000080 |
diff --git a/drivers/net/gianfar_ethtool.c b/drivers/net/gianfar_ethtool.c index 2ecdc9a785fa..203369cc1272 100644 --- a/drivers/net/gianfar_ethtool.c +++ b/drivers/net/gianfar_ethtool.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <linux/mii.h> | 40 | #include <linux/mii.h> |
41 | #include <linux/phy.h> | 41 | #include <linux/phy.h> |
42 | #include <linux/sort.h> | 42 | #include <linux/sort.h> |
43 | #include <linux/if_vlan.h> | ||
43 | 44 | ||
44 | #include "gianfar.h" | 45 | #include "gianfar.h" |
45 | 46 | ||
@@ -883,7 +884,7 @@ static void gfar_set_attribute(u32 value, u32 mask, u32 flag, | |||
883 | struct filer_table *tab) | 884 | struct filer_table *tab) |
884 | { | 885 | { |
885 | switch (flag) { | 886 | switch (flag) { |
886 | /* 3bit */ | 887 | /* 3bit */ |
887 | case RQFCR_PID_PRI: | 888 | case RQFCR_PID_PRI: |
888 | if (!(value | mask)) | 889 | if (!(value | mask)) |
889 | return; | 890 | return; |
@@ -1051,17 +1052,17 @@ static int gfar_convert_to_filer(struct ethtool_rx_flow_spec *rule, | |||
1051 | vlan_mask = RQFPR_VLN; | 1052 | vlan_mask = RQFPR_VLN; |
1052 | 1053 | ||
1053 | /* Separate the fields */ | 1054 | /* Separate the fields */ |
1054 | id = rule->h_ext.vlan_tci & 0xFFF; | 1055 | id = rule->h_ext.vlan_tci & VLAN_VID_MASK; |
1055 | id_mask = rule->m_ext.vlan_tci & 0xFFF; | 1056 | id_mask = rule->m_ext.vlan_tci & VLAN_VID_MASK; |
1056 | cfi = (rule->h_ext.vlan_tci >> 12) & 1; | 1057 | cfi = rule->h_ext.vlan_tci & VLAN_CFI_MASK; |
1057 | cfi_mask = (rule->m_ext.vlan_tci >> 12) & 1; | 1058 | cfi_mask = rule->m_ext.vlan_tci & VLAN_CFI_MASK; |
1058 | prio = (rule->h_ext.vlan_tci >> 13) & 0x7; | 1059 | prio = (rule->h_ext.vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; |
1059 | prio_mask = (rule->m_ext.vlan_tci >> 13) & 0x7; | 1060 | prio_mask = (rule->m_ext.vlan_tci & VLAN_PRIO_MASK) >> VLAN_PRIO_SHIFT; |
1060 | 1061 | ||
1061 | if (cfi == 1 && cfi_mask == 1) { | 1062 | if (cfi == VLAN_TAG_PRESENT && cfi_mask == VLAN_TAG_PRESENT) { |
1062 | vlan |= RQFPR_CFI; | 1063 | vlan |= RQFPR_CFI; |
1063 | vlan_mask |= RQFPR_CFI; | 1064 | vlan_mask |= RQFPR_CFI; |
1064 | } else if (cfi == 0 && cfi_mask == 1) { | 1065 | } else if (cfi != VLAN_TAG_PRESENT && cfi_mask == VLAN_TAG_PRESENT) { |
1065 | vlan_mask |= RQFPR_CFI; | 1066 | vlan_mask |= RQFPR_CFI; |
1066 | } | 1067 | } |
1067 | } | 1068 | } |
@@ -1262,21 +1263,21 @@ static void gfar_cluster_filer(struct filer_table *tab) | |||
1262 | } | 1263 | } |
1263 | } | 1264 | } |
1264 | 1265 | ||
1265 | /* Swaps the 0xFF80 masked bits of a1<>a2 and b1<>b2 */ | 1266 | /* Swaps the masked bits of a1<>a2 and b1<>b2 */ |
1266 | static void gfar_swap_ff80_bits(struct gfar_filer_entry *a1, | 1267 | static void gfar_swap_bits(struct gfar_filer_entry *a1, |
1267 | struct gfar_filer_entry *a2, struct gfar_filer_entry *b1, | 1268 | struct gfar_filer_entry *a2, struct gfar_filer_entry *b1, |
1268 | struct gfar_filer_entry *b2) | 1269 | struct gfar_filer_entry *b2, u32 mask) |
1269 | { | 1270 | { |
1270 | u32 temp[4]; | 1271 | u32 temp[4]; |
1271 | temp[0] = a1->ctrl & 0xFF80; | 1272 | temp[0] = a1->ctrl & mask; |
1272 | temp[1] = a2->ctrl & 0xFF80; | 1273 | temp[1] = a2->ctrl & mask; |
1273 | temp[2] = b1->ctrl & 0xFF80; | 1274 | temp[2] = b1->ctrl & mask; |
1274 | temp[3] = b2->ctrl & 0xFF80; | 1275 | temp[3] = b2->ctrl & mask; |
1275 | 1276 | ||
1276 | a1->ctrl &= ~0xFF80; | 1277 | a1->ctrl &= ~mask; |
1277 | a2->ctrl &= ~0xFF80; | 1278 | a2->ctrl &= ~mask; |
1278 | b1->ctrl &= ~0xFF80; | 1279 | b1->ctrl &= ~mask; |
1279 | b2->ctrl &= ~0xFF80; | 1280 | b2->ctrl &= ~mask; |
1280 | 1281 | ||
1281 | a1->ctrl |= temp[1]; | 1282 | a1->ctrl |= temp[1]; |
1282 | a2->ctrl |= temp[0]; | 1283 | a2->ctrl |= temp[0]; |
@@ -1305,7 +1306,7 @@ static u32 gfar_generate_mask_table(struct gfar_mask_entry *mask_table, | |||
1305 | mask_table[and_index - 1].end = i - 1; | 1306 | mask_table[and_index - 1].end = i - 1; |
1306 | and_index++; | 1307 | and_index++; |
1307 | } | 1308 | } |
1308 | /* cluster starts will be separated because they should | 1309 | /* cluster starts and ends will be separated because they should |
1309 | * hold their position */ | 1310 | * hold their position */ |
1310 | if (tab->fe[i].ctrl & RQFCR_CLE) | 1311 | if (tab->fe[i].ctrl & RQFCR_CLE) |
1311 | block_index++; | 1312 | block_index++; |
@@ -1356,10 +1357,13 @@ static void gfar_sort_mask_table(struct gfar_mask_entry *mask_table, | |||
1356 | new_first = mask_table[start].start + 1; | 1357 | new_first = mask_table[start].start + 1; |
1357 | new_last = mask_table[i - 1].end; | 1358 | new_last = mask_table[i - 1].end; |
1358 | 1359 | ||
1359 | gfar_swap_ff80_bits(&temp_table->fe[new_first], | 1360 | gfar_swap_bits(&temp_table->fe[new_first], |
1360 | &temp_table->fe[old_first], | 1361 | &temp_table->fe[old_first], |
1361 | &temp_table->fe[new_last], | 1362 | &temp_table->fe[new_last], |
1362 | &temp_table->fe[old_last]); | 1363 | &temp_table->fe[old_last], |
1364 | RQFCR_QUEUE | RQFCR_CLE | | ||
1365 | RQFCR_RJE | RQFCR_AND | ||
1366 | ); | ||
1363 | 1367 | ||
1364 | start = i; | 1368 | start = i; |
1365 | size = 0; | 1369 | size = 0; |