X-Git-Url: http://git.rohieb.name/openwrt.git/blobdiff_plain/18020f432db832a2a4f55238679e2c87ec5658d5..3329b43e7655951c4b496eb7c24b2af096fcbef7:/target/linux/adm5120/files/drivers/net/adm5120sw.c diff --git a/target/linux/adm5120/files/drivers/net/adm5120sw.c b/target/linux/adm5120/files/drivers/net/adm5120sw.c index 9adbf6cbe..a92695485 100644 --- a/target/linux/adm5120/files/drivers/net/adm5120sw.c +++ b/target/linux/adm5120/files/drivers/net/adm5120sw.c @@ -64,7 +64,7 @@ #define TX_RING_SIZE 32 #define TX_QUEUE_LEN 28 /* Limit ring entries actually used. */ -#define TX_TIMEOUT HZ*400 +#define TX_TIMEOUT (HZ * 400) #define RX_DESCS_SIZE (RX_RING_SIZE * sizeof(struct dma_desc *)) #define RX_SKBS_SIZE (RX_RING_SIZE * sizeof(struct sk_buff *)) @@ -232,7 +232,7 @@ static void sw_dump_desc(char *label, struct dma_desc *desc, int tx) t = desc->buf2; SW_DBG(" buf2 %08X addr=%08X%s\n", desc->buf2, t & DESC_ADDR_MASK, - (t & DESC_BUF2_EN) ? " EN" : "" ); + (t & DESC_BUF2_EN) ? " EN" : ""); t = desc->misc; if (tx) @@ -553,13 +553,11 @@ static irqreturn_t adm5120_switch_irq(int irq, void *dev_id) #else sw_int_ack(status); - if (status & (SWITCH_INT_RLD | SWITCH_INT_LDF)) { + if (status & (SWITCH_INT_RLD | SWITCH_INT_LDF)) adm5120_switch_rx(RX_RING_SIZE); - } - if (status & SWITCH_INT_SLD) { + if (status & SWITCH_INT_SLD) adm5120_switch_tx(); - } #endif return IRQ_HANDLED; @@ -589,7 +587,7 @@ static void adm5120_switch_tx_ring_reset(struct dma_desc *desc, { memset(desc, 0, num * sizeof(*desc)); desc[num-1].buf1 |= DESC_EOR; - memset(skbl, 0, sizeof(struct skb*)*num); + memset(skbl, 0, sizeof(struct skb *) * num); cur_txl = 0; dirty_txl = 0; @@ -608,7 +606,7 @@ static void adm5120_switch_rx_ring_reset(struct dma_desc *desc, break; } skb_reserve(skbl[i], SKB_RESERVE_LEN); - adm5120_rx_dma_update(&desc[i], skbl[i], (num-1==i)); + adm5120_rx_dma_update(&desc[i], skbl[i], (num - 1 == i)); } cur_rxl = 0; @@ -721,7 +719,8 @@ static void adm5120_write_mac(struct net_device *dev) sw_write_reg(SWITCH_REG_MAC_WT0, t); - while (!(sw_read_reg(SWITCH_REG_MAC_WT0) & MAC_WT0_MWD)); + while (!(sw_read_reg(SWITCH_REG_MAC_WT0) & MAC_WT0_MWD)) + ; } static void adm5120_set_vlan(char *matrix) @@ -735,9 +734,10 @@ static void adm5120_set_vlan(char *matrix) sw_write_reg(SWITCH_REG_VLAN_G2, val); /* Now set/update the port vs. device lookup table */ - for (port=0; portdata); desc->misc = - ((skb->lenlen) << DESC_PKTLEN_SHIFT) | + ((skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len) << DESC_PKTLEN_SHIFT) | (0x1 << priv->vlan_no); desc->buflen = skb->len < ETH_ZLEN ? ETH_ZLEN : skb->len; @@ -917,7 +917,7 @@ static int adm5120_if_hard_start_xmit(struct sk_buff *skb, static void adm5120_if_tx_timeout(struct net_device *dev) { - SW_INFO("TX timeout on %s\n",dev->name); + SW_INFO("TX timeout on %s\n", dev->name); } static void adm5120_if_set_multicast_list(struct net_device *dev) @@ -990,7 +990,7 @@ static int adm5120_if_do_ioctl(struct net_device *dev, struct ifreq *rq, struct adm5120_sw_info info; struct adm5120_if_priv *priv = netdev_priv(dev); - switch(cmd) { + switch (cmd) { case SIOCGADMINFO: info.magic = 0x5120; info.ports = adm5120_nrdevs; @@ -1021,15 +1021,15 @@ static int adm5120_if_do_ioctl(struct net_device *dev, struct ifreq *rq, } static const struct net_device_ops adm5120sw_netdev_ops = { - .ndo_open = adm5120_if_open, - .ndo_stop = adm5120_if_stop, - .ndo_start_xmit = adm5120_if_hard_start_xmit, - .ndo_set_multicast_list = adm5120_if_set_multicast_list, - .ndo_do_ioctl = adm5120_if_do_ioctl, - .ndo_tx_timeout = adm5120_if_tx_timeout, - .ndo_validate_addr = eth_validate_addr, - .ndo_change_mtu = eth_change_mtu, - .ndo_set_mac_address = adm5120_if_set_mac_address, + .ndo_open = adm5120_if_open, + .ndo_stop = adm5120_if_stop, + .ndo_start_xmit = adm5120_if_hard_start_xmit, + .ndo_set_multicast_list = adm5120_if_set_multicast_list, + .ndo_do_ioctl = adm5120_if_do_ioctl, + .ndo_tx_timeout = adm5120_if_tx_timeout, + .ndo_validate_addr = eth_validate_addr, + .ndo_change_mtu = eth_change_mtu, + .ndo_set_mac_address = adm5120_if_set_mac_address, }; static struct net_device *adm5120_if_alloc(void) @@ -1046,7 +1046,7 @@ static struct net_device *adm5120_if_alloc(void) dev->irq = ADM5120_IRQ_SWITCH; dev->netdev_ops = &adm5120sw_netdev_ops; - dev->watchdog_timeo = TX_TIMEOUT; + dev->watchdog_timeo = TX_TIMEOUT; #ifdef CONFIG_ADM5120_SWITCH_NAPI netif_napi_add(dev, &priv->napi, adm5120_if_poll, 64);