}
 }
 
+static void get_old_counters(const struct xt_table_info *t,
+                            struct xt_counters counters[])
+{
+       struct arpt_entry *iter;
+       unsigned int cpu, i;
+
+       for_each_possible_cpu(cpu) {
+               i = 0;
+               xt_entry_foreach(iter, t->entries, t->size) {
+                       struct xt_counters *tmp;
+
+                       tmp = xt_get_per_cpu_counter(&iter->counters, cpu);
+                       ADD_COUNTER(counters[i], tmp->bcnt, tmp->pcnt);
+                       ++i;
+               }
+               cond_resched();
+       }
+}
+
 static struct xt_counters *alloc_counters(const struct xt_table *table)
 {
        unsigned int countersize;
            (newinfo->number <= oldinfo->initial_entries))
                module_put(t->me);
 
-       /* Get the old counters, and synchronize with replace */
-       get_counters(oldinfo, counters);
+       get_old_counters(oldinfo, counters);
 
        /* Decrease module usage counts and free resource */
        loc_cpu_old_entry = oldinfo->entries;
 
        }
 }
 
+static void get_old_counters(const struct xt_table_info *t,
+                            struct xt_counters counters[])
+{
+       struct ipt_entry *iter;
+       unsigned int cpu, i;
+
+       for_each_possible_cpu(cpu) {
+               i = 0;
+               xt_entry_foreach(iter, t->entries, t->size) {
+                       const struct xt_counters *tmp;
+
+                       tmp = xt_get_per_cpu_counter(&iter->counters, cpu);
+                       ADD_COUNTER(counters[i], tmp->bcnt, tmp->pcnt);
+                       ++i; /* macro does multi eval of i */
+               }
+
+               cond_resched();
+       }
+}
+
 static struct xt_counters *alloc_counters(const struct xt_table *table)
 {
        unsigned int countersize;
            (newinfo->number <= oldinfo->initial_entries))
                module_put(t->me);
 
-       /* Get the old counters, and synchronize with replace */
-       get_counters(oldinfo, counters);
+       get_old_counters(oldinfo, counters);
 
        /* Decrease module usage counts and free resource */
        xt_entry_foreach(iter, oldinfo->entries, oldinfo->size)
 
        }
 }
 
+static void get_old_counters(const struct xt_table_info *t,
+                            struct xt_counters counters[])
+{
+       struct ip6t_entry *iter;
+       unsigned int cpu, i;
+
+       for_each_possible_cpu(cpu) {
+               i = 0;
+               xt_entry_foreach(iter, t->entries, t->size) {
+                       const struct xt_counters *tmp;
+
+                       tmp = xt_get_per_cpu_counter(&iter->counters, cpu);
+                       ADD_COUNTER(counters[i], tmp->bcnt, tmp->pcnt);
+                       ++i;
+               }
+               cond_resched();
+       }
+}
+
 static struct xt_counters *alloc_counters(const struct xt_table *table)
 {
        unsigned int countersize;
            (newinfo->number <= oldinfo->initial_entries))
                module_put(t->me);
 
-       /* Get the old counters, and synchronize with replace */
-       get_counters(oldinfo, counters);
+       get_old_counters(oldinfo, counters);
 
        /* Decrease module usage counts and free resource */
        xt_entry_foreach(iter, oldinfo->entries, oldinfo->size)