* [net] Octeontx2-vf: Fix max packet length errors
@ 2025-07-02 11:05 Hariprasad Kelam
2025-07-04 15:15 ` Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: Hariprasad Kelam @ 2025-07-02 11:05 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: Hariprasad Kelam, Sunil Goutham, Geetha sowjanya,
Subbaraya Sundeep, Bharat Bhushan, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Tomasz Duszynski
Implement packet length validation before submitting packets to
the hardware to prevent MAXLEN_ERR.
Fixes: 3184fb5ba96e ("octeontx2-vf: Virtual function driver support")
Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
---
drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
index 8a8b598bd389..766237cd86c3 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
@@ -394,6 +394,13 @@ static netdev_tx_t otx2vf_xmit(struct sk_buff *skb, struct net_device *netdev)
struct otx2_snd_queue *sq;
struct netdev_queue *txq;
+ /* Check for minimum and maximum packet length */
+ if (skb->len <= ETH_HLEN ||
+ (!skb_shinfo(skb)->gso_size && skb->len > vf->tx_max_pktlen)) {
+ dev_kfree_skb(skb);
+ return NETDEV_TX_OK;
+ }
+
sq = &vf->qset.sq[qidx];
txq = netdev_get_tx_queue(netdev, qidx);
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [net] Octeontx2-vf: Fix max packet length errors
2025-07-02 11:05 [net] Octeontx2-vf: Fix max packet length errors Hariprasad Kelam
@ 2025-07-04 15:15 ` Simon Horman
2025-07-08 9:37 ` Hariprasad Kelam
0 siblings, 1 reply; 4+ messages in thread
From: Simon Horman @ 2025-07-04 15:15 UTC (permalink / raw)
To: Hariprasad Kelam
Cc: netdev, linux-kernel, Sunil Goutham, Geetha sowjanya,
Subbaraya Sundeep, Bharat Bhushan, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Tomasz Duszynski
On Wed, Jul 02, 2025 at 04:35:18PM +0530, Hariprasad Kelam wrote:
> Implement packet length validation before submitting packets to
> the hardware to prevent MAXLEN_ERR.
>
> Fixes: 3184fb5ba96e ("octeontx2-vf: Virtual function driver support")
> Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> ---
> drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> index 8a8b598bd389..766237cd86c3 100644
> --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> @@ -394,6 +394,13 @@ static netdev_tx_t otx2vf_xmit(struct sk_buff *skb, struct net_device *netdev)
> struct otx2_snd_queue *sq;
> struct netdev_queue *txq;
>
> + /* Check for minimum and maximum packet length */
> + if (skb->len <= ETH_HLEN ||
> + (!skb_shinfo(skb)->gso_size && skb->len > vf->tx_max_pktlen)) {
> + dev_kfree_skb(skb);
> + return NETDEV_TX_OK;
> + }
Hi Hariprasad,
I see the same check in otx2_xmit().
But I wonder if in that case and this one the rx drop counter for the
netdev should be incremented.
Also, do you need this check in rvu_rep_xmit() too?
> +
> sq = &vf->qset.sq[qidx];
> txq = netdev_get_tx_queue(netdev, qidx);
>
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [net] Octeontx2-vf: Fix max packet length errors
2025-07-04 15:15 ` Simon Horman
@ 2025-07-08 9:37 ` Hariprasad Kelam
2025-07-08 16:33 ` Simon Horman
0 siblings, 1 reply; 4+ messages in thread
From: Hariprasad Kelam @ 2025-07-08 9:37 UTC (permalink / raw)
To: Simon Horman
Cc: netdev, linux-kernel, Sunil Goutham, Geetha sowjanya,
Subbaraya Sundeep, Bharat Bhushan, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Tomasz Duszynski
On 2025-07-04 at 20:45:11, Simon Horman (horms@kernel.org) wrote:
> On Wed, Jul 02, 2025 at 04:35:18PM +0530, Hariprasad Kelam wrote:
> > Implement packet length validation before submitting packets to
> > the hardware to prevent MAXLEN_ERR.
> >
> > Fixes: 3184fb5ba96e ("octeontx2-vf: Virtual function driver support")
> > Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> > ---
> > drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 7 +++++++
> > 1 file changed, 7 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> > index 8a8b598bd389..766237cd86c3 100644
> > --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> > @@ -394,6 +394,13 @@ static netdev_tx_t otx2vf_xmit(struct sk_buff *skb, struct net_device *netdev)
> > struct otx2_snd_queue *sq;
> > struct netdev_queue *txq;
> >
> > + /* Check for minimum and maximum packet length */
> > + if (skb->len <= ETH_HLEN ||
> > + (!skb_shinfo(skb)->gso_size && skb->len > vf->tx_max_pktlen)) {
> > + dev_kfree_skb(skb);
> > + return NETDEV_TX_OK;
> > + }
>
> Hi Hariprasad,
>
> I see the same check in otx2_xmit().
> But I wonder if in that case and this one the rx drop counter for the
> netdev should be incremented.
>
Assuming its tx_drop counter, Will add suggested change in V2.
> Also, do you need this check in rvu_rep_xmit() too?
>
ACK, will add this check in V2.
THanks,
Hariprasad k
> > +
> > sq = &vf->qset.sq[qidx];
> > txq = netdev_get_tx_queue(netdev, qidx);
> >
> > --
> > 2.34.1
> >
> >
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [net] Octeontx2-vf: Fix max packet length errors
2025-07-08 9:37 ` Hariprasad Kelam
@ 2025-07-08 16:33 ` Simon Horman
0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2025-07-08 16:33 UTC (permalink / raw)
To: Hariprasad Kelam
Cc: netdev, linux-kernel, Sunil Goutham, Geetha sowjanya,
Subbaraya Sundeep, Bharat Bhushan, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Tomasz Duszynski
On Tue, Jul 08, 2025 at 03:07:08PM +0530, Hariprasad Kelam wrote:
> On 2025-07-04 at 20:45:11, Simon Horman (horms@kernel.org) wrote:
> > On Wed, Jul 02, 2025 at 04:35:18PM +0530, Hariprasad Kelam wrote:
> > > Implement packet length validation before submitting packets to
> > > the hardware to prevent MAXLEN_ERR.
> > >
> > > Fixes: 3184fb5ba96e ("octeontx2-vf: Virtual function driver support")
> > > Signed-off-by: Hariprasad Kelam <hkelam@marvell.com>
> > > ---
> > > drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 7 +++++++
> > > 1 file changed, 7 insertions(+)
> > >
> > > diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> > > index 8a8b598bd389..766237cd86c3 100644
> > > --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> > > +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c
> > > @@ -394,6 +394,13 @@ static netdev_tx_t otx2vf_xmit(struct sk_buff *skb, struct net_device *netdev)
> > > struct otx2_snd_queue *sq;
> > > struct netdev_queue *txq;
> > >
> > > + /* Check for minimum and maximum packet length */
> > > + if (skb->len <= ETH_HLEN ||
> > > + (!skb_shinfo(skb)->gso_size && skb->len > vf->tx_max_pktlen)) {
> > > + dev_kfree_skb(skb);
> > > + return NETDEV_TX_OK;
> > > + }
> >
> > Hi Hariprasad,
> >
> > I see the same check in otx2_xmit().
> > But I wonder if in that case and this one the rx drop counter for the
> > netdev should be incremented.
> >
> Assuming its tx_drop counter, Will add suggested change in V2.
Yes, I think so.
> > Also, do you need this check in rvu_rep_xmit() too?
> >
> ACK, will add this check in V2.
Thanks.
...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-07-08 16:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-02 11:05 [net] Octeontx2-vf: Fix max packet length errors Hariprasad Kelam
2025-07-04 15:15 ` Simon Horman
2025-07-08 9:37 ` Hariprasad Kelam
2025-07-08 16:33 ` Simon Horman
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).