Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[sfrench/cifs-2.6.git] / drivers / net / benet / be_main.c
index 30d0c81c989e3c443f3254115f99319e79e1065c..ae2f6b58ba25532ff659fc2910aa6859bb5b4160 100644 (file)
@@ -28,10 +28,10 @@ static unsigned int rx_frag_size = 2048;
 module_param(rx_frag_size, uint, S_IRUGO);
 MODULE_PARM_DESC(rx_frag_size, "Size of a fragment that holds rcvd data.");
 
-#define BE_VENDOR_ID           0x19a2
-#define BE2_DEVICE_ID_1        0x0211
 static DEFINE_PCI_DEVICE_TABLE(be_dev_ids) = {
-       { PCI_DEVICE(BE_VENDOR_ID, BE2_DEVICE_ID_1) },
+       { PCI_DEVICE(BE_VENDOR_ID, BE_DEVICE_ID1) },
+       { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID1) },
+       { PCI_DEVICE(BE_VENDOR_ID, OC_DEVICE_ID2) },
        { 0 }
 };
 MODULE_DEVICE_TABLE(pci, be_dev_ids);
@@ -637,6 +637,22 @@ static void be_rx_stats_update(struct be_adapter *adapter,
        stats->be_rx_bytes += pktsize;
 }
 
+static inline bool do_pkt_csum(struct be_eth_rx_compl *rxcp, bool cso)
+{
+       u8 l4_cksm, ip_version, ipcksm, tcpf = 0, udpf = 0, ipv6_chk;
+
+       l4_cksm = AMAP_GET_BITS(struct amap_eth_rx_compl, l4_cksm, rxcp);
+       ipcksm = AMAP_GET_BITS(struct amap_eth_rx_compl, ipcksm, rxcp);
+       ip_version = AMAP_GET_BITS(struct amap_eth_rx_compl, ip_version, rxcp);
+       if (ip_version) {
+               tcpf = AMAP_GET_BITS(struct amap_eth_rx_compl, tcpf, rxcp);
+               udpf = AMAP_GET_BITS(struct amap_eth_rx_compl, udpf, rxcp);
+       }
+       ipv6_chk = (ip_version && (tcpf || udpf));
+
+       return ((l4_cksm && ipv6_chk && ipcksm) && cso) ? false : true;
+}
+
 static struct be_rx_page_info *
 get_rx_page_info(struct be_adapter *adapter, u16 frag_idx)
 {
@@ -752,9 +768,7 @@ static void be_rx_compl_process(struct be_adapter *adapter,
 {
        struct sk_buff *skb;
        u32 vtp, vid;
-       int l4_cksm;
 
-       l4_cksm = AMAP_GET_BITS(struct amap_eth_rx_compl, l4_cksm, rxcp);
        vtp = AMAP_GET_BITS(struct amap_eth_rx_compl, vtp, rxcp);
 
        skb = netdev_alloc_skb(adapter->netdev, BE_HDR_LEN + NET_IP_ALIGN);
@@ -769,10 +783,10 @@ static void be_rx_compl_process(struct be_adapter *adapter,
 
        skb_fill_rx_data(adapter, skb, rxcp);
 
-       if (l4_cksm && adapter->rx_csum)
-               skb->ip_summed = CHECKSUM_UNNECESSARY;
-       else
+       if (do_pkt_csum(rxcp, adapter->rx_csum))
                skb->ip_summed = CHECKSUM_NONE;
+       else
+               skb->ip_summed = CHECKSUM_UNNECESSARY;
 
        skb->truesize = skb->len + sizeof(struct sk_buff);
        skb->protocol = eth_type_trans(skb, adapter->netdev);
@@ -1626,10 +1640,12 @@ static void be_netdev_init(struct net_device *netdev)
 
        netdev->features |= NETIF_F_SG | NETIF_F_HW_VLAN_RX | NETIF_F_TSO |
                NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_FILTER | NETIF_F_IP_CSUM |
-               NETIF_F_IPV6_CSUM | NETIF_F_TSO6;
+               NETIF_F_IPV6_CSUM;
 
        netdev->flags |= IFF_MULTICAST;
 
+       adapter->rx_csum = true;
+
        BE_SET_NETDEV_OPS(netdev, &be_netdev_ops);
 
        SET_ETHTOOL_OPS(netdev, &be_ethtool_ops);
@@ -1859,7 +1875,7 @@ static int __devinit be_probe(struct pci_dev *pdev,
        if (status != 0)
                goto stats_clean;
 
-       dev_info(&pdev->dev, BE_NAME " port %d\n", adapter->port_num);
+       dev_info(&pdev->dev, "%s port %d\n", nic_name(pdev), adapter->port_num);
        return 0;
 
 stats_clean:
@@ -1873,7 +1889,7 @@ rel_reg:
 disable_dev:
        pci_disable_device(pdev);
 do_none:
-       dev_warn(&pdev->dev, BE_NAME " initialization failed\n");
+       dev_err(&pdev->dev, "%s initialization failed\n", nic_name(pdev));
        return status;
 }