]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - drivers/net/niu.c
Merge branch 'master' of master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
[net-next-2.6.git] / drivers / net / niu.c
index bc695d53cdccbcca3eb1c2ccb30018acb3c8bde6..8e1859c801a4e0e056457a65473c85cc17070ffa 100644 (file)
@@ -3484,7 +3484,7 @@ static int niu_process_rx_pkt(struct napi_struct *napi, struct niu *np,
                                     RCR_ENTRY_ERROR)))
                                skb->ip_summed = CHECKSUM_UNNECESSARY;
                        else
-                               skb->ip_summed = CHECKSUM_NONE;
+                               skb_checksum_none_assert(skb);
                } else if (!(val & RCR_ENTRY_MULTI))
                        append_size = len - skb->len;
 
@@ -4504,7 +4504,7 @@ static int niu_alloc_channels(struct niu *np)
 
        np->dev->real_num_tx_queues = np->num_tx_rings;
 
-       np->rx_rings = kzalloc(np->num_rx_rings * sizeof(struct rx_ring_info),
+       np->rx_rings = kcalloc(np->num_rx_rings, sizeof(struct rx_ring_info),
                               GFP_KERNEL);
        err = -ENOMEM;
        if (!np->rx_rings)
@@ -4538,7 +4538,7 @@ static int niu_alloc_channels(struct niu *np)
                        return err;
        }
 
-       np->tx_rings = kzalloc(np->num_tx_rings * sizeof(struct tx_ring_info),
+       np->tx_rings = kcalloc(np->num_tx_rings, sizeof(struct tx_ring_info),
                               GFP_KERNEL);
        err = -ENOMEM;
        if (!np->tx_rings)
@@ -7269,32 +7269,28 @@ static int niu_get_ethtool_tcam_all(struct niu *np,
        struct niu_parent *parent = np->parent;
        struct niu_tcam_entry *tp;
        int i, idx, cnt;
-       u16 n_entries;
        unsigned long flags;
-
+       int ret = 0;
 
        /* put the tcam size here */
        nfc->data = tcam_get_size(np);
 
        niu_lock_parent(np, flags);
-       n_entries = nfc->rule_cnt;
        for (cnt = 0, i = 0; i < nfc->data; i++) {
                idx = tcam_get_index(np, i);
                tp = &parent->tcam[idx];
                if (!tp->valid)
                        continue;
+               if (cnt == nfc->rule_cnt) {
+                       ret = -EMSGSIZE;
+                       break;
+               }
                rule_locs[cnt] = i;
                cnt++;
        }
        niu_unlock_parent(np, flags);
 
-       if (n_entries != cnt) {
-               /* print warning, this should not happen */
-               netdev_info(np->dev, "niu%d: In %s(): n_entries[%d] != cnt[%d]!!!\n",
-                           np->parent->index, __func__, n_entries, cnt);
-       }
-
-       return 0;
+       return ret;
 }
 
 static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,