Thread (21 messages) 21 messages, 3 authors, 2026-01-09

Re: [PATCH net-next v2 07/10] octeontx2: switch: L2 offload support

From: ALOK TIWARI <hidden>
Date: 2026-01-08 09:08:02
Also in: lkml


On 1/7/2026 6:54 PM, Ratheesh Kannoth wrote:
+
+static void rvu_sw_l2_offl_rule_wq_handler(struct work_struct *work)
+{
+	struct rvu_sw_l2_work *offl_work;
+	struct l2_entry *l2_entry;
+	int budget = 16;
+	bool add_fdb;
+
+	offl_work = container_of(work, struct rvu_sw_l2_work, work);
+
+	while (budget--) {
+		mutex_lock(&l2_offl_list_lock);
+		l2_entry = list_first_entry_or_null(&l2_offl_lh, struct l2_entry, list);
+		if (!l2_entry) {
+			mutex_unlock(&l2_offl_list_lock);
+			return;
+		}
+
+		list_del_init(&l2_entry->list);
+		mutex_unlock(&l2_offl_list_lock);
+
+		add_fdb = !!(l2_entry->flags & FDB_ADD);
+
+		if (add_fdb)
+			rvu_sw_l2_offl_cancel_add_if_del_reqs_exist(l2_entry->mac);
+
+		rvu_sw_l2_offl_rule_push(offl_work->rvu, l2_entry);
+		kfree(l2_entry);
+	}
+
+	if (!list_empty(&l2_offl_lh))
+		queue_work(rvu_sw_l2_offl_wq, &l2_offl_work.work);
+}
+
+int rvu_sw_l2_init_offl_wq(struct rvu *rvu, u16 pcifunc, bool fw_up)
+{
+	struct rvu_switch *rswitch;
+
+	rswitch = &rvu->rswitch;
+
+	if (fw_up) {
+		rswitch->flags |= RVU_SWITCH_FLAG_FW_READY;
+		rswitch->pcifunc = pcifunc;
+
+		l2_offl_work.rvu = rvu;
+		INIT_WORK(&l2_offl_work.work, rvu_sw_l2_offl_rule_wq_handler);
+		rvu_sw_l2_offl_wq = alloc_workqueue("swdev_rvu_sw_l2_offl_wq", 0, 0);
+		if (!rvu_sw_l2_offl_wq) {
+			dev_err(rvu->dev, "L2 offl workqueue allocation failed\n");
+			return -ENOMEM;
+		}
+
+		fdb_refresh_work.rvu = rvu;
+		INIT_WORK(&fdb_refresh_work.work, rvu_sw_l2_fdb_refresh_wq_handler);
+		fdb_refresh_wq = alloc_workqueue("swdev_fdb_refresg_wq", 0, 0);
consider, "swdev_fdb_refresg_wq" -> "swdev_fdb_refresh_wq"
+		if (!rvu_sw_l2_offl_wq) {
Checks rvu_sw_l2_offl_wq instead of fdb_refresh_wq
+			dev_err(rvu->dev, "L2 offl workqueue allocation failed\n");
offl -> fbd
+			return -ENOMEM;
+		}
+
+		return 0;
+	}
+
+	rswitch->flags &= ~RVU_SWITCH_FLAG_FW_READY;
+	rswitch->pcifunc = -1;
+	flush_work(&l2_offl_work.work);
+	return 0;
+}

Thanks,
Alok
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help