Add 3 new features: 1. Add the get_rxfh_indir_size in ethtool_ops structure 2. Support to configure DMA atrribute thru firmware 3. Clear the flag of CSUM and TSO when VXLAN is not supported
Yanling Song (3): net:spnic: Add the get_rxfh_indir_size in ethtool_ops structure. net:spnic:Support to configure DMA atrribute thru firmware. net:spnic:add CSUM and TSO function execute condition
.../ramaxel/spnic/hw/sphw_comm_msg_intf.h | 2 +- .../ethernet/ramaxel/spnic/hw/sphw_hw_comm.c | 27 ++++++ .../ethernet/ramaxel/spnic/hw/sphw_hw_comm.h | 3 + .../ethernet/ramaxel/spnic/hw/sphw_hwdev.c | 82 ++++--------------- .../ethernet/ramaxel/spnic/spnic_ethtool.c | 2 + .../net/ethernet/ramaxel/spnic/spnic_main.c | 7 +- .../net/ethernet/ramaxel/spnic/spnic_rss.c | 5 ++ .../net/ethernet/ramaxel/spnic/spnic_rss.h | 2 + 8 files changed, 60 insertions(+), 70 deletions(-)
Ramaxel inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4J0GH CVE: NA
1.Solve the problem that the indirection table cannot be obtained by ethtool - x ethx command. 2.Solve the system oops problem caused by ethtool - x ethx default command.
Signed-off-by: Yanling Song songyl@ramaxel.com --- drivers/net/ethernet/ramaxel/spnic/spnic_ethtool.c | 2 ++ drivers/net/ethernet/ramaxel/spnic/spnic_rss.c | 5 +++++ drivers/net/ethernet/ramaxel/spnic/spnic_rss.h | 2 ++ 3 files changed, 9 insertions(+)
diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_ethtool.c b/drivers/net/ethernet/ramaxel/spnic/spnic_ethtool.c index 3f6f69b4cb34..dc49395c47d5 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_ethtool.c +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_ethtool.c @@ -939,6 +939,7 @@ static const struct ethtool_ops spnic_ethtool_ops = { .get_module_info = spnic_get_module_info, .get_module_eeprom = spnic_get_module_eeprom,
+ .get_rxfh_indir_size = spnic_get_rxfh_indir_size, .get_rxfh_key_size = spnic_get_rxfh_key_size, .get_rxfh = spnic_get_rxfh, .set_rxfh = spnic_set_rxfh, @@ -972,6 +973,7 @@ static const struct ethtool_ops spnicvf_ethtool_ops = { .get_channels = spnic_get_channels, .set_channels = spnic_set_channels,
+ .get_rxfh_indir_size = spnic_get_rxfh_indir_size, .get_rxfh_key_size = spnic_get_rxfh_key_size, .get_rxfh = spnic_get_rxfh, .set_rxfh = spnic_set_rxfh, diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_rss.c b/drivers/net/ethernet/ramaxel/spnic/spnic_rss.c index a0dcc1519262..86f6f92f669b 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_rss.c +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_rss.c @@ -681,6 +681,11 @@ static int set_rss_rxfh(struct net_device *netdev, const u32 *indir, const u8 *k return 0; }
+u32 spnic_get_rxfh_indir_size(struct net_device *netdev) +{ + return SPNIC_RSS_INDIR_SIZE; +} + u32 spnic_get_rxfh_key_size(struct net_device *netdev) { return SPNIC_RSS_KEY_SIZE; diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_rss.h b/drivers/net/ethernet/ramaxel/spnic/spnic_rss.h index 15c930a271be..e64a4dcf39dd 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_rss.h +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_rss.h @@ -39,6 +39,8 @@ void spnic_get_channels(struct net_device *netdev, struct ethtool_channels *chan
int spnic_set_channels(struct net_device *netdev, struct ethtool_channels *channels);
+u32 spnic_get_rxfh_indir_size(struct net_device *netdev); + u32 spnic_get_rxfh_key_size(struct net_device *netdev);
int spnic_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc);
Reviewed-by:Xu Yunxuyun@ramaxel.com
On Fri, 19 Nov 2021 17:46:38 +0800 Yanling Song songyl@ramaxel.com wrote:
Ramaxel inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4J0GH CVE: NA
1.Solve the problem that the indirection table cannot be obtained by ethtool - x ethx command. 2.Solve the system oops problem caused by ethtool - x ethx default command.
Signed-off-by: Yanling Song songyl@ramaxel.com
drivers/net/ethernet/ramaxel/spnic/spnic_ethtool.c | 2 ++ drivers/net/ethernet/ramaxel/spnic/spnic_rss.c | 5 +++++ drivers/net/ethernet/ramaxel/spnic/spnic_rss.h | 2 ++ 3 files changed, 9 insertions(+)
diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_ethtool.c b/drivers/net/ethernet/ramaxel/spnic/spnic_ethtool.c index 3f6f69b4cb34..dc49395c47d5 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_ethtool.c +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_ethtool.c @@ -939,6 +939,7 @@ static const struct ethtool_ops spnic_ethtool_ops = { .get_module_info = spnic_get_module_info, .get_module_eeprom = spnic_get_module_eeprom,
- .get_rxfh_indir_size = spnic_get_rxfh_indir_size, .get_rxfh_key_size = spnic_get_rxfh_key_size, .get_rxfh = spnic_get_rxfh, .set_rxfh = spnic_set_rxfh,
@@ -972,6 +973,7 @@ static const struct ethtool_ops spnicvf_ethtool_ops = { .get_channels = spnic_get_channels, .set_channels = spnic_set_channels,
- .get_rxfh_indir_size = spnic_get_rxfh_indir_size, .get_rxfh_key_size = spnic_get_rxfh_key_size, .get_rxfh = spnic_get_rxfh, .set_rxfh = spnic_set_rxfh,
diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_rss.c b/drivers/net/ethernet/ramaxel/spnic/spnic_rss.c index a0dcc1519262..86f6f92f669b 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_rss.c +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_rss.c @@ -681,6 +681,11 @@ static int set_rss_rxfh(struct net_device *netdev, const u32 *indir, const u8 *k return 0; }
+u32 spnic_get_rxfh_indir_size(struct net_device *netdev) +{
- return SPNIC_RSS_INDIR_SIZE;
+}
u32 spnic_get_rxfh_key_size(struct net_device *netdev) { return SPNIC_RSS_KEY_SIZE; diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_rss.h b/drivers/net/ethernet/ramaxel/spnic/spnic_rss.h index 15c930a271be..e64a4dcf39dd 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_rss.h +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_rss.h @@ -39,6 +39,8 @@ void spnic_get_channels(struct net_device *netdev, struct ethtool_channels *chan int spnic_set_channels(struct net_device *netdev, struct ethtool_channels *channels); +u32 spnic_get_rxfh_indir_size(struct net_device *netdev);
u32 spnic_get_rxfh_key_size(struct net_device *netdev);
int spnic_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key, u8 *hfunc);
Ramaxel inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4J0GH CVE: NA
Support to configure DMA attribute thru firmware
Signed-off-by: Yanling Song songyl@ramaxel.com --- .../ramaxel/spnic/hw/sphw_comm_msg_intf.h | 2 +- .../ethernet/ramaxel/spnic/hw/sphw_hw_comm.c | 27 ++++++ .../ethernet/ramaxel/spnic/hw/sphw_hw_comm.h | 3 + .../ethernet/ramaxel/spnic/hw/sphw_hwdev.c | 82 ++++--------------- 4 files changed, 46 insertions(+), 68 deletions(-)
diff --git a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_comm_msg_intf.h b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_comm_msg_intf.h index a1abbd054d2a..fd12a47e5bb5 100644 --- a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_comm_msg_intf.h +++ b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_comm_msg_intf.h @@ -135,7 +135,7 @@ struct comm_cmd_msix_config { u8 rsvd2[5]; };
-struct comm_cmd_dma_attr { +struct comm_cmd_dma_attr_config { struct mgmt_msg_head head;
u16 func_id; diff --git a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.c b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.c index 1629d1e480e2..b868bf8ed1cb 100644 --- a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.c +++ b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.c @@ -403,6 +403,33 @@ int sphw_set_ceq_ctrl_reg(struct sphw_hwdev *hwdev, u16 q_id, u32 ctrl0, u32 ctr return 0; }
+int sphw_set_dma_attr_tbl(struct sphw_hwdev *hwdev, u8 entry_idx, u8 st, u8 at, u8 ph, + u8 no_snooping, u8 tph_en) +{ + struct comm_cmd_dma_attr_config dma_attr; + u16 out_size = sizeof(dma_attr); + int err; + + memset(&dma_attr, 0, sizeof(dma_attr)); + dma_attr.func_id = sphw_global_func_id(hwdev); + dma_attr.entry_idx = entry_idx; + dma_attr.st = st; + dma_attr.at = at; + dma_attr.ph = ph; + dma_attr.no_snooping = no_snooping; + dma_attr.tph_en = tph_en; + + err = comm_msg_to_mgmt_sync(hwdev, COMM_MGMT_CMD_SET_DMA_ATTR, &dma_attr, sizeof(dma_attr), + &dma_attr, &out_size); + if (err || !out_size || dma_attr.head.status) { + sdk_err(hwdev->dev_hdl, "Failed to set dma_attr, err: %d, status: 0x%x, out_size: 0x%x\n", + err, dma_attr.head.status, out_size); + return -EIO; + } + + return 0; +} + int sphw_set_bdf_ctxt(void *hwdev, u8 bus, u8 device, u8 function) { struct comm_cmd_bdf_info bdf_info; diff --git a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.h b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.h index da37d3ed20ad..4e0cf2dfb21e 100644 --- a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.h +++ b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.h @@ -34,6 +34,9 @@ int sphw_ppf_ext_db_deinit(void *dev);
int sphw_set_ceq_ctrl_reg(struct sphw_hwdev *hwdev, u16 q_id, u32 ctrl0, u32 ctrl1);
+int sphw_set_dma_attr_tbl(struct sphw_hwdev *hwdevm, u8 entry_idx, u8 st, u8 at, u8 ph, + u8 no_snooping, u8 tph_en); + int sphw_get_comm_features(void *hwdev, u64 *s_feature, u16 size); int sphw_set_comm_features(void *hwdev, u64 *s_feature, u16 size);
diff --git a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hwdev.c b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hwdev.c index f58b0325bf04..c88799bcda98 100644 --- a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hwdev.c +++ b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hwdev.c @@ -366,89 +366,37 @@ void sphw_detect_hw_present(void *hwdev) }
/** - * set_pf_dma_attr_entry - set the dma attributes for entry - * @hwif: the hardware interface of a pci function device - * @entry_idx: the entry index in the dma table - * @st: PCIE TLP steering tag - * @at: PCIE TLP AT field - * @ph: PCIE TLP Processing Hint field - * @no_snooping: PCIE TLP No snooping - * @tph_en: PCIE TLP Processing Hint Enable + * dma_attr_table_init - initialize the default dma attributes + * @hwdev: the pointer to hw device **/ -static void set_pf_dma_attr_entry(struct sphw_hwdev *hwdev, u32 entry_idx, - u8 st, u8 at, u8 ph, - enum sphw_pcie_nosnoop no_snooping, - enum sphw_pcie_tph tph_en) +static int dma_attr_table_init(struct sphw_hwdev *hwdev) { - u32 addr, val, dma_attr_entry; + u32 addr, val, dst_attr;
/* Use indirect access should set entry_idx first*/ addr = SPHW_CSR_DMA_ATTR_INDIR_IDX_ADDR; val = sphw_hwif_read_reg(hwdev->hwif, addr); val = SPHW_DMA_ATTR_INDIR_IDX_CLEAR(val, IDX);
- entry_idx = SPHW_DMA_ATTR_INDIR_IDX_SET(entry_idx, IDX); - - val |= entry_idx; + val |= SPHW_DMA_ATTR_INDIR_IDX_SET(PCIE_MSIX_ATTR_ENTRY, IDX);
sphw_hwif_write_reg(hwdev->hwif, addr, val);
wmb(); /* write index before config */
addr = SPHW_CSR_DMA_ATTR_TBL_ADDR; - val = sphw_hwif_read_reg(hwdev->hwif, addr); - val = SPHW_DMA_ATTR_ENTRY_CLEAR(val, ST) & - SPHW_DMA_ATTR_ENTRY_CLEAR(val, AT) & - SPHW_DMA_ATTR_ENTRY_CLEAR(val, PH) & - SPHW_DMA_ATTR_ENTRY_CLEAR(val, NO_SNOOPING) & - SPHW_DMA_ATTR_ENTRY_CLEAR(val, TPH_EN); - - dma_attr_entry = SPHW_DMA_ATTR_ENTRY_SET(st, ST) | - SPHW_DMA_ATTR_ENTRY_SET(at, AT) | - SPHW_DMA_ATTR_ENTRY_SET(ph, PH) | - SPHW_DMA_ATTR_ENTRY_SET(no_snooping, NO_SNOOPING) | - SPHW_DMA_ATTR_ENTRY_SET(tph_en, TPH_EN); - - val |= dma_attr_entry; - sphw_hwif_write_reg(hwdev->hwif, addr, val); -} - -static int set_vf_dma_attr_entry(struct sphw_hwdev *hwdev, u8 entry_idx, - u8 st, u8 at, u8 ph, - enum sphw_pcie_nosnoop no_snooping, - enum sphw_pcie_tph tph_en) -{ - /* SPHW_MGMT_CMD_DMA_ATTR_SET */ - /*to do vf set dma attr by mpu*/ - return 0; -} - -/** - * dma_attr_table_init - initialize the default dma attributes - * @hwif: the hardware interface of a pci function device - **/ -static int dma_attr_table_init(struct sphw_hwdev *hwdev) -{ - int err = 0; - - /* TODO: check if set pf dma attr through uP, the same as vf */ - if (SPHW_IS_VF(hwdev)) - err = set_vf_dma_attr_entry(hwdev, PCIE_MSIX_ATTR_ENTRY, - SPHW_PCIE_ST_DISABLE, - SPHW_PCIE_AT_DISABLE, - SPHW_PCIE_PH_DISABLE, - SPHW_PCIE_SNOOP, - SPHW_PCIE_TPH_DISABLE); - else - set_pf_dma_attr_entry(hwdev, PCIE_MSIX_ATTR_ENTRY, - SPHW_PCIE_ST_DISABLE, - SPHW_PCIE_AT_DISABLE, - SPHW_PCIE_PH_DISABLE, - SPHW_PCIE_SNOOP, - SPHW_PCIE_TPH_DISABLE); + dst_attr = SPHW_DMA_ATTR_ENTRY_SET(SPHW_PCIE_ST_DISABLE, ST) | + SPHW_DMA_ATTR_ENTRY_SET(SPHW_PCIE_AT_DISABLE, AT) | + SPHW_DMA_ATTR_ENTRY_SET(SPHW_PCIE_PH_DISABLE, PH) | + SPHW_DMA_ATTR_ENTRY_SET(SPHW_PCIE_SNOOP, NO_SNOOPING) | + SPHW_DMA_ATTR_ENTRY_SET(SPHW_PCIE_TPH_DISABLE, TPH_EN); + if (dst_attr == val) + return 0;
- return err; + return sphw_set_dma_attr_tbl(hwdev, PCIE_MSIX_ATTR_ENTRY, SPHW_PCIE_ST_DISABLE, + SPHW_PCIE_AT_DISABLE, SPHW_PCIE_PH_DISABLE, + SPHW_PCIE_SNOOP, SPHW_PCIE_TPH_DISABLE); }
static int init_aeqs_msix_attr(struct sphw_hwdev *hwdev)
Reviewed-by:Xu Yunxuyun@ramaxel.com
On Fri, 19 Nov 2021 17:46:39 +0800 Yanling Song songyl@ramaxel.com wrote:
Ramaxel inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4J0GH CVE: NA
Support to configure DMA attribute thru firmware
Signed-off-by: Yanling Song songyl@ramaxel.com
.../ramaxel/spnic/hw/sphw_comm_msg_intf.h | 2 +- .../ethernet/ramaxel/spnic/hw/sphw_hw_comm.c | 27 ++++++ .../ethernet/ramaxel/spnic/hw/sphw_hw_comm.h | 3 + .../ethernet/ramaxel/spnic/hw/sphw_hwdev.c | 82 ++++--------------- 4 files changed, 46 insertions(+), 68 deletions(-)
diff --git a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_comm_msg_intf.h b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_comm_msg_intf.h index a1abbd054d2a..fd12a47e5bb5 100644 --- a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_comm_msg_intf.h +++ b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_comm_msg_intf.h @@ -135,7 +135,7 @@ struct comm_cmd_msix_config { u8 rsvd2[5]; };
-struct comm_cmd_dma_attr { +struct comm_cmd_dma_attr_config { struct mgmt_msg_head head;
u16 func_id; diff --git a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.c b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.c index 1629d1e480e2..b868bf8ed1cb 100644 --- a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.c +++ b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.c @@ -403,6 +403,33 @@ int sphw_set_ceq_ctrl_reg(struct sphw_hwdev *hwdev, u16 q_id, u32 ctrl0, u32 ctr return 0; }
+int sphw_set_dma_attr_tbl(struct sphw_hwdev *hwdev, u8 entry_idx, u8 st, u8 at, u8 ph,
u8 no_snooping, u8 tph_en)
+{
- struct comm_cmd_dma_attr_config dma_attr;
- u16 out_size = sizeof(dma_attr);
- int err;
- memset(&dma_attr, 0, sizeof(dma_attr));
- dma_attr.func_id = sphw_global_func_id(hwdev);
- dma_attr.entry_idx = entry_idx;
- dma_attr.st = st;
- dma_attr.at = at;
- dma_attr.ph = ph;
- dma_attr.no_snooping = no_snooping;
- dma_attr.tph_en = tph_en;
- err = comm_msg_to_mgmt_sync(hwdev,
COMM_MGMT_CMD_SET_DMA_ATTR, &dma_attr, sizeof(dma_attr),
&dma_attr, &out_size);
- if (err || !out_size || dma_attr.head.status) {
sdk_err(hwdev->dev_hdl, "Failed to set dma_attr,
err: %d, status: 0x%x, out_size: 0x%x\n",
err, dma_attr.head.status, out_size);
return -EIO;
- }
- return 0;
+}
int sphw_set_bdf_ctxt(void *hwdev, u8 bus, u8 device, u8 function) { struct comm_cmd_bdf_info bdf_info; diff --git a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.h b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.h index da37d3ed20ad..4e0cf2dfb21e 100644 --- a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.h +++ b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hw_comm.h @@ -34,6 +34,9 @@ int sphw_ppf_ext_db_deinit(void *dev); int sphw_set_ceq_ctrl_reg(struct sphw_hwdev *hwdev, u16 q_id, u32 ctrl0, u32 ctrl1); +int sphw_set_dma_attr_tbl(struct sphw_hwdev *hwdevm, u8 entry_idx, u8 st, u8 at, u8 ph,
u8 no_snooping, u8 tph_en);
int sphw_get_comm_features(void *hwdev, u64 *s_feature, u16 size); int sphw_set_comm_features(void *hwdev, u64 *s_feature, u16 size);
diff --git a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hwdev.c b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hwdev.c index f58b0325bf04..c88799bcda98 100644 --- a/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hwdev.c +++ b/drivers/net/ethernet/ramaxel/spnic/hw/sphw_hwdev.c @@ -366,89 +366,37 @@ void sphw_detect_hw_present(void *hwdev) }
/**
- set_pf_dma_attr_entry - set the dma attributes for entry
- @hwif: the hardware interface of a pci function device
- @entry_idx: the entry index in the dma table
- @st: PCIE TLP steering tag
- @at: PCIE TLP AT field
- @ph: PCIE TLP Processing Hint field
- @no_snooping: PCIE TLP No snooping
- @tph_en: PCIE TLP Processing Hint Enable
- dma_attr_table_init - initialize the default dma attributes
**/
- @hwdev: the pointer to hw device
-static void set_pf_dma_attr_entry(struct sphw_hwdev *hwdev, u32 entry_idx,
u8 st, u8 at, u8 ph,
enum sphw_pcie_nosnoop no_snooping,
enum sphw_pcie_tph tph_en)
+static int dma_attr_table_init(struct sphw_hwdev *hwdev) {
- u32 addr, val, dma_attr_entry;
u32 addr, val, dst_attr;
/* Use indirect access should set entry_idx first*/ addr = SPHW_CSR_DMA_ATTR_INDIR_IDX_ADDR; val = sphw_hwif_read_reg(hwdev->hwif, addr); val = SPHW_DMA_ATTR_INDIR_IDX_CLEAR(val, IDX);
- entry_idx = SPHW_DMA_ATTR_INDIR_IDX_SET(entry_idx, IDX);
- val |= entry_idx;
- val |= SPHW_DMA_ATTR_INDIR_IDX_SET(PCIE_MSIX_ATTR_ENTRY,
IDX); sphw_hwif_write_reg(hwdev->hwif, addr, val);
wmb(); /* write index before config */
addr = SPHW_CSR_DMA_ATTR_TBL_ADDR;
- val = sphw_hwif_read_reg(hwdev->hwif, addr);
- val = SPHW_DMA_ATTR_ENTRY_CLEAR(val, ST) &
SPHW_DMA_ATTR_ENTRY_CLEAR(val, AT) &
SPHW_DMA_ATTR_ENTRY_CLEAR(val, PH) &
SPHW_DMA_ATTR_ENTRY_CLEAR(val, NO_SNOOPING) &
SPHW_DMA_ATTR_ENTRY_CLEAR(val, TPH_EN);
- dma_attr_entry = SPHW_DMA_ATTR_ENTRY_SET(st, ST) |
SPHW_DMA_ATTR_ENTRY_SET(at, AT) |
SPHW_DMA_ATTR_ENTRY_SET(ph, PH) |
SPHW_DMA_ATTR_ENTRY_SET(no_snooping,
NO_SNOOPING) |
SPHW_DMA_ATTR_ENTRY_SET(tph_en, TPH_EN);
- val |= dma_attr_entry;
- sphw_hwif_write_reg(hwdev->hwif, addr, val);
-}
-static int set_vf_dma_attr_entry(struct sphw_hwdev *hwdev, u8 entry_idx,
u8 st, u8 at, u8 ph,
enum sphw_pcie_nosnoop no_snooping,
enum sphw_pcie_tph tph_en)
-{
- /* SPHW_MGMT_CMD_DMA_ATTR_SET */
- /*to do vf set dma attr by mpu*/
- return 0;
-}
-/**
- dma_attr_table_init - initialize the default dma attributes
- @hwif: the hardware interface of a pci function device
- **/
-static int dma_attr_table_init(struct sphw_hwdev *hwdev) -{
- int err = 0;
- /* TODO: check if set pf dma attr through uP, the same as vf
*/
- if (SPHW_IS_VF(hwdev))
err = set_vf_dma_attr_entry(hwdev,
PCIE_MSIX_ATTR_ENTRY,
SPHW_PCIE_ST_DISABLE,
SPHW_PCIE_AT_DISABLE,
SPHW_PCIE_PH_DISABLE,
SPHW_PCIE_SNOOP,
SPHW_PCIE_TPH_DISABLE);
- else
set_pf_dma_attr_entry(hwdev, PCIE_MSIX_ATTR_ENTRY,
SPHW_PCIE_ST_DISABLE,
SPHW_PCIE_AT_DISABLE,
SPHW_PCIE_PH_DISABLE,
SPHW_PCIE_SNOOP,
SPHW_PCIE_TPH_DISABLE);
- dst_attr = SPHW_DMA_ATTR_ENTRY_SET(SPHW_PCIE_ST_DISABLE,
ST) |
SPHW_DMA_ATTR_ENTRY_SET(SPHW_PCIE_AT_DISABLE,
AT) |
SPHW_DMA_ATTR_ENTRY_SET(SPHW_PCIE_PH_DISABLE,
PH) |
SPHW_DMA_ATTR_ENTRY_SET(SPHW_PCIE_SNOOP,
NO_SNOOPING) |
SPHW_DMA_ATTR_ENTRY_SET(SPHW_PCIE_TPH_DISABLE,
TPH_EN);
- if (dst_attr == val)
return 0;
- return err;
- return sphw_set_dma_attr_tbl(hwdev, PCIE_MSIX_ATTR_ENTRY,
SPHW_PCIE_ST_DISABLE,
SPHW_PCIE_AT_DISABLE,
SPHW_PCIE_PH_DISABLE,
SPHW_PCIE_SNOOP,
SPHW_PCIE_TPH_DISABLE); }
static int init_aeqs_msix_attr(struct sphw_hwdev *hwdev)
Ramaxel inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4J0GH CVE: NA
When the firmware does not support VXLAN offload, clear the flag of CSUM and TS0.
Signed-off-by: Yanling Song songyl@ramaxel.com --- drivers/net/ethernet/ramaxel/spnic/spnic_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_main.c b/drivers/net/ethernet/ramaxel/spnic/spnic_main.c index fa57a912cd5e..f09f11488042 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_main.c +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_main.c @@ -235,8 +235,11 @@ static void netdev_feature_init(struct net_device *netdev)
netdev->priv_flags |= IFF_UNICAST_FLT;
- netdev->hw_enc_features |= dft_fts | cso_fts; - netdev->hw_enc_features |= tso_fts | NETIF_F_TSO_ECN; + netdev->hw_enc_features |= dft_fts; + if (SPNIC_SUPPORT_VXLAN_OFFLOAD(nic_dev->hwdev)) { + netdev->hw_enc_features |= cso_fts; + netdev->hw_enc_features |= tso_fts | NETIF_F_TSO_ECN; + } }
static void init_intr_coal_param(struct spnic_nic_dev *nic_dev)
Reviewed-by:Xu Yunxuyun@ramaxel.com
On Fri, 19 Nov 2021 17:46:40 +0800 Yanling Song songyl@ramaxel.com wrote:
Ramaxel inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4J0GH CVE: NA
When the firmware does not support VXLAN offload, clear the flag of CSUM and TS0.
Signed-off-by: Yanling Song songyl@ramaxel.com
drivers/net/ethernet/ramaxel/spnic/spnic_main.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/ramaxel/spnic/spnic_main.c b/drivers/net/ethernet/ramaxel/spnic/spnic_main.c index fa57a912cd5e..f09f11488042 100644 --- a/drivers/net/ethernet/ramaxel/spnic/spnic_main.c +++ b/drivers/net/ethernet/ramaxel/spnic/spnic_main.c @@ -235,8 +235,11 @@ static void netdev_feature_init(struct net_device *netdev) netdev->priv_flags |= IFF_UNICAST_FLT;
- netdev->hw_enc_features |= dft_fts | cso_fts;
- netdev->hw_enc_features |= tso_fts | NETIF_F_TSO_ECN;
- netdev->hw_enc_features |= dft_fts;
- if (SPNIC_SUPPORT_VXLAN_OFFLOAD(nic_dev->hwdev)) {
netdev->hw_enc_features |= cso_fts;
netdev->hw_enc_features |= tso_fts | NETIF_F_TSO_ECN;
- }
}
static void init_intr_coal_param(struct spnic_nic_dev *nic_dev)
For this series, Acked-by: Xie XiuQi xiexiuqi@huawei.com
On 2021/11/19 17:46, Yanling Song wrote:
Add 3 new features:
- Add the get_rxfh_indir_size in ethtool_ops structure
- Support to configure DMA atrribute thru firmware
- Clear the flag of CSUM and TSO when VXLAN is not supported
Yanling Song (3): net:spnic: Add the get_rxfh_indir_size in ethtool_ops structure. net:spnic:Support to configure DMA atrribute thru firmware. net:spnic:add CSUM and TSO function execute condition
.../ramaxel/spnic/hw/sphw_comm_msg_intf.h | 2 +- .../ethernet/ramaxel/spnic/hw/sphw_hw_comm.c | 27 ++++++ .../ethernet/ramaxel/spnic/hw/sphw_hw_comm.h | 3 + .../ethernet/ramaxel/spnic/hw/sphw_hwdev.c | 82 ++++--------------- .../ethernet/ramaxel/spnic/spnic_ethtool.c | 2 + .../net/ethernet/ramaxel/spnic/spnic_main.c | 7 +- .../net/ethernet/ramaxel/spnic/spnic_rss.c | 5 ++ .../net/ethernet/ramaxel/spnic/spnic_rss.h | 2 + 8 files changed, 60 insertions(+), 70 deletions(-)