aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/niu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/niu.c')
-rw-r--r--drivers/net/niu.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/drivers/net/niu.c b/drivers/net/niu.c
index bc695d53cdcc..fe6983af6918 100644
--- a/drivers/net/niu.c
+++ b/drivers/net/niu.c
@@ -7269,32 +7269,28 @@ static int niu_get_ethtool_tcam_all(struct niu *np,
7269 struct niu_parent *parent = np->parent; 7269 struct niu_parent *parent = np->parent;
7270 struct niu_tcam_entry *tp; 7270 struct niu_tcam_entry *tp;
7271 int i, idx, cnt; 7271 int i, idx, cnt;
7272 u16 n_entries;
7273 unsigned long flags; 7272 unsigned long flags;
7274 7273 int ret = 0;
7275 7274
7276 /* put the tcam size here */ 7275 /* put the tcam size here */
7277 nfc->data = tcam_get_size(np); 7276 nfc->data = tcam_get_size(np);
7278 7277
7279 niu_lock_parent(np, flags); 7278 niu_lock_parent(np, flags);
7280 n_entries = nfc->rule_cnt;
7281 for (cnt = 0, i = 0; i < nfc->data; i++) { 7279 for (cnt = 0, i = 0; i < nfc->data; i++) {
7282 idx = tcam_get_index(np, i); 7280 idx = tcam_get_index(np, i);
7283 tp = &parent->tcam[idx]; 7281 tp = &parent->tcam[idx];
7284 if (!tp->valid) 7282 if (!tp->valid)
7285 continue; 7283 continue;
7284 if (cnt == nfc->rule_cnt) {
7285 ret = -EMSGSIZE;
7286 break;
7287 }
7286 rule_locs[cnt] = i; 7288 rule_locs[cnt] = i;
7287 cnt++; 7289 cnt++;
7288 } 7290 }
7289 niu_unlock_parent(np, flags); 7291 niu_unlock_parent(np, flags);
7290 7292
7291 if (n_entries != cnt) { 7293 return ret;
7292 /* print warning, this should not happen */
7293 netdev_info(np->dev, "niu%d: In %s(): n_entries[%d] != cnt[%d]!!!\n",
7294 np->parent->index, __func__, n_entries, cnt);
7295 }
7296
7297 return 0;
7298} 7294}
7299 7295
7300static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd, 7296static int niu_get_nfc(struct net_device *dev, struct ethtool_rxnfc *cmd,