Loading drivers/staging/et131x/et131x.c +46 −35 Original line number Diff line number Diff line Loading @@ -2383,14 +2383,16 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) } #ifdef USE_FBR0 adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr[1]->num_entries + adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr[1]->num_entries + adapter->rx_ring.fbr[0]->num_entries; #else adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr[0]->num_entries; #endif /* Allocate an area of memory for Free Buffer Ring 1 */ bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + 0xfff; bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + 0xfff; rx_ring->fbr[0]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, bufsize, &rx_ring->fbr[0]->ring_physaddr, Loading Loading @@ -2421,7 +2423,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) #ifdef USE_FBR0 /* Allocate an area of memory for Free Buffer Ring 0 */ bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + 0xfff; bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + 0xfff; rx_ring->fbr[1]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, bufsize, &rx_ring->fbr[1]->ring_physaddr, Loading Loading @@ -2471,7 +2474,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) (FBR_CHUNKS * rx_ring->fbr[0]->buffsize) + fbr1_align - 1; rx_ring->fbr[0]->mem_virtaddrs[i] = dma_alloc_coherent(&adapter->pdev->dev, fbr_chunksize, &rx_ring->fbr[0]->mem_physaddrs[i], GFP_KERNEL); &rx_ring->fbr[0]->mem_physaddrs[i], GFP_KERNEL); if (!rx_ring->fbr[0]->mem_virtaddrs[i]) { dev_err(&adapter->pdev->dev, Loading Loading @@ -2523,7 +2527,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) ((FBR_CHUNKS + 1) * rx_ring->fbr[1]->buffsize) - 1; rx_ring->fbr[1]->mem_virtaddrs[i] = dma_alloc_coherent(&adapter->pdev->dev, fbr_chunksize, &rx_ring->fbr[1]->mem_physaddrs[i], GFP_KERNEL); &rx_ring->fbr[1]->mem_physaddrs[i], GFP_KERNEL); if (!rx_ring->fbr[1]->mem_virtaddrs[i]) { dev_err(&adapter->pdev->dev, Loading Loading @@ -2677,8 +2682,9 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) rx_ring->fbr[0]->ring_virtaddr = (void *)((u8 *) rx_ring->fbr[0]->ring_virtaddr - rx_ring->fbr[0]->offset); bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + 0xfff; bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + 0xfff; dma_free_coherent(&adapter->pdev->dev, bufsize, rx_ring->fbr[0]->ring_virtaddr, Loading Loading @@ -2711,8 +2717,9 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) rx_ring->fbr[1]->ring_virtaddr = (void *)((u8 *) rx_ring->fbr[1]->ring_virtaddr - rx_ring->fbr[1]->offset); bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + 0xfff; bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + 0xfff; dma_free_coherent(&adapter->pdev->dev, bufsize, Loading Loading @@ -2857,8 +2864,8 @@ static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd) spin_lock_irqsave(&adapter->fbr_lock, flags); if (ring_index == 1) { struct fbr_desc *next = (struct fbr_desc *) (rx_local->fbr[0]->ring_virtaddr) + struct fbr_desc *next = (struct fbr_desc *) (rx_local->fbr[0]->ring_virtaddr) + INDEX10(rx_local->fbr[0]->local_full); /* Handle the Free Buffer Ring advancement here. Write Loading @@ -2869,7 +2876,8 @@ static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd) next->addr_lo = rx_local->fbr[0]->bus_low[buff_index]; next->word2 = buff_index; writel(bump_free_buff_ring(&rx_local->fbr[0]->local_full, writel(bump_free_buff_ring( &rx_local->fbr[0]->local_full, rx_local->fbr[0]->num_entries - 1), &rx_dma->fbr1_full_offset); } Loading Loading @@ -3212,8 +3220,10 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) */ desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX) + 4096 - 1; tx_ring->tx_desc_ring = (struct tx_desc *) dma_alloc_coherent(&adapter->pdev->dev, desc_size, &tx_ring->tx_desc_ring_pa, GFP_KERNEL); (struct tx_desc *) dma_alloc_coherent(&adapter->pdev->dev, desc_size, &tx_ring->tx_desc_ring_pa, GFP_KERNEL); if (!adapter->tx_ring.tx_desc_ring) { dev_err(&adapter->pdev->dev, "Cannot alloc memory for Tx Ring\n"); Loading Loading @@ -4871,7 +4881,8 @@ int et131x_close(struct net_device *netdev) * * Returns 0 on success, errno on failure (as defined in errno.h) */ static int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd) static int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd) { struct et131x_adapter *adapter = netdev_priv(netdev); Loading Loading @@ -5030,7 +5041,8 @@ static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) struct et131x_adapter *adapter = netdev_priv(netdev); /* stop the queue if it's getting full */ if(adapter->tx_ring.used >= NUM_TCB - 1 && !netif_queue_stopped(netdev)) if (adapter->tx_ring.used >= NUM_TCB - 1 && !netif_queue_stopped(netdev)) netif_stop_queue(netdev); /* Save the timestamp for the TX timeout watchdog */ Loading @@ -5041,12 +5053,11 @@ static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) /* Check status and manage the netif queue if necessary */ if (status != 0) { if (status == -ENOMEM) { if (status == -ENOMEM) status = NETDEV_TX_BUSY; } else { else status = NETDEV_TX_OK; } } return status; } Loading Loading
drivers/staging/et131x/et131x.c +46 −35 Original line number Diff line number Diff line Loading @@ -2383,14 +2383,16 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) } #ifdef USE_FBR0 adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr[1]->num_entries + adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr[1]->num_entries + adapter->rx_ring.fbr[0]->num_entries; #else adapter->rx_ring.psr_num_entries = adapter->rx_ring.fbr[0]->num_entries; #endif /* Allocate an area of memory for Free Buffer Ring 1 */ bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + 0xfff; bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + 0xfff; rx_ring->fbr[0]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, bufsize, &rx_ring->fbr[0]->ring_physaddr, Loading Loading @@ -2421,7 +2423,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) #ifdef USE_FBR0 /* Allocate an area of memory for Free Buffer Ring 0 */ bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + 0xfff; bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + 0xfff; rx_ring->fbr[1]->ring_virtaddr = dma_alloc_coherent(&adapter->pdev->dev, bufsize, &rx_ring->fbr[1]->ring_physaddr, Loading Loading @@ -2471,7 +2474,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) (FBR_CHUNKS * rx_ring->fbr[0]->buffsize) + fbr1_align - 1; rx_ring->fbr[0]->mem_virtaddrs[i] = dma_alloc_coherent(&adapter->pdev->dev, fbr_chunksize, &rx_ring->fbr[0]->mem_physaddrs[i], GFP_KERNEL); &rx_ring->fbr[0]->mem_physaddrs[i], GFP_KERNEL); if (!rx_ring->fbr[0]->mem_virtaddrs[i]) { dev_err(&adapter->pdev->dev, Loading Loading @@ -2523,7 +2527,8 @@ int et131x_rx_dma_memory_alloc(struct et131x_adapter *adapter) ((FBR_CHUNKS + 1) * rx_ring->fbr[1]->buffsize) - 1; rx_ring->fbr[1]->mem_virtaddrs[i] = dma_alloc_coherent(&adapter->pdev->dev, fbr_chunksize, &rx_ring->fbr[1]->mem_physaddrs[i], GFP_KERNEL); &rx_ring->fbr[1]->mem_physaddrs[i], GFP_KERNEL); if (!rx_ring->fbr[1]->mem_virtaddrs[i]) { dev_err(&adapter->pdev->dev, Loading Loading @@ -2677,8 +2682,9 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) rx_ring->fbr[0]->ring_virtaddr = (void *)((u8 *) rx_ring->fbr[0]->ring_virtaddr - rx_ring->fbr[0]->offset); bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + 0xfff; bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[0]->num_entries) + 0xfff; dma_free_coherent(&adapter->pdev->dev, bufsize, rx_ring->fbr[0]->ring_virtaddr, Loading Loading @@ -2711,8 +2717,9 @@ void et131x_rx_dma_memory_free(struct et131x_adapter *adapter) rx_ring->fbr[1]->ring_virtaddr = (void *)((u8 *) rx_ring->fbr[1]->ring_virtaddr - rx_ring->fbr[1]->offset); bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + 0xfff; bufsize = (sizeof(struct fbr_desc) * rx_ring->fbr[1]->num_entries) + 0xfff; dma_free_coherent(&adapter->pdev->dev, bufsize, Loading Loading @@ -2857,8 +2864,8 @@ static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd) spin_lock_irqsave(&adapter->fbr_lock, flags); if (ring_index == 1) { struct fbr_desc *next = (struct fbr_desc *) (rx_local->fbr[0]->ring_virtaddr) + struct fbr_desc *next = (struct fbr_desc *) (rx_local->fbr[0]->ring_virtaddr) + INDEX10(rx_local->fbr[0]->local_full); /* Handle the Free Buffer Ring advancement here. Write Loading @@ -2869,7 +2876,8 @@ static void nic_return_rfd(struct et131x_adapter *adapter, struct rfd *rfd) next->addr_lo = rx_local->fbr[0]->bus_low[buff_index]; next->word2 = buff_index; writel(bump_free_buff_ring(&rx_local->fbr[0]->local_full, writel(bump_free_buff_ring( &rx_local->fbr[0]->local_full, rx_local->fbr[0]->num_entries - 1), &rx_dma->fbr1_full_offset); } Loading Loading @@ -3212,8 +3220,10 @@ int et131x_tx_dma_memory_alloc(struct et131x_adapter *adapter) */ desc_size = (sizeof(struct tx_desc) * NUM_DESC_PER_RING_TX) + 4096 - 1; tx_ring->tx_desc_ring = (struct tx_desc *) dma_alloc_coherent(&adapter->pdev->dev, desc_size, &tx_ring->tx_desc_ring_pa, GFP_KERNEL); (struct tx_desc *) dma_alloc_coherent(&adapter->pdev->dev, desc_size, &tx_ring->tx_desc_ring_pa, GFP_KERNEL); if (!adapter->tx_ring.tx_desc_ring) { dev_err(&adapter->pdev->dev, "Cannot alloc memory for Tx Ring\n"); Loading Loading @@ -4871,7 +4881,8 @@ int et131x_close(struct net_device *netdev) * * Returns 0 on success, errno on failure (as defined in errno.h) */ static int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd) static int et131x_ioctl(struct net_device *netdev, struct ifreq *reqbuf, int cmd) { struct et131x_adapter *adapter = netdev_priv(netdev); Loading Loading @@ -5030,7 +5041,8 @@ static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) struct et131x_adapter *adapter = netdev_priv(netdev); /* stop the queue if it's getting full */ if(adapter->tx_ring.used >= NUM_TCB - 1 && !netif_queue_stopped(netdev)) if (adapter->tx_ring.used >= NUM_TCB - 1 && !netif_queue_stopped(netdev)) netif_stop_queue(netdev); /* Save the timestamp for the TX timeout watchdog */ Loading @@ -5041,12 +5053,11 @@ static int et131x_tx(struct sk_buff *skb, struct net_device *netdev) /* Check status and manage the netif queue if necessary */ if (status != 0) { if (status == -ENOMEM) { if (status == -ENOMEM) status = NETDEV_TX_BUSY; } else { else status = NETDEV_TX_OK; } } return status; } Loading