Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755251AbdGVXjZ (ORCPT ); Sat, 22 Jul 2017 19:39:25 -0400 Received: from lhrrgout.huawei.com ([194.213.3.17]:32169 "EHLO lhrrgout.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751957AbdGVXjX (ORCPT ); Sat, 22 Jul 2017 19:39:23 -0400 From: Salil Mehta To: Bo Yu CC: "davem@davemloft.net" , "Zhuangyuzeng (Yisen)" , huangdaode , "lipeng (Y)" , "mehta.salil.lnk@gmail.com" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" , Linuxarm Subject: RE: [PATCH V3 net-next 1/8] net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC Thread-Topic: [PATCH V3 net-next 1/8] net: hns3: Add support of HNS3 Ethernet Driver for hip08 SoC Thread-Index: AQHS5461s+/MimzCYUeFu4O0uMj4xqIrPV8AgDV6yZA= Date: Sat, 22 Jul 2017 23:39:12 +0000 Message-ID: References: <20170617172431.177044-1-salil.mehta@huawei.com> <20170617172431.177044-2-salil.mehta@huawei.com> <20170619005721.4x66u5mm35huqa4g@debian> In-Reply-To: <20170619005721.4x66u5mm35huqa4g@debian> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.47.95.3] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090202.5973E229.00C2,ss=1,re=0.000,recu=0.000,reip=0.000,cl=1,cld=1,fgs=0, ip=169.254.1.170, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: eff5eb3fdf880700867b236d2bdf834a Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id v6MNdVGc003749 Content-Length: 2785 Lines: 93 Hi Bo Yu, > -----Original Message----- > From: Bo Yu [mailto:tsu.yubo@gmail.com] > Sent: Monday, June 19, 2017 1:57 AM > To: Salil Mehta > Cc: davem@davemloft.net; Zhuangyuzeng (Yisen); huangdaode; lipeng (Y); > mehta.salil.lnk@gmail.com; netdev@vger.kernel.org; linux- > kernel@vger.kernel.org; Linuxarm > Subject: Re: [PATCH V3 net-next 1/8] net: hns3: Add support of HNS3 > Ethernet Driver for hip08 SoC > > Hi, > On Sat, Jun 17, 2017 at 06:24:24PM +0100, Salil Mehta wrote: > >+ struct notifier_block notifier_block; > >+ /* Vxlan/Geneve information */ > >+ struct hns3_udp_tunnel udp_tnl[HNS3_UDP_TNL_MAX]; > >+}; > >+ > >+/* the distance between [begin, end) in a ring buffer > >+ * note: there is a unuse slot between the begin and the end > >+ */ > >+static inline int ring_dist(struct hns3_enet_ring *ring, int begin, > int end) > >+{ > >+ return (end - begin + ring->desc_num) % ring->desc_num; > >+} > >+ > >+static inline int ring_space(struct hns3_enet_ring *ring) > >+{ > >+ return ring->desc_num - > >+ ring_dist(ring, ring->next_to_clean, ring->next_to_use) - > 1; > >+} > >+ > >+static inline int is_ring_empty(struct hns3_enet_ring *ring) > >+{ > >+ return ring->next_to_use == ring->next_to_clean; > >+} > >+ > >+static inline void hns3_write_reg(void __iomem *base, u32 reg, u32 > value) > >+{ > >+ u8 __iomem *reg_addr = READ_ONCE(base); > >+ > >+ writel(value, reg_addr + reg); > >+} > >+ > >+#define hns3_write_dev(a, reg, value) \ > >+ hns3_write_reg((a)->io_base, (reg), (value)) > >+ > >+#define hnae_queue_xmit(tqp, buf_num) writel_relaxed(buf_num, \ > >+ (tqp)->io_base + HNS3_RING_TX_RING_TAIL_REG) > >+ > >+#define ring_to_dev(ring) (&(ring)->tqp->handle->pdev->dev) > >+ > >+#define ring_to_dma_dir(ring) (HNAE3_IS_TX_RING(ring) ? \ > >+ DMA_TO_DEVICE : DMA_FROM_DEVICE) > >+ > >+#define tx_ring_data(priv, idx) ((priv)->ring_data[idx]) > >+ > >+#define hnae_buf_size(_ring) ((_ring)->buf_size) > >+#define hnae_page_order(_ring) (get_order(hnae_buf_size(_ring))) > >+#define hnae_page_size(_ring) (PAGE_SIZE << hnae_page_order(_ring)) > >+ > >+/* iterator for handling rings in ring group */ > >+#define hns3_for_each_ring(pos, head) \ > >+ for (pos = (head).ring; pos != NULL; pos = pos->next) > > Only a pos? Comparsion to NULL could be written "pos" noticed by > checkpatch. Fixed in patch V4. Thanks! Salil > > > >+ > >+void hns3_ethtool_set_ops(struct net_device *ndev); > >+ > >+int hns3_nic_net_xmit_hw( > >+ struct net_device *ndev, > >+ struct sk_buff *skb, > >+ struct hns3_nic_ring_data *ring_data); > >+int hns3_clean_tx_ring(struct hns3_enet_ring *ring, int budget); > >+int hns3_clean_rx_ring_ex( > >+ struct hns3_enet_ring *ring, > >+ struct sk_buff **skb_ex, > >+ int budget); > >+#endif > >-- > >2.7.4 > > > >