Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1282016 > unrolled thread

[PATCH V6 net-next 0/5] net:hns: Add support of Hip06 SoC to the Hislicon Network Subsystem

Started bySalil Mehta <salil.mehta@huawei.com>
First post2015-12-02 18:00 +0100
Last post2015-12-04 19:30 +0100
Articles 5 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH V6 net-next 0/5] net:hns: Add support of Hip06 SoC to the Hislicon Network Subsystem Salil Mehta <salil.mehta@huawei.com> - 2015-12-02 18:00 +0100
    [PATCH V6 net-next 3/5] net:hns: Add Hip06 "TSO(TCP Segment Offload)" support HNS Driver Salil Mehta <salil.mehta@huawei.com> - 2015-12-02 18:00 +0100
    [PATCH V6 net-next 5/5] net:hns: Add the init code to disable Hip06 "Hardware VLAN assist" Salil Mehta <salil.mehta@huawei.com> - 2015-12-02 18:00 +0100
      Re: [PATCH V6 net-next 5/5] net:hns: Add the init code to disable  Hip06 "Hardware VLAN assist" Sergei Shtylyov <sergei.shtylyov@cogentembedded.com> - 2015-12-02 20:50 +0100
        Re: [PATCH V6 net-next 5/5] net:hns: Add the init code to disable  Hip06 "Hardware VLAN assist" Salil Mehta <salil.mehta@huawei.com> - 2015-12-04 19:30 +0100

#1282016 — [PATCH V6 net-next 0/5] net:hns: Add support of Hip06 SoC to the Hislicon Network Subsystem

FromSalil Mehta <salil.mehta@huawei.com>
Date2015-12-02 18:00 +0100
Subject[PATCH V6 net-next 0/5] net:hns: Add support of Hip06 SoC to the Hislicon Network Subsystem
Message-ID<qBiV3-1mH-3@gated-at.bofh.it>
This PATCH V6 addresses the review comments provided by
David Miller over the existing use of ENABLE/DISABLE
hash defines with the code. These hash defines are doing
a similar job as implicit type bool would do. So these are
kind of duplicate and are redundant.

PATCH V5:
This PATCH addresses the review comments by Yuval Mintz
 <Yuval.Mintz@qlogic.com>. This rework of comments are basically
 related to:
 1) styling of the code,
 2) RSS default Key initiailization related code
 3) redundant code removal 

PATCH V4:
This addresses the review comment provided by 
Sergei Shtylyov. The changelog of every patch has also
been modified.

PATCH V3:
 Addresses the review comment floated by David Miller 

PATCH V2:
1) Bug Fixes and Clean-up: Internally identified
2) Addresses internal review comments by Kenneth Lee and
   by Huang Daode
3) Addresses the review comment from "Yisen.Zhuang(Zhuangyuzeng)"
4) Adds fix from Fengguang Wu for an error generated from 
   "kbuild test robot" from Intel
5) Ethtool support for TSO set option from Lisheng

PATCH V1:
Adds initial support of Hip06 SoC with below changes:  
This patch-set adds support of new Hisilicon Hip06 SoC to the existing
(already part of net-next) HNS ethernet driver for Hip05 SoC. Hip06 is
a multi-core SoC and is a derivative of Hip05 SoC with lots of new
hardware featres supported like RSS, TSO, hardware VLAN assist etc. 

The changes in the driver are mainly due to following:
 1) changes in the DMA descriptor provided by the Hip06 ethernet 
    hardware. These changes need to co-exist with already present
    Hip05 DMA descriptor and its operating functions. The decision
    to choose the correct type of DMA descriptor is taken dynamically
    depending upon the version of the hardware (i.e. V1/hip05 or
    V2/hip06, see already existing hisilicon-hns-nic.txt binding file
    for the detailed description version and naming).
 2) To support new features added to the Hip06 ethernet hardware:
    a. RSS (Receive Side Scaling)
    b. TSO (TCP Segment Offload)
    c. Hardware VLAN support (currently we are initializing hardware
       to not assist in stripping the vlan tag at hardware level.
       Proper support of this feature and ethtool would come after
       these patches have been accepted)

Kindly note that, this patchset has been based on latest net-next.

Salil Mehta (5):
  net:hns: Add support of Hip06 SoC to the Hislicon Network Subsystem
  net:hns: Add Hip06 "RSS(Receive Side Scaling)" support to HNS Driver
  net:hns: Add Hip06 "TSO(TCP Segment Offload)" support HNS Driver
  net:hns: Add support of ethtool TSO set option for Hip06 in HNS
  net:hns: Add the init code to disable Hip06 "Hardware VLAN assist"

 drivers/net/ethernet/hisilicon/hns/hnae.h          |   58 ++-
 drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c  |   98 +++-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.c  |   14 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_mac.h  |    4 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c |  213 +++++++--
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.h |   24 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_misc.c |    6 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c  |   72 ++-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h  |   32 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.c  |   76 ++-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_rcb.h  |    8 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h  |   88 +++-
 drivers/net/ethernet/hisilicon/hns/hns_enet.c      |  483 +++++++++++++++++---
 drivers/net/ethernet/hisilicon/hns/hns_enet.h      |   12 +
 drivers/net/ethernet/hisilicon/hns/hns_ethtool.c   |   95 +++-
 15 files changed, 1077 insertions(+), 206 deletions(-)

-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1282018 — [PATCH V6 net-next 3/5] net:hns: Add Hip06 "TSO(TCP Segment Offload)" support HNS Driver

FromSalil Mehta <salil.mehta@huawei.com>
Date2015-12-02 18:00 +0100
Subject[PATCH V6 net-next 3/5] net:hns: Add Hip06 "TSO(TCP Segment Offload)" support HNS Driver
Message-ID<qBiV4-1mH-19@gated-at.bofh.it>
In reply to#1282016
This patch adds the support of "TSO (TCP Segment Offload)" feature
provided by the Hip06 ethernet hardware to the HNS ethernet
driver.

Enabling this feature would help offload the TCP Segmentation
process to the Hip06 ethernet hardware. This eventually would help
in saving precious cpu cycles.

Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
Signed-off-by: lisheng <lisheng011@huawei.com>
---

PATCH V6:
- No change over previous patch.

PATCH V5:
- Minor styling change

PATCH V4/V3/V2:
- No change over the initial patch floated patch for TSO

PATCH V1:
- Initial support of TSO feature in Hip06 SoC in HNS driver
---
 drivers/net/ethernet/hisilicon/hns/hnae.h         |    1 +
 drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c |    8 ++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |    5 ++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h |    2 +-
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h |    1 +
 drivers/net/ethernet/hisilicon/hns/hns_enet.c     |   82 ++++++++++++++++++++-
 6 files changed, 95 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/hisilicon/hns/hnae.h b/drivers/net/ethernet/hisilicon/hns/hnae.h
index 76dd715..d1f3316 100644
--- a/drivers/net/ethernet/hisilicon/hns/hnae.h
+++ b/drivers/net/ethernet/hisilicon/hns/hnae.h
@@ -474,6 +474,7 @@ struct hnae_ae_ops {
 	int (*set_mac_addr)(struct hnae_handle *handle, void *p);
 	int (*set_mc_addr)(struct hnae_handle *handle, void *addr);
 	int (*set_mtu)(struct hnae_handle *handle, int new_mtu);
+	void (*set_tso_stats)(struct hnae_handle *handle, int enable);
 	void (*update_stats)(struct hnae_handle *handle,
 			     struct net_device_stats *net_stats);
 	void (*get_stats)(struct hnae_handle *handle, u64 *data);
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
index 77e1735..77c6edb 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_ae_adapt.c
@@ -277,6 +277,13 @@ static int hns_ae_set_mtu(struct hnae_handle *handle, int new_mtu)
 	return hns_mac_set_mtu(mac_cb, new_mtu);
 }
 
+static void hns_ae_set_tso_stats(struct hnae_handle *handle, int enable)
+{
+	struct hns_ppe_cb *ppe_cb = hns_get_ppe_cb(handle);
+
+	hns_ppe_set_tso_enable(ppe_cb, enable);
+}
+
 static int hns_ae_start(struct hnae_handle *handle)
 {
 	int ret;
@@ -824,6 +831,7 @@ static struct hnae_ae_ops hns_dsaf_ops = {
 	.set_mc_addr = hns_ae_set_multicast_one,
 	.set_mtu = hns_ae_set_mtu,
 	.update_stats = hns_ae_update_stats,
+	.set_tso_stats = hns_ae_set_tso_stats,
 	.get_stats = hns_ae_get_stats,
 	.get_strings = hns_ae_get_strings,
 	.get_sset_count = hns_ae_get_sset_count,
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
index 7af0858..b5e4c44 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
@@ -19,6 +19,11 @@
 
 #include "hns_dsaf_ppe.h"
 
+void hns_ppe_set_tso_enable(struct hns_ppe_cb *ppe_cb, u32 value)
+{
+	dsaf_set_dev_bit(ppe_cb, PPEV2_CFG_TSO_EN_REG, 0, !!value);
+}
+
 void hns_ppe_set_rss_key(struct hns_ppe_cb *ppe_cb,
 			 const u32 rss_key[HNS_PPEV2_RSS_KEY_NUM])
 {
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h
index dac8532..0f5cb69 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.h
@@ -113,7 +113,7 @@ void hns_ppe_get_regs(struct hns_ppe_cb *ppe_cb, void *data);
 
 void hns_ppe_get_strings(struct hns_ppe_cb *ppe_cb, int stringset, u8 *data);
 void hns_ppe_get_stats(struct hns_ppe_cb *ppe_cb, u64 *data);
-
+void hns_ppe_set_tso_enable(struct hns_ppe_cb *ppe_cb, u32 value);
 void hns_ppe_set_rss_key(struct hns_ppe_cb *ppe_cb,
 			 const u32 rss_key[HNS_PPEV2_RSS_KEY_NUM]);
 void hns_ppe_set_indir_table(struct hns_ppe_cb *ppe_cb,
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
index b070d57..98c163e 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
@@ -317,6 +317,7 @@
 #define PPE_CFG_TAG_GEN_REG			0x90
 #define PPE_CFG_PARSE_TAG_REG			0x94
 #define PPE_CFG_PRO_CHECK_EN_REG		0x98
+#define PPEV2_CFG_TSO_EN_REG                    0xA0
 #define PPE_INTEN_REG				0x100
 #define PPE_RINT_REG				0x104
 #define PPE_INTSTS_REG				0x108
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_enet.c b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
index 0ca7fa9..c025a71 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_enet.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_enet.c
@@ -223,6 +223,71 @@ static int hns_nic_maybe_stop_tx(
 	return 0;
 }
 
+static int hns_nic_maybe_stop_tso(
+	struct sk_buff **out_skb, int *bnum, struct hnae_ring *ring)
+{
+	int i;
+	int size;
+	int buf_num;
+	int frag_num;
+	struct sk_buff *skb = *out_skb;
+	struct sk_buff *new_skb = NULL;
+	struct skb_frag_struct *frag;
+
+	size = skb_headlen(skb);
+	buf_num = (size + BD_MAX_SEND_SIZE - 1) / BD_MAX_SEND_SIZE;
+
+	frag_num = skb_shinfo(skb)->nr_frags;
+	for (i = 0; i < frag_num; i++) {
+		frag = &skb_shinfo(skb)->frags[i];
+		size = skb_frag_size(frag);
+		buf_num += (size + BD_MAX_SEND_SIZE - 1) / BD_MAX_SEND_SIZE;
+	}
+
+	if (unlikely(buf_num > ring->max_desc_num_per_pkt)) {
+		buf_num = (skb->len + BD_MAX_SEND_SIZE - 1) / BD_MAX_SEND_SIZE;
+		if (ring_space(ring) < buf_num)
+			return -EBUSY;
+		/* manual split the send packet */
+		new_skb = skb_copy(skb, GFP_ATOMIC);
+		if (!new_skb)
+			return -ENOMEM;
+		dev_kfree_skb_any(skb);
+		*out_skb = new_skb;
+
+	} else if (ring_space(ring) < buf_num) {
+		return -EBUSY;
+	}
+
+	*bnum = buf_num;
+	return 0;
+}
+
+static void fill_tso_desc(struct hnae_ring *ring, void *priv,
+			  int size, dma_addr_t dma, int frag_end,
+			  int buf_num, enum hns_desc_type type, int mtu)
+{
+	int frag_buf_num;
+	int sizeoflast;
+	int k;
+
+	frag_buf_num = (size + BD_MAX_SEND_SIZE - 1) / BD_MAX_SEND_SIZE;
+	sizeoflast = size % BD_MAX_SEND_SIZE;
+	sizeoflast = sizeoflast ? sizeoflast : BD_MAX_SEND_SIZE;
+
+	/* when the frag size is bigger than hardware, split this frag */
+	for (k = 0; k < frag_buf_num; k++)
+		fill_v2_desc(ring, priv,
+			     (k == frag_buf_num - 1) ?
+					sizeoflast : BD_MAX_SEND_SIZE,
+			     dma + BD_MAX_SEND_SIZE * k,
+			     frag_end && (k == frag_buf_num - 1) ? 1 : 0,
+			     buf_num,
+			     (type == DESC_TYPE_SKB && !k) ?
+					DESC_TYPE_SKB : DESC_TYPE_PAGE,
+			     mtu);
+}
+
 int hns_nic_net_xmit_hw(struct net_device *ndev,
 			struct sk_buff *skb,
 			struct hns_nic_ring_data *ring_data)
@@ -1637,6 +1702,7 @@ static void hns_nic_uninit_ring_data(struct hns_nic_priv *priv)
 static void hns_nic_set_priv_ops(struct net_device *netdev)
 {
 	struct hns_nic_priv *priv = netdev_priv(netdev);
+	struct hnae_handle *h = priv->ae_handle;
 
 	if (AE_IS_VER1(priv->enet_ver)) {
 		priv->ops.fill_desc = fill_desc;
@@ -1644,8 +1710,17 @@ static void hns_nic_set_priv_ops(struct net_device *netdev)
 		priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tx;
 	} else {
 		priv->ops.get_rxd_bnum = get_v2rx_desc_bnum;
-		priv->ops.fill_desc = fill_v2_desc;
-		priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tx;
+		if ((netdev->features & NETIF_F_TSO) ||
+		    (netdev->features & NETIF_F_TSO6)) {
+			priv->ops.fill_desc = fill_tso_desc;
+			priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tso;
+			/* This chip only support 7*4096 */
+			netif_set_gso_max_size(netdev, 7 * 4096);
+			h->dev->ops->set_tso_stats(h, 1);
+		} else {
+			priv->ops.fill_desc = fill_v2_desc;
+			priv->ops.maybe_stop_tx = hns_nic_maybe_stop_tx;
+		}
 	}
 }
 
@@ -1758,9 +1833,10 @@ static int hns_nic_dev_probe(struct platform_device *pdev)
 
 	switch (priv->enet_ver) {
 	case AE_VERSION_2:
+		ndev->features |= NETIF_F_TSO | NETIF_F_TSO6;
 		ndev->hw_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
 			NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_GSO |
-			NETIF_F_GRO;
+			NETIF_F_GRO | NETIF_F_TSO | NETIF_F_TSO6;
 		break;
 	default:
 		break;
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1282026 — [PATCH V6 net-next 5/5] net:hns: Add the init code to disable Hip06 "Hardware VLAN assist"

FromSalil Mehta <salil.mehta@huawei.com>
Date2015-12-02 18:00 +0100
Subject[PATCH V6 net-next 5/5] net:hns: Add the init code to disable Hip06 "Hardware VLAN assist"
Message-ID<qBiV6-1mH-53@gated-at.bofh.it>
In reply to#1282016
This patch adds the initializzation code to disable the hardware
vlan support for VLAN Tag stripping by default for now.

Proper support of "hardware VLAN assitance" feature would
soon come in the next coming patches.

Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
---

PATCH V6:
- No change over the earlier patch

PATCH V5:
- Minor merge/reject change resolved to application of previous patch

PATCH V4/V3/V2:
- No change over the initial floated patch

PATCH V1:
- Initial code to disable the hardware VLAN assist for now
---
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |    7 +++++++
 drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h |    1 +
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
index b5e4c44..f302ef9 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
@@ -176,6 +176,11 @@ static void hns_ppe_cnt_clr_ce(struct hns_ppe_cb *ppe_cb)
 			 PPE_CNT_CLR_CE_B, 1);
 }
 
+static void hns_ppe_set_vlan_strip(struct hns_ppe_cb *ppe_cb, int en)
+{
+	dsaf_write_dev(ppe_cb, PPEV2_VLAN_STRIP_EN_REG, en);
+}
+
 /**
  * hns_ppe_checksum_hw - set ppe checksum caculate
  * @ppe_device: ppe device
@@ -336,6 +341,8 @@ static void hns_ppe_init_hw(struct hns_ppe_cb *ppe_cb)
 	hns_ppe_cnt_clr_ce(ppe_cb);
 
 	if (!AE_IS_VER1(dsaf_dev->dsaf_ver)) {
+		hns_ppe_set_vlan_strip(ppe_cb, 0);
+
 		/* set default RSS key in h/w */
 		hns_ppe_set_rss_key(ppe_cb, ppe_cb->rss_key);
 
diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
index 98c163e..6c18ca9 100644
--- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
+++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
@@ -318,6 +318,7 @@
 #define PPE_CFG_PARSE_TAG_REG			0x94
 #define PPE_CFG_PRO_CHECK_EN_REG		0x98
 #define PPEV2_CFG_TSO_EN_REG                    0xA0
+#define PPEV2_VLAN_STRIP_EN_REG                 0xAC
 #define PPE_INTEN_REG				0x100
 #define PPE_RINT_REG				0x104
 #define PPE_INTSTS_REG				0x108
-- 
1.7.9.5


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1282308 — Re: [PATCH V6 net-next 5/5] net:hns: Add the init code to disable Hip06 "Hardware VLAN assist"

FromSergei Shtylyov <sergei.shtylyov@cogentembedded.com>
Date2015-12-02 20:50 +0100
SubjectRe: [PATCH V6 net-next 5/5] net:hns: Add the init code to disable Hip06 "Hardware VLAN assist"
Message-ID<qBlzz-38R-1@gated-at.bofh.it>
In reply to#1282026
Hello.

On 12/02/2015 07:52 PM, Salil Mehta wrote:

> This patch adds the initializzation code to disable the hardware
> vlan support for VLAN Tag stripping by default for now.
>
> Proper support of "hardware VLAN assitance" feature would
> soon come in the next coming patches.
>
> Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
> ---
>
> PATCH V6:
> - No change over the earlier patch
>
> PATCH V5:
> - Minor merge/reject change resolved to application of previous patch
>
> PATCH V4/V3/V2:
> - No change over the initial floated patch
>
> PATCH V1:
> - Initial code to disable the hardware VLAN assist for now
> ---
>   drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |    7 +++++++
>   drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h |    1 +
>   2 files changed, 8 insertions(+)
>
> diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
> index b5e4c44..f302ef9 100644
> --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
> +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
> @@ -176,6 +176,11 @@ static void hns_ppe_cnt_clr_ce(struct hns_ppe_cb *ppe_cb)
>   			 PPE_CNT_CLR_CE_B, 1);
>   }
>
> +static void hns_ppe_set_vlan_strip(struct hns_ppe_cb *ppe_cb, int en)
> +{
> +	dsaf_write_dev(ppe_cb, PPEV2_VLAN_STRIP_EN_REG, en);

    Why not call it directly?

> +}
> +
>   /**
>    * hns_ppe_checksum_hw - set ppe checksum caculate
>    * @ppe_device: ppe device
> @@ -336,6 +341,8 @@ static void hns_ppe_init_hw(struct hns_ppe_cb *ppe_cb)
>   	hns_ppe_cnt_clr_ce(ppe_cb);
>
>   	if (!AE_IS_VER1(dsaf_dev->dsaf_ver)) {
> +		hns_ppe_set_vlan_strip(ppe_cb, 0);
> +
>   		/* set default RSS key in h/w */
>   		hns_ppe_set_rss_key(ppe_cb, ppe_cb->rss_key);
>
> diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
> index 98c163e..6c18ca9 100644
> --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
> +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
> @@ -318,6 +318,7 @@
>   #define PPE_CFG_PARSE_TAG_REG			0x94
>   #define PPE_CFG_PRO_CHECK_EN_REG		0x98
>   #define PPEV2_CFG_TSO_EN_REG                    0xA0
> +#define PPEV2_VLAN_STRIP_EN_REG                 0xAC

    Please indent with tabs, like all the surrounding #define's are indented 
(except PPEV2_CFG_TSO_EN_REG).

>   #define PPE_INTEN_REG				0x100
>   #define PPE_RINT_REG				0x104
>   #define PPE_INTSTS_REG				0x108

MBR, Sergei

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1284145 — Re: [PATCH V6 net-next 5/5] net:hns: Add the init code to disable Hip06 "Hardware VLAN assist"

FromSalil Mehta <salil.mehta@huawei.com>
Date2015-12-04 19:30 +0100
SubjectRe: [PATCH V6 net-next 5/5] net:hns: Add the init code to disable Hip06 "Hardware VLAN assist"
Message-ID<qC3hg-6hF-29@gated-at.bofh.it>
In reply to#1282308
On 12/2/2015 7:46 PM, Sergei Shtylyov wrote:
> Hello.
>
> On 12/02/2015 07:52 PM, Salil Mehta wrote:
>
>> This patch adds the initializzation code to disable the hardware
>> vlan support for VLAN Tag stripping by default for now.
>>
>> Proper support of "hardware VLAN assitance" feature would
>> soon come in the next coming patches.
>>
>> Signed-off-by: Salil Mehta <salil.mehta@huawei.com>
>> ---
>>
>> PATCH V6:
>> - No change over the earlier patch
>>
>> PATCH V5:
>> - Minor merge/reject change resolved to application of previous patch
>>
>> PATCH V4/V3/V2:
>> - No change over the initial floated patch
>>
>> PATCH V1:
>> - Initial code to disable the hardware VLAN assist for now
>> ---
>>   drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c |    7 +++++++
>>   drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h |    1 +
>>   2 files changed, 8 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c 
>> b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
>> index b5e4c44..f302ef9 100644
>> --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
>> +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_ppe.c
>> @@ -176,6 +176,11 @@ static void hns_ppe_cnt_clr_ce(struct hns_ppe_cb 
>> *ppe_cb)
>>                PPE_CNT_CLR_CE_B, 1);
>>   }
>>
>> +static void hns_ppe_set_vlan_strip(struct hns_ppe_cb *ppe_cb, int en)
>> +{
>> +    dsaf_write_dev(ppe_cb, PPEV2_VLAN_STRIP_EN_REG, en);
>
>    Why not call it directly?
Hi Sergei,
The wrapper API abstraction has been put intentionally. The reason is 
the same code
is suppose to run across different SoCs so it is always clean approach 
to hide it so
that even if there are differences in the way we access or configure 
hardware
in other SoCs basic interface of the SET API remains same!!
Therefore, we are in favour of keeping the above wrapper and therefore not
changing now.

Best regards
Salil
>> +}
>> +
>>   /**
>>    * hns_ppe_checksum_hw - set ppe checksum caculate
>>    * @ppe_device: ppe device
>> @@ -336,6 +341,8 @@ static void hns_ppe_init_hw(struct hns_ppe_cb 
>> *ppe_cb)
>>       hns_ppe_cnt_clr_ce(ppe_cb);
>>
>>       if (!AE_IS_VER1(dsaf_dev->dsaf_ver)) {
>> +        hns_ppe_set_vlan_strip(ppe_cb, 0);
>> +
>>           /* set default RSS key in h/w */
>>           hns_ppe_set_rss_key(ppe_cb, ppe_cb->rss_key);
>>
>> diff --git a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h 
>> b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
>> index 98c163e..6c18ca9 100644
>> --- a/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
>> +++ b/drivers/net/ethernet/hisilicon/hns/hns_dsaf_reg.h
>> @@ -318,6 +318,7 @@
>>   #define PPE_CFG_PARSE_TAG_REG            0x94
>>   #define PPE_CFG_PRO_CHECK_EN_REG        0x98
>>   #define PPEV2_CFG_TSO_EN_REG                    0xA0
>> +#define PPEV2_VLAN_STRIP_EN_REG                 0xAC
>
>    Please indent with tabs, like all the surrounding #define's are 
> indented (except PPEV2_CFG_TSO_EN_REG).
Thanks for this. I have changed this in PATCH V7 already floated.

Best Regards
Salil
>>   #define PPE_INTEN_REG 0x100
>>   #define PPE_RINT_REG                0x104
>>   #define PPE_INTSTS_REG                0x108
>
> MBR, Sergei
>


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web