Re: [net-next PATCH v4 03/10] octeontx2-pf: Create representor netdev
From: Simon Horman <horms@kernel.org>
Date: 2024-05-11 14:10:42
Also in:
lkml
On Tue, May 07, 2024 at 10:09:14PM +0530, Geetha sowjanya wrote:
Adds initial devlink support to set/get the switchdev mode. Representor netdevs are created for each rvu devices when the switch mode is set to 'switchdev'. These netdevs are be used to control and configure VFs. Signed-off-by: Geetha sowjanya <gakula@marvell.com>
...
quoted hunk ↗ jump to hunk
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c index 33ebbcb223e1..ff4318f414f8 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/rep.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/rep.c@@ -28,6 +28,157 @@ MODULE_DESCRIPTION(DRV_STRING); MODULE_LICENSE("GPL"); MODULE_DEVICE_TABLE(pci, rvu_rep_id_table); +static int rvu_rep_napi_init(struct otx2_nic *priv, struct netlink_ext_ack *extack) +{ + struct otx2_cq_poll *cq_poll = NULL; + struct otx2_qset *qset = &priv->qset; + struct otx2_hw *hw = &priv->hw; + int err = 0, qidx, vec; + char *irq_name;
Please consider using reverse xmas tree - longest line to shortest - for local variable declarations in new Networking code. This tool can be helpful: https://github.com/ecree-solarflare/xmastree ...
+int rvu_rep_create(struct otx2_nic *priv, struct netlink_ext_ack *extack)
+{
+ int rep_cnt = priv->rep_cnt;
+ struct net_device *ndev;
+ struct rep_dev *rep;
+ int rep_id, err;
+ u16 pcifunc;
+
+ priv->reps = devm_kcalloc(priv->dev, rep_cnt, sizeof(struct rep_dev *),
+ GFP_KERNEL);
+ if (!priv->reps)
+ return -ENOMEM;
+
+ for (rep_id = 0; rep_id < rep_cnt; rep_id++) {
+ ndev = alloc_etherdev(sizeof(*rep));
+ if (!ndev) {
+ NL_SET_ERR_MSG_FMT_MOD(extack, "PFVF representor:%d
+ creation failed", rep_id);gcc-13 seems unhappy with a string spanning multiple lines. I suggest living with a line longer than 80 columns in this case. Maybe: NL_SET_ERR_MSG_FMT_MOD(extack, "PFVF representor:%d creation failed", rep_id);
+ err = -ENOMEM; + goto exit; + }
...