提交 cfc88b07 编写于 作者: J Jeff Garzik

Merge branch 'upstream-fixes'

...@@ -313,7 +313,7 @@ static struct platform_device mpsc1_device = { ...@@ -313,7 +313,7 @@ static struct platform_device mpsc1_device = {
}; };
#endif #endif
#ifdef CONFIG_MV643XX_ETH #if defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE)
static struct resource mv64x60_eth_shared_resources[] = { static struct resource mv64x60_eth_shared_resources[] = {
[0] = { [0] = {
.name = "ethernet shared base", .name = "ethernet shared base",
...@@ -456,7 +456,7 @@ static struct platform_device *mv64x60_pd_devs[] __initdata = { ...@@ -456,7 +456,7 @@ static struct platform_device *mv64x60_pd_devs[] __initdata = {
&mpsc0_device, &mpsc0_device,
&mpsc1_device, &mpsc1_device,
#endif #endif
#ifdef CONFIG_MV643XX_ETH #if defined(CONFIG_MV643XX_ETH) || defined(CONFIG_MV643XX_ETH_MODULE)
&mv64x60_eth_shared_device, &mv64x60_eth_shared_device,
#endif #endif
#ifdef CONFIG_MV643XX_ETH_0 #ifdef CONFIG_MV643XX_ETH_0
......
...@@ -444,6 +444,7 @@ static int mv643xx_eth_receive_queue(struct net_device *dev) ...@@ -444,6 +444,7 @@ static int mv643xx_eth_receive_queue(struct net_device *dev)
netif_rx(skb); netif_rx(skb);
#endif #endif
} }
dev->last_rx = jiffies;
} }
return received_packets; return received_packets;
...@@ -461,7 +462,7 @@ static int mv643xx_eth_receive_queue(struct net_device *dev) ...@@ -461,7 +462,7 @@ static int mv643xx_eth_receive_queue(struct net_device *dev)
*/ */
static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id, static irqreturn_t mv643xx_eth_int_handler(int irq, void *dev_id,
struct pt_regs *regs) struct pt_regs *regs)
{ {
struct net_device *dev = (struct net_device *)dev_id; struct net_device *dev = (struct net_device *)dev_id;
struct mv643xx_private *mp = netdev_priv(dev); struct mv643xx_private *mp = netdev_priv(dev);
...@@ -1047,16 +1048,15 @@ static int mv643xx_poll(struct net_device *dev, int *budget) ...@@ -1047,16 +1048,15 @@ static int mv643xx_poll(struct net_device *dev, int *budget)
static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb) static inline unsigned int has_tiny_unaligned_frags(struct sk_buff *skb)
{ {
unsigned int frag; unsigned int frag;
skb_frag_t *fragp; skb_frag_t *fragp;
for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) { for (frag = 0; frag < skb_shinfo(skb)->nr_frags; frag++) {
fragp = &skb_shinfo(skb)->frags[frag]; fragp = &skb_shinfo(skb)->frags[frag];
if (fragp->size <= 8 && fragp->page_offset & 0x7) if (fragp->size <= 8 && fragp->page_offset & 0x7)
return 1; return 1;
}
} return 0;
return 0;
} }
...@@ -2137,26 +2137,26 @@ static void eth_port_set_multicast_list(struct net_device *dev) ...@@ -2137,26 +2137,26 @@ static void eth_port_set_multicast_list(struct net_device *dev)
*/ */
if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI)) { if ((dev->flags & IFF_PROMISC) || (dev->flags & IFF_ALLMULTI)) {
for (table_index = 0; table_index <= 0xFC; table_index += 4) { for (table_index = 0; table_index <= 0xFC; table_index += 4) {
/* Set all entries in DA filter special multicast /* Set all entries in DA filter special multicast
* table (Ex_dFSMT) * table (Ex_dFSMT)
* Set for ETH_Q0 for now * Set for ETH_Q0 for now
* Bits * Bits
* 0 Accept=1, Drop=0 * 0 Accept=1, Drop=0
* 3-1 Queue ETH_Q0=0 * 3-1 Queue ETH_Q0=0
* 7-4 Reserved = 0; * 7-4 Reserved = 0;
*/ */
mv_write(MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); mv_write(MV643XX_ETH_DA_FILTER_SPECIAL_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101);
/* Set all entries in DA filter other multicast /* Set all entries in DA filter other multicast
* table (Ex_dFOMT) * table (Ex_dFOMT)
* Set for ETH_Q0 for now * Set for ETH_Q0 for now
* Bits * Bits
* 0 Accept=1, Drop=0 * 0 Accept=1, Drop=0
* 3-1 Queue ETH_Q0=0 * 3-1 Queue ETH_Q0=0
* 7-4 Reserved = 0; * 7-4 Reserved = 0;
*/ */
mv_write(MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101); mv_write(MV643XX_ETH_DA_FILTER_OTHER_MULTICAST_TABLE_BASE(eth_port_num) + table_index, 0x01010101);
} }
return; return;
} }
...@@ -2617,7 +2617,6 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, ...@@ -2617,7 +2617,6 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp,
struct eth_tx_desc *current_descriptor; struct eth_tx_desc *current_descriptor;
struct eth_tx_desc *first_descriptor; struct eth_tx_desc *first_descriptor;
u32 command; u32 command;
unsigned long flags;
/* Do not process Tx ring in case of Tx ring resource error */ /* Do not process Tx ring in case of Tx ring resource error */
if (mp->tx_resource_err) if (mp->tx_resource_err)
...@@ -2634,8 +2633,6 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, ...@@ -2634,8 +2633,6 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp,
return ETH_ERROR; return ETH_ERROR;
} }
spin_lock_irqsave(&mp->lock, flags);
mp->tx_ring_skbs++; mp->tx_ring_skbs++;
BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size);
...@@ -2685,15 +2682,11 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, ...@@ -2685,15 +2682,11 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp,
mp->tx_resource_err = 1; mp->tx_resource_err = 1;
mp->tx_curr_desc_q = tx_first_desc; mp->tx_curr_desc_q = tx_first_desc;
spin_unlock_irqrestore(&mp->lock, flags);
return ETH_QUEUE_LAST_RESOURCE; return ETH_QUEUE_LAST_RESOURCE;
} }
mp->tx_curr_desc_q = tx_next_desc; mp->tx_curr_desc_q = tx_next_desc;
spin_unlock_irqrestore(&mp->lock, flags);
return ETH_OK; return ETH_OK;
} }
#else #else
...@@ -2704,14 +2697,11 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, ...@@ -2704,14 +2697,11 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp,
int tx_desc_used; int tx_desc_used;
struct eth_tx_desc *current_descriptor; struct eth_tx_desc *current_descriptor;
unsigned int command_status; unsigned int command_status;
unsigned long flags;
/* Do not process Tx ring in case of Tx ring resource error */ /* Do not process Tx ring in case of Tx ring resource error */
if (mp->tx_resource_err) if (mp->tx_resource_err)
return ETH_QUEUE_FULL; return ETH_QUEUE_FULL;
spin_lock_irqsave(&mp->lock, flags);
mp->tx_ring_skbs++; mp->tx_ring_skbs++;
BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size); BUG_ON(mp->tx_ring_skbs > mp->tx_ring_size);
...@@ -2742,12 +2732,9 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp, ...@@ -2742,12 +2732,9 @@ static ETH_FUNC_RET_STATUS eth_port_send(struct mv643xx_private *mp,
/* Check for ring index overlap in the Tx desc ring */ /* Check for ring index overlap in the Tx desc ring */
if (tx_desc_curr == tx_desc_used) { if (tx_desc_curr == tx_desc_used) {
mp->tx_resource_err = 1; mp->tx_resource_err = 1;
spin_unlock_irqrestore(&mp->lock, flags);
return ETH_QUEUE_LAST_RESOURCE; return ETH_QUEUE_LAST_RESOURCE;
} }
spin_unlock_irqrestore(&mp->lock, flags);
return ETH_OK; return ETH_OK;
} }
#endif #endif
...@@ -2898,8 +2885,10 @@ static ETH_FUNC_RET_STATUS eth_port_receive(struct mv643xx_private *mp, ...@@ -2898,8 +2885,10 @@ static ETH_FUNC_RET_STATUS eth_port_receive(struct mv643xx_private *mp,
p_pkt_info->return_info = mp->rx_skb[rx_curr_desc]; p_pkt_info->return_info = mp->rx_skb[rx_curr_desc];
p_pkt_info->l4i_chk = p_rx_desc->buf_size; p_pkt_info->l4i_chk = p_rx_desc->buf_size;
/* Clean the return info field to indicate that the packet has been */ /*
/* moved to the upper layers */ * Clean the return info field to indicate that the
* packet has been moved to the upper layers
*/
mp->rx_skb[rx_curr_desc] = NULL; mp->rx_skb[rx_curr_desc] = NULL;
/* Update current index in data structure */ /* Update current index in data structure */
...@@ -2980,7 +2969,7 @@ struct mv643xx_stats { ...@@ -2980,7 +2969,7 @@ struct mv643xx_stats {
}; };
#define MV643XX_STAT(m) sizeof(((struct mv643xx_private *)0)->m), \ #define MV643XX_STAT(m) sizeof(((struct mv643xx_private *)0)->m), \
offsetof(struct mv643xx_private, m) offsetof(struct mv643xx_private, m)
static const struct mv643xx_stats mv643xx_gstrings_stats[] = { static const struct mv643xx_stats mv643xx_gstrings_stats[] = {
{ "rx_packets", MV643XX_STAT(stats.rx_packets) }, { "rx_packets", MV643XX_STAT(stats.rx_packets) },
...@@ -3131,9 +3120,8 @@ mv643xx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd) ...@@ -3131,9 +3120,8 @@ mv643xx_get_settings(struct net_device *netdev, struct ethtool_cmd *ecmd)
return 0; return 0;
} }
static void static void mv643xx_get_drvinfo(struct net_device *netdev,
mv643xx_get_drvinfo(struct net_device *netdev, struct ethtool_drvinfo *drvinfo)
struct ethtool_drvinfo *drvinfo)
{ {
strncpy(drvinfo->driver, mv643xx_driver_name, 32); strncpy(drvinfo->driver, mv643xx_driver_name, 32);
strncpy(drvinfo->version, mv643xx_driver_version, 32); strncpy(drvinfo->version, mv643xx_driver_version, 32);
...@@ -3142,39 +3130,37 @@ mv643xx_get_drvinfo(struct net_device *netdev, ...@@ -3142,39 +3130,37 @@ mv643xx_get_drvinfo(struct net_device *netdev,
drvinfo->n_stats = MV643XX_STATS_LEN; drvinfo->n_stats = MV643XX_STATS_LEN;
} }
static int static int mv643xx_get_stats_count(struct net_device *netdev)
mv643xx_get_stats_count(struct net_device *netdev)
{ {
return MV643XX_STATS_LEN; return MV643XX_STATS_LEN;
} }
static void static void mv643xx_get_ethtool_stats(struct net_device *netdev,
mv643xx_get_ethtool_stats(struct net_device *netdev, struct ethtool_stats *stats, uint64_t *data)
struct ethtool_stats *stats, uint64_t *data)
{ {
struct mv643xx_private *mp = netdev->priv; struct mv643xx_private *mp = netdev->priv;
int i; int i;
eth_update_mib_counters(mp); eth_update_mib_counters(mp);
for(i = 0; i < MV643XX_STATS_LEN; i++) { for (i = 0; i < MV643XX_STATS_LEN; i++) {
char *p = (char *)mp+mv643xx_gstrings_stats[i].stat_offset; char *p = (char *)mp+mv643xx_gstrings_stats[i].stat_offset;
data[i] = (mv643xx_gstrings_stats[i].sizeof_stat == data[i] = (mv643xx_gstrings_stats[i].sizeof_stat ==
sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p; sizeof(uint64_t)) ? *(uint64_t *)p : *(uint32_t *)p;
} }
} }
static void static void mv643xx_get_strings(struct net_device *netdev, uint32_t stringset,
mv643xx_get_strings(struct net_device *netdev, uint32_t stringset, uint8_t *data) uint8_t *data)
{ {
int i; int i;
switch(stringset) { switch(stringset) {
case ETH_SS_STATS: case ETH_SS_STATS:
for (i=0; i < MV643XX_STATS_LEN; i++) { for (i=0; i < MV643XX_STATS_LEN; i++) {
memcpy(data + i * ETH_GSTRING_LEN, memcpy(data + i * ETH_GSTRING_LEN,
mv643xx_gstrings_stats[i].stat_string, mv643xx_gstrings_stats[i].stat_string,
ETH_GSTRING_LEN); ETH_GSTRING_LEN);
} }
break; break;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册