DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ferruh Yigit <ferruh.yigit@amd.com>
To: Jesna K E <jesna.k.e@amd.com>, dev@dpdk.org
Cc: Selwin.Sebastian@amd.com
Subject: Re: [PATCH v1 1/3] net/axgbe: packet size doesn't exceed the configured MTU
Date: Mon, 13 Nov 2023 15:07:24 +0000	[thread overview]
Message-ID: <dc5f4e55-ac1c-485c-8d0f-197aa31da6aa@amd.com> (raw)
In-Reply-To: <20231111160006.455767-1-jesna.k.e@amd.com>

On 11/11/2023 4:00 PM, Jesna K E wrote:
> Signed-off-by: Jesna K E <jesna.k.e@amd.com>
>

Hi Jesna,

Description is missing, making it hard to understand the problem and
motivation of the change.


> ---
>  drivers/net/axgbe/axgbe_ethdev.c |  6 ------
>  drivers/net/axgbe/axgbe_rxtx.c   | 20 ++++++++++++++++++--
>  2 files changed, 18 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
> index 3717166384..e12ee3e17a 100644
> --- a/drivers/net/axgbe/axgbe_ethdev.c
> +++ b/drivers/net/axgbe/axgbe_ethdev.c
> @@ -1492,12 +1492,6 @@ static int axgb_mtu_set(struct rte_eth_dev *dev, uint16_t mtu)
>  	struct axgbe_port *pdata = dev->data->dev_private;
>  	unsigned int val;
>  
> -	/* mtu setting is forbidden if port is start */
> -	if (dev->data->dev_started) {
> -		PMD_DRV_LOG(ERR, "port %d must be stopped before configuration",
> -				dev->data->port_id);
> -		return -EBUSY;
> -	}
>

Is it allowed to configure MTU when port is already started?

>  	val = mtu > RTE_ETHER_MTU ? 1 : 0;
>  	AXGMAC_IOWRITE_BITS(pdata, MAC_RCR, JE, val);
>  
> diff --git a/drivers/net/axgbe/axgbe_rxtx.c b/drivers/net/axgbe/axgbe_rxtx.c
> index a9ff291cef..68aa67a3fa 100644
> --- a/drivers/net/axgbe/axgbe_rxtx.c
> +++ b/drivers/net/axgbe/axgbe_rxtx.c
> @@ -210,7 +210,7 @@ axgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
>  	uint64_t old_dirty = rxq->dirty;
>  	struct rte_mbuf *mbuf, *tmbuf;
>  	unsigned int err, etlt;
> -	uint32_t error_status;
> +	uint32_t error_status, max_len;
>  	uint16_t idx, pidx, pkt_len;
>  
>  	idx = AXGBE_GET_DESC_IDX(rxq, rxq->cur);
> @@ -300,6 +300,14 @@ axgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
>  					| RTE_MBUF_F_RX_IEEE1588_TMST;
>  		pkt_len = AXGMAC_GET_BITS_LE(desc->write.desc3, RX_NORMAL_DESC3,
>  					     PL) - rxq->crc_len;
> +
> +		/* Be sure we don't exceed the configured MTU */
> +		max_len = rxq->pdata->eth_dev->data->mtu  + RTE_ETHER_HDR_LEN;
> +			if (pkt_len > max_len) {
> +				printf( "packet length exceeds configured MTU\n");
> +				goto err_set;
> +			}
> +
>

Not sure if it is good idea to add above check per packet, can there be
a device configuration to limit received packet size.


>  		/* Mbuf populate */
>  		mbuf->next = NULL;
>  		mbuf->data_off = RTE_PKTMBUF_HEADROOM;
> @@ -342,7 +350,7 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue,
>  	struct rte_mbuf *first_seg = NULL;
>  	struct rte_mbuf *mbuf, *tmbuf;
>  	unsigned int err = 0, etlt;
> -	uint32_t error_status = 0;
> +	uint32_t error_status = 0, max_len = 0;
>  	uint16_t idx, pidx, data_len = 0, pkt_len = 0;
>  	bool eop = 0;
>  
> @@ -409,6 +417,14 @@ uint16_t eth_axgbe_recv_scattered_pkts(void *rx_queue,
>  			}
>  
>  		}
> +
> +                /* Be sure we don't exceed the configured MTU */
> +                max_len = rxq->pdata->eth_dev->data->mtu  + RTE_ETHER_HDR_LEN;
> +                        if (pkt_len > max_len) {
> +                                printf( "packet length exceeds configured MTU\n");
> +                                goto err_set;
> +                        }
> +
>  		/* Mbuf populate */
>  		mbuf->data_off = RTE_PKTMBUF_HEADROOM;
>  		mbuf->data_len = data_len;


      parent reply	other threads:[~2023-11-13 15:07 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-11 16:00 Jesna K E
2023-11-11 16:00 ` [PATCH v1 2/3] net/axgbe: correct API call when offload enabled Jesna K E
2023-11-13 15:23   ` Ferruh Yigit
2023-11-13 16:55     ` Ferruh Yigit
2023-11-14  6:07       ` [PATCH v2] net/axgbe: invoke correct API when offloads enabled Jesna K E
2023-11-14  7:15       ` Jesna K E
2023-11-15  5:56       ` [PATCH v3] " Jesna K E
2023-11-15 11:57         ` Ferruh Yigit
2023-11-15 12:54         ` Sebastian, Selwin
2023-11-15 12:59           ` Ferruh Yigit
2023-11-11 16:00 ` [PATCH v1 3/3] net/axgbe: support TSO Implementation Jesna K E
2023-11-15 19:33   ` Ferruh Yigit
2023-11-16  9:44     ` [PATCH v2] net/axgbe: support TSO Jesna K E
2023-11-16 16:03     ` [PATCH v3] " Jesna K E
2023-11-17 18:34       ` Ferruh Yigit
2023-11-13 15:07 ` Ferruh Yigit [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dc5f4e55-ac1c-485c-8d0f-197aa31da6aa@amd.com \
    --to=ferruh.yigit@amd.com \
    --cc=Selwin.Sebastian@amd.com \
    --cc=dev@dpdk.org \
    --cc=jesna.k.e@amd.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).