From: Joe Perches <joe@perches.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: davem@davemloft.net,
Jesse Brandeburg <jesse.brandeburg@intel.com>,
netdev@vger.kernel.org, gospo@redhat.com, sassmann@redhat.com,
Shannon Nelson <shannon.nelson@intel.com>,
PJ Waskiewicz <peter.p.waskiewicz.jr@intel.com>,
e1000-devel@lists.sourceforge.net
Subject: Re: [net-next 1/8] i40e: main driver core
Date: Thu, 13 Jun 2013 22:29:22 -0700 [thread overview]
Message-ID: <1371187762.31941.42.camel@joe-AO722> (raw)
In-Reply-To: <1371182122-26629-2-git-send-email-jeffrey.t.kirsher@intel.com>
On Thu, 2013-06-13 at 20:55 -0700, Jeff Kirsher wrote:
> From: Jesse Brandeburg <jesse.brandeburg@intel.com>
>
> This is the driver for the Intel(R) Ethernet Controller XL710 Family.
This code looks very generic and not tailored to linux.
Are you intending to fix it to be more linux-kernel like?
> diff --git a/drivers/net/ethernet/intel/i40e/i40e_main.c b/drivers/net/ethernet/intel/i40e/i40e_main.c
[]
> +enum i40e_status_code i40e_allocate_dma_mem_d(struct i40e_hw *hw,
i40e_status? int is more common.
> + if (mem->va)
> + return I40E_SUCCESS;
> + else
> + return I40E_ERR_NO_MEMORY;
if (!mem->va)
return -ENOMEM;
return 0;
but returning the pointer or NULL is much more normal.
> +enum i40e_status_code i40e_allocate_virt_mem_d(struct i40e_hw *hw,
> + struct i40e_virt_mem *mem,
> + u32 size)
[]
> if (mem->va)
> + return I40E_SUCCESS;
> + else
> + return I40E_ERR_NO_MEMORY;
> +}
same as above.
> +/**
> + * i40e_debug_d - OS dependent version of debug printing
> + * @hw: pointer to the HW structure
> + * @mask: debug level mask
> + * @fmt_str: printf-type format description
> + **/
> +void i40e_debug_d(void *hw, u32 mask, char *fmt_str, ...)
> +{
> + char *buf;
> + int buf_len = 512;
> + va_list argptr;
> + struct i40e_pf *pf = (struct i40e_pf *)(((struct i40e_hw *)hw)->back);
> +
> + if (!(mask & ((struct i40e_hw *)hw)->debug_mask))
> + return;
> +
> + buf = kzalloc(buf_len, GFP_KERNEL);
> +
> + if (!buf) {
> + dev_err(&pf->pdev->dev, "%s - Out of memory\n", __func__);
> + return;
> + }
> +
> + va_start(argptr, fmt_str);
> + vsnprintf(buf, buf_len, fmt_str, argptr);
> + va_end(argptr);
> +
> + /* the debug string is already formatted with a newline */
> + dev_info(&pf->pdev->dev, "%s", buf);
> + kfree(buf);
%pV and avoid the malloc/free.
Also, it seems that perhaps all of these uses
try to use "%s: ", __func__, so maybe using
%pf, __builtin_return_address(0) might be better.
> +void i40e_update_stats(struct i40e_vsi *vsi)
> +{
[]
> + for (q = 0; q < vsi->num_queue_pairs; q++) {
> + rx_b += vsi->rx_rings[q].rx_stats.bytes;
better to use a temporary for vs->rx_rings[q]
> +
> struct i40e_mac_filter *i40e_add_filter(struct i40e_vsi *vsi,
> + u8 *macaddr, u16 vlan,
> + bool is_vf, bool is_netdev)
> +{
[]
> + f = kzalloc(sizeof(*f), GFP_ATOMIC);
> + if (NULL == f) {
> + if (is_netdev)
> + netdev_err(vsi->netdev,
> + "%s: no memory for new filter\n",
> + __func__);
> + else
> + dev_err(&vsi->back->pdev->dev,
> + "%s: no memory for new filter\n",
> + __func__);
No need for OOM messages, there are a lot
of these.
> +static int i40e_set_mac(struct net_device *netdev, void *p)
> +{
> + struct i40e_netdev_priv *np = netdev_priv(netdev);
> + struct i40e_vsi *vsi = np->vsi;
> + struct sockaddr *addr = p;
> + struct i40e_mac_filter *f;
> +
> + netdev_info(netdev, "%s: address=%pM\n", __func__, addr->sa_data);
sa_addr? Is family guaranteed to be ARPHDR_ETHER here?
[]
> +static void i40e_set_rx_mode(struct net_device *netdev)
> +{
> + if (f->macaddr[0] & 0x01) {
is_multicast_ether_addr()
Sorry, this is very long and I wonder if you really
intend this to be merged as-is.
next prev parent reply other threads:[~2013-06-14 5:29 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-14 3:55 [net-next 0/8][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2013-06-14 3:55 ` [net-next 1/8] i40e: main driver core Jeff Kirsher
2013-06-14 5:29 ` Joe Perches [this message]
2013-06-16 21:34 ` Nelson, Shannon
2013-06-19 18:12 ` Ben Hutchings
2013-06-20 6:41 ` Nelson, Shannon
2013-06-20 19:46 ` Nelson, Shannon
2013-06-20 19:54 ` Ben Hutchings
2013-06-20 20:01 ` Nelson, Shannon
2013-06-20 20:52 ` Peter P Waskiewicz Jr
2013-06-19 18:55 ` Stephen Hemminger
2013-06-20 6:41 ` Nelson, Shannon
2013-06-20 20:50 ` Nelson, Shannon
2013-06-14 3:55 ` [net-next 2/8] i40e: transmit, receive, and napi Jeff Kirsher
2013-06-14 3:55 ` [net-next 3/8] i40e: driver ethtool core Jeff Kirsher
2013-06-19 18:27 ` Ben Hutchings
2013-06-20 19:47 ` Nelson, Shannon
2013-06-20 19:59 ` Ben Hutchings
2013-06-20 20:04 ` Nelson, Shannon
2013-06-21 15:39 ` Structured ethtool statistic names Ben Hutchings
2013-06-25 20:46 ` Nelson, Shannon
2013-06-19 18:38 ` [net-next 3/8] i40e: driver ethtool core Stephen Hemminger
2013-06-20 20:52 ` Nelson, Shannon
2013-06-19 18:40 ` Stephen Hemminger
2013-06-20 20:53 ` Nelson, Shannon
2013-06-19 18:41 ` Stephen Hemminger
2013-06-20 20:53 ` Nelson, Shannon
2013-06-14 3:55 ` [net-next 4/8] i40e: driver core headers Jeff Kirsher
2013-06-14 3:55 ` [net-next 5/8] i40e: implement virtual device interface Jeff Kirsher
2013-06-14 3:55 ` [net-next 6/8] i40e: init code and hardware support Jeff Kirsher
2013-06-14 3:55 ` [net-next 7/8] i40e: sysfs and debugfs interfaces Jeff Kirsher
2013-06-14 3:55 ` [net-next 8/8] i40e: include i40e in kernel proper Jeff Kirsher
-- strict thread matches above, loose matches on Subject: below --
2013-09-06 5:43 [net-next 0/8][pull request] Intel Wired LAN Driver Updates Jeff Kirsher
2013-09-06 5:43 ` [net-next 1/8] i40e: main driver core Jeff Kirsher
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=1371187762.31941.42.camel@joe-AO722 \
--to=joe@perches.com \
--cc=davem@davemloft.net \
--cc=e1000-devel@lists.sourceforge.net \
--cc=gospo@redhat.com \
--cc=jeffrey.t.kirsher@intel.com \
--cc=jesse.brandeburg@intel.com \
--cc=netdev@vger.kernel.org \
--cc=peter.p.waskiewicz.jr@intel.com \
--cc=sassmann@redhat.com \
--cc=shannon.nelson@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