]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - drivers/net/ethernet/ibm/ibmveth.c
Merge branches 'pm-core', 'pm-qos', 'pm-domains' and 'pm-opp'
[linux.git] / drivers / net / ethernet / ibm / ibmveth.c
index a36022ba4e4232025483ec937cb894474886706a..309f5c66083cf504e8beaeff9f4575e40c646063 100644 (file)
@@ -1181,7 +1181,9 @@ static netdev_tx_t ibmveth_start_xmit(struct sk_buff *skb,
 
 static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
 {
+       struct tcphdr *tcph;
        int offset = 0;
+       int hdr_len;
 
        /* only TCP packets will be aggregated */
        if (skb->protocol == htons(ETH_P_IP)) {
@@ -1208,14 +1210,20 @@ static void ibmveth_rx_mss_helper(struct sk_buff *skb, u16 mss, int lrg_pkt)
        /* if mss is not set through Large Packet bit/mss in rx buffer,
         * expect that the mss will be written to the tcp header checksum.
         */
+       tcph = (struct tcphdr *)(skb->data + offset);
        if (lrg_pkt) {
                skb_shinfo(skb)->gso_size = mss;
        } else if (offset) {
-               struct tcphdr *tcph = (struct tcphdr *)(skb->data + offset);
-
                skb_shinfo(skb)->gso_size = ntohs(tcph->check);
                tcph->check = 0;
        }
+
+       if (skb_shinfo(skb)->gso_size) {
+               hdr_len = offset + tcph->doff * 4;
+               skb_shinfo(skb)->gso_segs =
+                               DIV_ROUND_UP(skb->len - hdr_len,
+                                            skb_shinfo(skb)->gso_size);
+       }
 }
 
 static int ibmveth_poll(struct napi_struct *napi, int budget)
@@ -1410,9 +1418,6 @@ static int ibmveth_change_mtu(struct net_device *dev, int new_mtu)
        int i, rc;
        int need_restart = 0;
 
-       if (new_mtu < IBMVETH_MIN_MTU)
-               return -EINVAL;
-
        for (i = 0; i < IBMVETH_NUM_BUFF_POOLS; i++)
                if (new_mtu_oh <= adapter->rx_buff_pool[i].buff_size)
                        break;
@@ -1596,8 +1601,11 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
        netdev->netdev_ops = &ibmveth_netdev_ops;
        netdev->ethtool_ops = &netdev_ethtool_ops;
        SET_NETDEV_DEV(netdev, &dev->dev);
-       netdev->hw_features = NETIF_F_SG | NETIF_F_RXCSUM |
-               NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+       netdev->hw_features = NETIF_F_SG;
+       if (vio_get_attribute(dev, "ibm,illan-options", NULL) != NULL) {
+               netdev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
+                                      NETIF_F_RXCSUM;
+       }
 
        netdev->features |= netdev->hw_features;
 
@@ -1612,6 +1620,9 @@ static int ibmveth_probe(struct vio_dev *dev, const struct vio_device_id *id)
                netdev->hw_features |= NETIF_F_TSO;
        }
 
+       netdev->min_mtu = IBMVETH_MIN_MTU;
+       netdev->max_mtu = ETH_MAX_MTU;
+
        memcpy(netdev->dev_addr, mac_addr_p, ETH_ALEN);
 
        if (firmware_has_feature(FW_FEATURE_CMO))