diff options
Diffstat (limited to 'drivers/net/mv643xx_eth.c')
-rw-r--r-- | drivers/net/mv643xx_eth.c | 94 |
1 files changed, 46 insertions, 48 deletions
diff --git a/drivers/net/mv643xx_eth.c b/drivers/net/mv643xx_eth.c index f1e708a5c2de..7ef4b0434a3f 100644 --- a/drivers/net/mv643xx_eth.c +++ b/drivers/net/mv643xx_eth.c | |||
@@ -462,7 +462,7 @@ static int mv643xx_eth_receive_queue(struct net_device *dev) | |||
462 | */ | 462 | */ |
463 | 463 | ||
464 | static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id, | 464 | static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id, |
465 | struct pt_regs *regs) | 465 | struct pt_regs *regs) |
466 | { | 466 | { |
467 | struct net_device *dev = (struct net_device *)dev_id; | 467 | struct net_device *dev = (struct net_device *)dev_id; |
468 | struct mv643xx_private *mp = netdev_priv(dev); | 468 | struct mv643xx_private *mp = netdev_priv(dev); |
@@ -1048,16 +1048,15 @@ static int mv643xx_poll(struct net_device *dev, int *budget) | |||
1048 | 1048 | ||
1049 | static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb) | 1049 | static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb) |
1050 | { | 1050 | { |
1051 | unsigned int frag; | 1051 | unsigned int frag; |
1052 | skb_frag_t *fragp; | 1052 | skb_frag_t *fragp; |
1053 | 1053 | ||
1054 | for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { | 1054 | for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { |
1055 | fragp = &skb_shinfo(skb)->frags[frag]; | 1055 | fragp = &skb_shinfo(skb)->frags[frag]; |
1056 | if (fragp->size <= 8 && fragp->page_offset & 0x7) | 1056 | if (fragp->size <= 8 && fragp->page_offset & 0x7) |
1057 | return 1; | 1057 | return 1; |
1058 | 1058 | } | |
1059 | } | 1059 | return 0; |
1060 | return 0; | ||
1061 | } | 1060 | } |
1062 | 1061 | ||
1063 | 1062 | ||
@@ -2138,26 +2137,26 @@ static void eth_port_set_multicast_list(struct net_device *dev) | |||
2138 | */ | 2137 | */ |
2139 | if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI)) { | 2138 | if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI)) { |
2140 | for (table_index = 0; table_index <= 0xFC; table_index += 4) { | 2139 | for (table_index = 0; table_index <= 0xFC; table_index += 4) { |
2141 | /* Set all entries in DA filter special multicast | 2140 | /* Set all entries in DA filter special multicast |
2142 | * table (Ex_dFSMT) | 2141 | * table (Ex_dFSMT) |
2143 | * Set for ETH_Q0 for now | 2142 | * Set for ETH_Q0 for now |
2144 | * Bits | 2143 | * Bits |
2145 | * 0 Accept=1, Drop=0 | 2144 | * 0 Accept=1, Drop=0 |
2146 | * 3-1 Queue ETH_Q0=0 | 2145 | * 3-1 Queue ETH_Q0=0 |
2147 | * 7-4 Reserved = 0; | 2146 | * 7-4 Reserved = 0; |
2148 | */ | 2147 | */ |
2149 | mv_write(MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); | 2148 | mv_write(MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); |
2150 | 2149 | ||
2151 | /* Set all entries in DA filter other multicast | 2150 | /* Set all entries in DA filter other multicast |
2152 | * table (Ex_dFOMT) | 2151 | * table (Ex_dFOMT) |
2153 | * Set for ETH_Q0 for now | 2152 | * Set for ETH_Q0 for now |
2154 | * Bits | 2153 | * Bits |
2155 | * 0 Accept=1, Drop=0 | 2154 | * 0 Accept=1, Drop=0 |
2156 | * 3-1 Queue ETH_Q0=0 | 2155 | * 3-1 Queue ETH_Q0=0 |
2157 | * 7-4 Reserved = 0; | 2156 | * 7-4 Reserved = 0; |
2158 | */ | 2157 | */ |
2159 | mv_write(MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); | 2158 | mv_write(MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); |
2160 | } | 2159 | } |
2161 | return; | 2160 | return; |
2162 | } | 2161 | } |
2163 | 2162 | ||
@@ -2886,8 +2885,10 @@ static ETH_FUNC_RET_STATUS eth_port_receive(struct mv643xx_private *mp, | |||
2886 | p_pkt_info->return_info = mp->rx_skb[rx_curr_desc]; | 2885 | p_pkt_info->return_info = mp->rx_skb[rx_curr_desc]; |
2887 | p_pkt_info->l4i_chk = p_rx_desc->buf_size; | 2886 | p_pkt_info->l4i_chk = p_rx_desc->buf_size; |
2888 | 2887 | ||
2889 | /* Clean the return info field to indicate that the packet has been */ | 2888 | /* |
2890 | /* moved to the upper layers */ | 2889 | * Clean the return info field to indicate that the |
2890 | * packet has been moved to the upper layers | ||
2891 | */ | ||
2891 | mp->rx_skb[rx_curr_desc] = NULL; | 2892 | mp->rx_skb[rx_curr_desc] = NULL; |
2892 | 2893 | ||
2893 | /* Update current index in data structure */ | 2894 | /* Update current index in data structure */ |
@@ -2968,7 +2969,7 @@ struct mv643xx_stats { | |||
2968 | }; | 2969 | }; |
2969 | 2970 | ||
2970 | #define MV643XX_STAT(m) sizeof(((struct mv643xx_private *)0)->m), \ | 2971 | #define MV643XX_STAT(m) sizeof(((struct mv643xx_private *)0)->m), \ |
2971 | offsetof(struct mv643xx_private, m) | 2972 | offsetof(struct mv643xx_private, m) |
2972 | 2973 | ||
2973 | static const struct mv643xx_stats mv643xx_gstrings_stats[] = { | 2974 | static const struct mv643xx_stats mv643xx_gstrings_stats[] = { |
2974 | { "rx_packets", MV643XX_STAT(stats.rx_packets) }, | 2975 | { "rx_packets", MV643XX_STAT(stats.rx_packets) }, |
@@ -3119,9 +3120,8 @@ mv643xx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) | |||
3119 | return 0; | 3120 | return 0; |
3120 | } | 3121 | } |
3121 | 3122 | ||
3122 | static void | 3123 | static void mv643xx_get_drvinfo(struct net_device *netdev, |
3123 | mv643xx_get_drvinfo(struct net_device *netdev, | 3124 | struct ethtool_drvinfo *drvinfo) |
3124 | struct ethtool_drvinfo *drvinfo) | ||
3125 | { | 3125 | { |
3126 | strncpy(drvinfo->driver, mv643xx_driver_name, 32); | 3126 | strncpy(drvinfo->driver, mv643xx_driver_name, 32); |
3127 | strncpy(drvinfo->version, mv643xx_driver_version, 32); | 3127 | strncpy(drvinfo->version, mv643xx_driver_version, 32); |
@@ -3130,39 +3130,37 @@ mv643xx_get_drvinfo(struct net_device *netdev, | |||
3130 | drvinfo->n_stats = MV643XX_STATS_LEN; | 3130 | drvinfo->n_stats = MV643XX_STATS_LEN; |
3131 | } | 3131 | } |
3132 | 3132 | ||
3133 | static int | 3133 | static int mv643xx_get_stats_count(struct net_device *netdev) |
3134 | mv643xx_get_stats_count(struct net_device *netdev) | ||
3135 | { | 3134 | { |
3136 | return MV643XX_STATS_LEN; | 3135 | return MV643XX_STATS_LEN; |
3137 | } | 3136 | } |
3138 | 3137 | ||
3139 | static void | 3138 | static void mv643xx_get_ethtool_stats(struct net_device *netdev, |
3140 | mv643xx_get_ethtool_stats(struct net_device *netdev, | 3139 | struct ethtool_stats *stats, uint64_t *data) |
3141 | struct ethtool_stats *stats, uint64_t *data) | ||
3142 | { | 3140 | { |
3143 | struct mv643xx_private *mp = netdev->priv; | 3141 | struct mv643xx_private *mp = netdev->priv; |
3144 | int i; | 3142 | int i; |
3145 | 3143 | ||
3146 | eth_update_mib_counters(mp); | 3144 | eth_update_mib_counters(mp); |
3147 | 3145 | ||
3148 | for(i = 0; i < MV643XX_STATS_LEN; i++) { | 3146 | for (i = 0; i < MV643XX_STATS_LEN; i++) { |
3149 | char *p = (char *)mp+mv643xx_gstrings_stats[i].stat_offset; | 3147 | char *p = (char *)mp+mv643xx_gstrings_stats[i].stat_offset; |
3150 | data[i] = (mv643xx_gstrings_stats[i].sizeof_stat == | 3148 | data[i] = (mv643xx_gstrings_stats[i].sizeof_stat == |
3151 | sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; | 3149 | sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; |
3152 | } | 3150 | } |
3153 | } | 3151 | } |
3154 | 3152 | ||
3155 | static void | 3153 | static void mv643xx_get_strings(struct net_device *netdev, uint32_t stringset, |
3156 | mv643xx_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) | 3154 | uint8_t *data) |
3157 | { | 3155 | { |
3158 | int i; | 3156 | int i; |
3159 | 3157 | ||
3160 | switch(stringset) { | 3158 | switch(stringset) { |
3161 | case ETH_SS_STATS: | 3159 | case ETH_SS_STATS: |
3162 | for (i=0; i < MV643XX_STATS_LEN; i++) { | 3160 | for (i=0; i < MV643XX_STATS_LEN; i++) { |
3163 | memcpy(data + i * ETH_GSTRING_LEN, | 3161 | memcpy(data + i * ETH_GSTRING_LEN, |
3164 | mv643xx_gstrings_stats[i].stat_string, | 3162 | mv643xx_gstrings_stats[i].stat_string, |
3165 | ETH_GSTRING_LEN); | 3163 | ETH_GSTRING_LEN); |
3166 | } | 3164 | } |
3167 | break; | 3165 | break; |
3168 | } | 3166 | } |