Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752598AbbESCVl (ORCPT ); Mon, 18 May 2015 22:21:41 -0400 Received: from smtprelay0014.hostedemail.com ([216.40.44.14]:45914 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751039AbbESCVh (ORCPT ); Mon, 18 May 2015 22:21:37 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1543:1593:1594:1711:1730:1747:1777:1792:2194:2199:2393:2559:2562:2828:2892:2902:2904:2915:3138:3139:3140:3141:3142:3355:3622:3865:3866:3867:3870:3871:3872:4250:4321:5007:6119:6261:6742:7576:7903:8603:9707:10004:10400:10848:11026:11232:11473:11657:11658:11914:12043:12296:12438:12517:12519:12740:13161:13229:13255:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: color01_dbe16041d916 X-Filterd-Recvd-Size: 4794 Message-ID: <1432002093.2870.130.camel@perches.com> Subject: Re: [PATCH net-next v4 2/2] net: Adding support for Cavium ThunderX network controller From: Joe Perches To: Aleksey Makarov Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, David Daney , Robert Richter , Sunil Goutham , Maciej Czekaj , Ganapatrao Kulkarni , Tomasz Nowicki , Robert Richter , Kamil Rytarowski , Thanneeru Srinivasulu , Sruthi Vangala , Robert Richter Date: Mon, 18 May 2015 19:21:33 -0700 In-Reply-To: <1432000757-28700-3-git-send-email-aleksey.makarov@auriga.com> References: <1432000757-28700-1-git-send-email-aleksey.makarov@auriga.com> <1432000757-28700-3-git-send-email-aleksey.makarov@auriga.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3463 Lines: 131 On Mon, 2015-05-18 at 18:59 -0700, Aleksey Makarov wrote: > From: Sunil Goutham trivial note, I didn't read the whole thing. > diff --git a/drivers/net/ethernet/cavium/thunder/nic.h b/drivers/net/ethernet/cavium/thunder/nic.h [] > +/* Set Maximum frame size */ > +struct set_frs_msg { > + u8 vf_id; > + u16 max_frs; > +}; > + > +/* Set CPI algorithm type */ > +struct cpi_cfg_msg { > + u8 vf_id; > + u8 rq_cnt; > + u8 cpi_alg; > +}; > + > +#ifdef VNIC_RSS_SUPPORT > +/* Get RSS table size */ > +struct rss_sz_msg { > + u8 vf_id; > + u16 ind_tbl_size; > +}; Are these missing __packed? > +/* Physical interface link status */ > +struct bgx_link_status { > + u8 link_up; > + u8 duplex; > + u32 speed; > +}; [] > +#ifdef NIC_DEBUG > +#define nic_dbg(dev, fmt, arg...) \ > + dev_info(dev, fmt, ##arg) I think it's better to emit debug information at KERN_DEUG > +#else > +#define nic_dbg(dev, fmt, arg...) do {} while (0) This could/should still verify the format & args with an if (0) #define nic_dbg(dev, fmt, ...) \ do { \ if (0) \ dev_dbgdev, fmt, ##__VA_ARGS__); \ } while (0) > +/* PF -> VF mailbox communication APIs */ > +static void nic_enable_mbx_intr(struct nicpf *nic) > +{ > + /* Enable mailbox interrupt for all 128 VFs */ > + nic_reg_write(nic, NIC_PF_MAILBOX_ENA_W1S, ~0x00ull); > + nic_reg_write(nic, NIC_PF_MAILBOX_ENA_W1S + sizeof(u64), ~0x00ull); ~0x00ull is a bit odd. ~0ull is more common > +} > + > +static void nic_clear_mbx_intr(struct nicpf *nic, int vf, int mbx_reg) > +{ > + nic_reg_write(nic, NIC_PF_MAILBOX_INT + (mbx_reg << 3), (1ULL << vf)); Maybe use BIT_ULL(vf) > +static int nic_sriov_init(struct pci_dev *pdev, struct nicpf *nic) > +{ [] > + dev_info(&pdev->dev, "SRIOV enabled, numer of VF available %d\n", number > diff --git a/drivers/net/ethernet/cavium/thunder/nicvf_main.c b/drivers/net/ethernet/cavium/thunder/nicvf_main.c > +static void nicvf_dump_packet(struct net_device *netdev, struct sk_buff *skb) > +{ > + int i; > + > + pr_info("%s: skb 0x%p, len=%d\n", > + netdev->name, skb, skb->len); > + for (i = 0; i < skb->len; i++) { > + if ((i % 16) == 0) > + pr_info("\n"); > + pr_info(" %02x", ((u8 *)skb->data)[i]); > + } > + pr_info("\n"); This creates a mess. Try print_hex_dump instead. > +static inline void nicvf_set_rx_frame_cnt(struct nicvf *nic, > + struct sk_buff *skb) > +{ > + if (skb->len <= 64) > + nic->drv_stats.rx_frames_64++; > + else if ((skb->len > 64) && (skb->len <= 127)) The first condition in the subsequent "else if"s isn't necessary. It's already known by the preceding tests. if (skb->len <= 64) ... else if (skb->len <= 127) ... else if (skb->len <= 255) etc... > + nic->drv_stats.rx_frames_127++; > + else if ((skb->len > 127) && (skb->len <= 255)) > + nic->drv_stats.rx_frames_255++; > + else if ((skb->len > 255) && (skb->len <= 511)) > + nic->drv_stats.rx_frames_511++; > + else if ((skb->len > 511) && (skb->len <= 1023)) > + nic->drv_stats.rx_frames_1023++; > + else if ((skb->len > 1023) && (skb->len <= 1518)) > + nic->drv_stats.rx_frames_1518++; > + else if (skb->len > 1518) > + nic->drv_stats.rx_frames_jumbo++; > +} -- 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/