patches for DPDK stable branches
 help / color / mirror / Atom feed
From: Ajay Sharma <sharmaajay@microsoft.com>
To: Ferruh Yigit <ferruh.yigit@amd.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Long Li <longli@microsoft.com>,
	"stable@dpdk.org" <stable@dpdk.org>,
	Ajay Sharma <sharmaajay@microsoft.com>
Subject: EXTERNAL] [PATCH ] Add checks for the port capabilties
Date: Fri, 26 May 2023 00:19:59 +0000	[thread overview]
Message-ID: <BY5PR21MB1394525A4A5612F8DB41F23ED647A@BY5PR21MB1394.namprd21.prod.outlook.com> (raw)
In-Reply-To: <1683336767-19526-1-git-send-email-longli@linuxonhyperv.com>

  From: Ajay Sharma <sharmaajay@microsoft.com>
  Date: Mon, 22 May 2023 20:24:39 -0700
  Subject: [PATCH] Add checks for the port capabilties
 
  Add checks to the values retrieved from the firmware to prevent
  overflow.
 
  Signed-off-by: Ajay Sharma <sharmaajay@microsoft.com>
  ---
   drivers/net/mana/mana.c | 18 ++++++++++--------
   1 file changed, 10 insertions(+), 8 deletions(-)
 
  diff --git a/drivers/net/mana/mana.c b/drivers/net/mana/mana.c
  index 7630118d4f..3a7e302c86 100644
  --- a/drivers/net/mana/mana.c
  +++ b/drivers/net/mana/mana.c
  @@ -292,8 +292,9 @@ mana_dev_info_get(struct rte_eth_dev *dev,
          dev_info->min_rx_bufsize = MIN_RX_BUF_SIZE;
          dev_info->max_rx_pktlen = MAX_FRAME_SIZE;
 
  -       dev_info->max_rx_queues = priv->max_rx_queues;
  -       dev_info->max_tx_queues = priv->max_tx_queues;
  +       dev_info->max_rx_queues = RTE_MIN(priv->max_rx_queues, USHRT_MAX);
  +       dev_info->max_tx_queues = RTE_MIN(priv->max_tx_queues, USHRT_MAX);
  +
 
          dev_info->max_mac_addrs = MANA_MAX_MAC_ADDR;
          dev_info->max_hash_mac_addrs = 0;
  @@ -334,16 +335,17 @@ mana_dev_info_get(struct rte_eth_dev *dev,
 
          /* Buffer limits */
          dev_info->rx_desc_lim.nb_min = MIN_BUFFERS_PER_QUEUE;
  -       dev_info->rx_desc_lim.nb_max = priv->max_rx_desc;
  +       dev_info->rx_desc_lim.nb_max = RTE_MIN(priv->max_rx_desc, USHRT_MAX);
          dev_info->rx_desc_lim.nb_align = MIN_BUFFERS_PER_QUEUE;
  -       dev_info->rx_desc_lim.nb_seg_max = priv->max_recv_sge;
  -       dev_info->rx_desc_lim.nb_mtu_seg_max = priv->max_recv_sge;
  +       dev_info->rx_desc_lim.nb_seg_max = RTE_MIN(priv->max_recv_sge, USHRT_MAX);
  +       dev_info->rx_desc_lim.nb_mtu_seg_max = RTE_MIN(priv->max_recv_sge, USHRT_MAX);
  +
 
          dev_info->tx_desc_lim.nb_min = MIN_BUFFERS_PER_QUEUE;
  -       dev_info->tx_desc_lim.nb_max = priv->max_tx_desc;
  +       dev_info->tx_desc_lim.nb_max = RTE_MIN(priv->max_tx_desc, USHRT_MAX);
          dev_info->tx_desc_lim.nb_align = MIN_BUFFERS_PER_QUEUE;
  -       dev_info->tx_desc_lim.nb_seg_max = priv->max_send_sge;
  -       dev_info->rx_desc_lim.nb_mtu_seg_max = priv->max_recv_sge;
  +       dev_info->tx_desc_lim.nb_seg_max = RTE_MIN(priv->max_send_sge, USHRT_MAX);
  +       dev_info->rx_desc_lim.nb_mtu_seg_max = RTE_MIN(priv->max_recv_sge, USHRT_MAX);
 
          /* Speed */
          dev_info->speed_capa = RTE_ETH_LINK_SPEED_100G;
  --
  2.25.1
 56

  parent reply	other threads:[~2023-05-26  0:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28  3:36 [PATCH] net/mana: suppress TX CQE generation whenever possible longli
2023-05-06  1:32 ` [PATCH v2] " longli
2023-05-19 16:34   ` Ferruh Yigit
2023-05-19 16:40   ` Ferruh Yigit
2023-05-26  0:19   ` Ajay Sharma [this message]
2023-05-26  3:30     ` EXTERNAL] [PATCH ] Add checks for the port capabilties Stephen Hemminger
2023-05-29  1:41       ` [EXTERNAL] " Ajay Sharma

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=BY5PR21MB1394525A4A5612F8DB41F23ED647A@BY5PR21MB1394.namprd21.prod.outlook.com \
    --to=sharmaajay@microsoft.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@amd.com \
    --cc=longli@microsoft.com \
    --cc=stable@dpdk.org \
    /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).