From: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, kirill.rybalchenko@intel.com,
andrey.chilikin@intel.com, beilei.xing@intel.com,
jingjing.wu@intel.com
Subject: [dpdk-dev] [PATCH v2] net/i40e: fix multiple DDP packages should not be allowed
Date: Tue, 30 Jan 2018 18:09:57 +0000 [thread overview]
Message-ID: <1517335797-84501-1-git-send-email-kirill.rybalchenko@intel.com> (raw)
Should be not possible to load conflicting DDP profiles.
Only DDP profiles of the same group (not 0) can be loaded
together;
If DDP profile group is 0, it is exclusive, i.e. it cannot
be loaded with any other DDP profile;
If DDP profile groups are different - these profiles cannot
be loaded together;
Fixes: b319712f53c8 ("net/i40e: extended list of operations for DDP processing")
Signed-off-by: Kirill Rybalchenko <kirill.rybalchenko@intel.com>
---
drivers/net/i40e/rte_pmd_i40e.c | 26 ++++++++++++++++++++++++--
1 file changed, 24 insertions(+), 2 deletions(-)
diff --git a/drivers/net/i40e/rte_pmd_i40e.c b/drivers/net/i40e/rte_pmd_i40e.c
index 5436db4..be37912 100644
--- a/drivers/net/i40e/rte_pmd_i40e.c
+++ b/drivers/net/i40e/rte_pmd_i40e.c
@@ -1496,6 +1496,7 @@ i40e_check_profile_info(uint16_t port, uint8_t *profile_info_sec)
struct rte_pmd_i40e_profile_info *pinfo, *p;
uint32_t i;
int ret;
+ static const int pgroup = 0x00ff0000;
buff = rte_zmalloc("pinfo_list",
(I40E_PROFILE_INFO_SIZE * I40E_MAX_PROFILE_NUM + 4),
@@ -1525,6 +1526,22 @@ i40e_check_profile_info(uint16_t port, uint8_t *profile_info_sec)
return 1;
}
}
+ for (i = 0; i < p_list->p_count; i++) {
+ p = &p_list->p_info[i];
+ if ((p->track_id & pgroup) == 0) {
+ PMD_DRV_LOG(INFO, "Profile of the grpoup 0 exists.");
+ rte_free(buff);
+ return 2;
+ }
+ }
+ for (i = 0; i < p_list->p_count; i++) {
+ p = &p_list->p_info[i];
+ if ((pinfo->track_id & pgroup) != (p->track_id & pgroup)) {
+ PMD_DRV_LOG(INFO, "Profile of different group exists.");
+ rte_free(buff);
+ return 3;
+ }
+ }
rte_free(buff);
return 0;
@@ -1628,12 +1645,17 @@ rte_pmd_i40e_process_ddp_package(uint16_t port, uint8_t *buff,
if (op == RTE_PMD_I40E_PKG_OP_WR_ADD) {
if (is_exist) {
- PMD_DRV_LOG(ERR, "Profile already exists.");
+ if (is_exist == 1)
+ PMD_DRV_LOG(ERR, "Profile already exists.");
+ else if (is_exist == 2)
+ PMD_DRV_LOG(ERR, "Profile of group 0 already exists.");
+ else if (is_exist == 3)
+ PMD_DRV_LOG(ERR, "Profile of different group already exists");
rte_free(profile_info_sec);
return -EEXIST;
}
} else if (op == RTE_PMD_I40E_PKG_OP_WR_DEL) {
- if (!is_exist) {
+ if (is_exist != 1) {
PMD_DRV_LOG(ERR, "Profile does not exist.");
rte_free(profile_info_sec);
return -EACCES;
--
2.5.5
next reply other threads:[~2018-01-30 18:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-30 18:09 Kirill Rybalchenko [this message]
2018-02-01 12:43 ` [dpdk-dev] [PATCH v3] " Kirill Rybalchenko
2018-02-01 13:27 ` Chilikin, Andrey
2018-02-05 10:41 ` Xing, Beilei
2018-02-05 13:58 ` Rybalchenko, Kirill
2018-02-06 2:26 ` Xing, Beilei
2018-02-06 2:27 ` Xing, Beilei
2018-02-06 15:17 ` Zhang, Helin
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=1517335797-84501-1-git-send-email-kirill.rybalchenko@intel.com \
--to=kirill.rybalchenko@intel.com \
--cc=andrey.chilikin@intel.com \
--cc=beilei.xing@intel.com \
--cc=dev@dpdk.org \
--cc=jingjing.wu@intel.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).