]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/igbvf/netdev.c
net: use netdev_mc_count and netdev_mc_empty when appropriate
[net-next-2.6.git] / drivers / net / igbvf / netdev.c
index 0dbd0320023acf47ff36f2b97fe434b567cfc414..6029c400f2be1e625524b64672327615ad0edeb8 100644 (file)
@@ -1403,8 +1403,8 @@ static void igbvf_set_multi(struct net_device *netdev)
        u8  *mta_list = NULL;
        int i;
 
-       if (netdev->mc_count) {
-               mta_list = kmalloc(netdev->mc_count * 6, GFP_ATOMIC);
+       if (!netdev_mc_empty(netdev)) {
+               mta_list = kmalloc(netdev_mc_count(netdev) * 6, GFP_ATOMIC);
                if (!mta_list) {
                        dev_err(&adapter->pdev->dev,
                                "failed to allocate multicast filter list\n");
@@ -1415,7 +1415,7 @@ static void igbvf_set_multi(struct net_device *netdev)
        /* prepare a packed array of only addresses. */
        mc_ptr = netdev->mc_list;
 
-       for (i = 0; i < netdev->mc_count; i++) {
+       for (i = 0; i < netdev_mc_count(netdev); i++) {
                if (!mc_ptr)
                        break;
                memcpy(mta_list + (i*ETH_ALEN), mc_ptr->dmi_addr,
@@ -1963,7 +1963,7 @@ static int igbvf_tso(struct igbvf_adapter *adapter,
                                                         iph->daddr, 0,
                                                         IPPROTO_TCP,
                                                         0);
-       } else if (skb_shinfo(skb)->gso_type == SKB_GSO_TCPV6) {
+       } else if (skb_is_gso_v6(skb)) {
                ipv6_hdr(skb)->payload_len = 0;
                tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr,
                                                       &ipv6_hdr(skb)->daddr,
@@ -2117,6 +2117,7 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter,
        /* set time_stamp *before* dma to help avoid a possible race */
        buffer_info->time_stamp = jiffies;
        buffer_info->next_to_watch = i;
+       buffer_info->mapped_as_page = false;
        buffer_info->dma = pci_map_single(pdev, skb->data, len,
                                          PCI_DMA_TODEVICE);
        if (pci_dma_mapping_error(pdev, buffer_info->dma))
@@ -2126,6 +2127,7 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter,
        for (f = 0; f < skb_shinfo(skb)->nr_frags; f++) {
                struct skb_frag_struct *frag;
 
+               count++;
                i++;
                if (i == tx_ring->count)
                        i = 0;
@@ -2146,7 +2148,6 @@ static inline int igbvf_tx_map_adv(struct igbvf_adapter *adapter,
                                                PCI_DMA_TODEVICE);
                if (pci_dma_mapping_error(pdev, buffer_info->dma))
                        goto dma_error;
-               count++;
        }
 
        tx_ring->buffer_info[i].skb = skb;
@@ -2163,14 +2164,14 @@ dma_error:
        buffer_info->length = 0;
        buffer_info->next_to_watch = 0;
        buffer_info->mapped_as_page = false;
-       count--;
+       if (count)
+               count--;
 
        /* clear timestamp and dma mappings for remaining portion of packet */
-       while (count >= 0) {
-               count--;
-               i--;
-               if (i < 0)
+       while (count--) {
+               if (i==0)
                        i += tx_ring->count;
+               i--;
                buffer_info = &tx_ring->buffer_info[i];
                igbvf_put_txbuf(adapter, buffer_info);
        }
@@ -2608,11 +2609,7 @@ static void igbvf_print_device_info(struct igbvf_adapter *adapter)
        struct pci_dev *pdev = adapter->pdev;
 
        dev_info(&pdev->dev, "Intel(R) 82576 Virtual Function\n");
-       dev_info(&pdev->dev, "Address: %02x:%02x:%02x:%02x:%02x:%02x\n",
-                /* MAC address */
-                netdev->dev_addr[0], netdev->dev_addr[1],
-                netdev->dev_addr[2], netdev->dev_addr[3],
-                netdev->dev_addr[4], netdev->dev_addr[5]);
+       dev_info(&pdev->dev, "Address: %pM\n", netdev->dev_addr);
        dev_info(&pdev->dev, "MAC: %d\n", hw->mac.type);
 }
 
@@ -2778,11 +2775,8 @@ static int __devinit igbvf_probe(struct pci_dev *pdev,
        memcpy(netdev->perm_addr, adapter->hw.mac.addr, netdev->addr_len);
 
        if (!is_valid_ether_addr(netdev->perm_addr)) {
-               dev_err(&pdev->dev, "Invalid MAC Address: "
-                       "%02x:%02x:%02x:%02x:%02x:%02x\n",
-                       netdev->dev_addr[0], netdev->dev_addr[1],
-                       netdev->dev_addr[2], netdev->dev_addr[3],
-                       netdev->dev_addr[4], netdev->dev_addr[5]);
+               dev_err(&pdev->dev, "Invalid MAC Address: %pM\n",
+                       netdev->dev_addr);
                err = -EIO;
                goto err_hw_init;
        }
@@ -2884,7 +2878,7 @@ static struct pci_error_handlers igbvf_err_handler = {
        .resume = igbvf_io_resume,
 };
 
-static struct pci_device_id igbvf_pci_tbl[] = {
+static DEFINE_PCI_DEVICE_TABLE(igbvf_pci_tbl) = {
        { PCI_VDEVICE(INTEL, E1000_DEV_ID_82576_VF), board_vf },
        { } /* terminate list */
 };