[Devel] [RFC 43/54] neighbour: fix CONFIG_VE=n build
Eva Kurchatova
eva.kurchatova at virtuozzo.com
Wed Apr 29 22:58:43 MSK 2026
Signed-off-by: Eva Kurchatova <eva.kurchatova at virtuozzo.com>
---
net/core/neighbour.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/net/core/neighbour.c b/net/core/neighbour.c
index dfb1eee264c9..f66016c2490e 100644
--- a/net/core/neighbour.c
+++ b/net/core/neighbour.c
@@ -267,7 +267,11 @@ static int neigh_forced_gc(struct neigh_table *tbl, struct ve_struct *ve)
list_for_each_entry_safe(n, tmp, &tbl->gc_list, gc_list) {
if (refcount_read(&n->refcnt) == 1) {
bool remove = false;
+#ifdef CONFIG_VE
bool same_ve = (dev_net(n->dev)->owner_ve == ve);
+#else
+ bool same_ve = true;
+#endif
write_lock(&n->lock);
if ((n->nud_state == NUD_FAILED) ||
@@ -488,8 +492,12 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl,
struct neighbour *n = NULL;
unsigned long now = jiffies;
int entries, gc_thresh3, glob_entries;
+#ifdef CONFIG_VE
atomic_t *cnt;
struct ve_struct *ve = dev_net(dev)->owner_ve;
+#else
+ struct ve_struct *ve = NULL;
+#endif
if (exempt_from_gc)
goto do_alloc;
@@ -500,8 +508,10 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl,
*/
glob_entries = atomic_inc_return(&tbl->entries) - 1;
+#ifdef CONFIG_VE
cnt = get_perve_tbl_entries_counter(tbl, ve);
entries = cnt ? atomic_inc_return(cnt) - 1 : glob_entries;
+#endif
gc_thresh3 = READ_ONCE(tbl->gc_thresh3);
if (entries >= gc_thresh3 ||
(glob_entries >= READ_ONCE(tbl->gc_thresh2) &&
@@ -544,8 +554,10 @@ static struct neighbour *neigh_alloc(struct neigh_table *tbl,
out_entries:
if (!exempt_from_gc) {
atomic_dec(&tbl->gc_entries);
+#ifdef CONFIG_VE
if (cnt)
atomic_dec(cnt);
+#endif
}
goto out;
}
@@ -927,8 +939,10 @@ static inline void neigh_parms_put(struct neigh_parms *parms)
void neigh_destroy(struct neighbour *neigh)
{
struct net_device *dev = neigh->dev;
+#ifdef CONFIG_VE
struct ve_struct *ve = dev_net(dev)->owner_ve;
atomic_t *cnt = get_perve_tbl_entries_counter(neigh->tbl, ve);
+#endif
NEIGH_CACHE_STAT_INC(neigh->tbl, destroys);
@@ -954,8 +968,10 @@ void neigh_destroy(struct neighbour *neigh)
neigh_dbg(2, "neigh %p is destroyed\n", neigh);
+#ifdef CONFIG_VE
if (cnt)
atomic_dec(cnt);
+#endif
atomic_dec(&neigh->tbl->entries);
kfree_rcu(neigh, rcu);
}
--
2.54.0
More information about the Devel
mailing list