Skip to content

Commit 3392f91

Browse files
Geetha sowjanyadavem330
authored andcommitted
octeontx2-pf: Configure VF mtu via representor
Adds support to manage the mtu configuration for VF through representor. On update of representor mtu a mbox notification is send to VF to update its mtu. This feature is implemented based on the "Network Function Representors" kernel documentation. " Setting an MTU on the representor should cause that same MTU to be reported to the representee. " Signed-off-by: Sai Krishna <[email protected]> Signed-off-by: Geetha sowjanya <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b8fea84 commit 3392f91

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -854,6 +854,11 @@ static int otx2_mbox_up_handler_rep_event_up_notify(struct otx2_nic *pf,
854854
{
855855
struct net_device *netdev = pf->netdev;
856856

857+
if (info->event == RVU_EVENT_MTU_CHANGE) {
858+
netdev->mtu = info->evt_data.mtu;
859+
return 0;
860+
}
861+
857862
if (info->event == RVU_EVENT_PORT_STATE) {
858863
if (info->evt_data.port_state) {
859864
pf->flags |= OTX2_FLAG_PORT_UP;

drivers/net/ethernet/marvell/octeontx2/nic/rep.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,22 @@ int rvu_event_up_notify(struct otx2_nic *pf, struct rep_event *info)
7979
return 0;
8080
}
8181

82+
static int rvu_rep_change_mtu(struct net_device *dev, int new_mtu)
83+
{
84+
struct rep_dev *rep = netdev_priv(dev);
85+
struct otx2_nic *priv = rep->mdev;
86+
struct rep_event evt = {0};
87+
88+
netdev_info(dev, "Changing MTU from %d to %d\n",
89+
dev->mtu, new_mtu);
90+
dev->mtu = new_mtu;
91+
92+
evt.evt_data.mtu = new_mtu;
93+
evt.pcifunc = rep->pcifunc;
94+
rvu_rep_notify_pfvf(priv, RVU_EVENT_MTU_CHANGE, &evt);
95+
return 0;
96+
}
97+
8298
static void rvu_rep_get_stats(struct work_struct *work)
8399
{
84100
struct delayed_work *del_work = to_delayed_work(work);
@@ -226,6 +242,7 @@ static const struct net_device_ops rvu_rep_netdev_ops = {
226242
.ndo_stop = rvu_rep_stop,
227243
.ndo_start_xmit = rvu_rep_xmit,
228244
.ndo_get_stats64 = rvu_rep_get_stats64,
245+
.ndo_change_mtu = rvu_rep_change_mtu,
229246
};
230247

231248
static int rvu_rep_napi_init(struct otx2_nic *priv,

0 commit comments

Comments
 (0)