From: Qi Zhang <qi.z.zhang@intel.com>
To: wenzhuo.lu@intel.com, qiming.yang@intel.com
Cc: paul.m.stillwell.jr@intel.com, dev@dpdk.org,
brian.johnson@intel.com, helin.zhang@intel.com,
fred.zhang@intel.com, Qi Zhang <qi.z.zhang@intel.com>
Subject: [dpdk-dev] [RFC] net/ice: enable package download and RSS
Date: Tue, 15 Jan 2019 21:30:41 +0800 [thread overview]
Message-ID: <20190115133041.17556-1-qi.z.zhang@intel.com> (raw)
This is RFC for customer early eveluation.
It depends on below patch set
http://patchwork.dpdk.org/project/dpdk/list/?series=3189
package download mechanism is hard coded as:
A file named "ice_os_default.pkg" at current directory will be downloaded
by driver during init stage.
Also RSS is enable for UPD/TCP/SCTP+IPV4/IPV6 flows.
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
---
drivers/net/ice/ice_ethdev.c | 98 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 98 insertions(+)
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index b145d9c64..3898be5ff 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -2,9 +2,15 @@
* Copyright(c) 2018 Intel Corporation
*/
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <unistd.h>
+
#include <rte_ethdev_pci.h>
#include "base/ice_sched.h"
+#include "base/ice_flow.h"
#include "ice_ethdev.h"
#include "ice_rxtx.h"
@@ -1251,6 +1257,63 @@ ice_pf_setup(struct ice_pf *pf)
return 0;
}
+static int ice_load_pkg(struct ice_pf *pf)
+{
+ struct ice_hw *hw = ICE_PF_TO_HW(pf);
+ int err;
+ uint8_t *buf;
+ int buf_len;
+ FILE *file;
+ struct stat fstat;
+
+ file = fopen("ice_os_default.pkg","rb");
+ if (file == NULL) {
+ PMD_INIT_LOG(ERR, "failed to open file");
+ return 0;
+ }
+
+ err = stat("ice_os_default.pkg", &fstat);
+ if (err) {
+ PMD_INIT_LOG(ERR, "failed to get file stats");
+ fclose(file);
+ return 0;
+ }
+
+ buf_len = fstat.st_size;
+ printf("buf_len = %d\n", buf_len);
+ buf = rte_malloc(NULL, buf_len, 0);
+
+ if (buf == NULL) {
+ PMD_INIT_LOG(ERR, "failed to allocate buf for package");
+ fclose(file);
+ return 0;
+ }
+
+ err = fread(buf, buf_len, 1, file);
+ if (err != 1) {
+ PMD_INIT_LOG(ERR, "failed to read package data");
+ fclose(file);
+ return 0;
+ }
+
+ fclose(file);
+
+ err = ice_copy_and_init_pkg(hw, buf, buf_len);
+ if (err) {
+ PMD_INIT_LOG(ERR, "ice_copy_and_init_hw failed: %d\n",
+ err);
+ return err;
+ }
+
+ err = ice_init_hw_tbls(hw);
+ if (err) {
+ PMD_INIT_LOG(ERR, "ice_init_hw_tbls failed: %d\n", err);
+ return err;
+ }
+
+ return 0;
+}
+
static int
ice_dev_init(struct rte_eth_dev *dev)
{
@@ -1314,6 +1377,11 @@ ice_dev_init(struct rte_eth_dev *dev)
goto err_pf_setup;
}
+ ret = ice_load_pkg(pf);
+ if (ret) {
+ PMD_INIT_LOG(ERR, "Failed to load default OS package");
+ }
+
vsi = pf->main_vsi;
/* Disable double vlan by default */
@@ -1548,6 +1616,36 @@ static int ice_init_rss(struct ice_pf *pf)
if (ret)
return -EINVAL;
+ ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV4,
+ ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV4);
+ if (ret)
+ PMD_DRV_LOG(ERR, "%s TCP_IPV4 rss flow fail %d",__func__, ret);
+
+ ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV4,
+ ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV4);
+ if (ret)
+ PMD_DRV_LOG(ERR, "%s UDP_IPV4 rss flow fail %d",__func__, ret);
+
+ ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_SCTP_IPV4,
+ ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV4);
+ if (ret)
+ PMD_DRV_LOG(ERR, "%s SCTP_IPV4 rss flow fail %d",__func__, ret);
+
+ ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_TCP_IPV6,
+ ICE_FLOW_SEG_HDR_TCP | ICE_FLOW_SEG_HDR_IPV6);
+ if (ret)
+ PMD_DRV_LOG(ERR, "%s TCP_IPV6 rss flow fail %d",__func__, ret);
+
+ ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_UDP_IPV6,
+ ICE_FLOW_SEG_HDR_UDP | ICE_FLOW_SEG_HDR_IPV6);
+ if (ret)
+ PMD_DRV_LOG(ERR, "%s UDP_IPV6 flow fail %d",__func__, ret);
+
+ ret = ice_add_rss_cfg(hw, vsi->idx, ICE_HASH_SCTP_IPV6,
+ ICE_FLOW_SEG_HDR_SCTP | ICE_FLOW_SEG_HDR_IPV6);
+ if (ret)
+ PMD_DRV_LOG(ERR, "%s SCTP_IPV6 rss flow fail %d",__func__, ret);
+
return 0;
}
--
2.13.6
reply other threads:[~2019-01-15 13:29 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20190115133041.17556-1-qi.z.zhang@intel.com \
--to=qi.z.zhang@intel.com \
--cc=brian.johnson@intel.com \
--cc=dev@dpdk.org \
--cc=fred.zhang@intel.com \
--cc=helin.zhang@intel.com \
--cc=paul.m.stillwell.jr@intel.com \
--cc=qiming.yang@intel.com \
--cc=wenzhuo.lu@intel.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).