From: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
To: davem@davemloft.net
Cc: Jacob Keller <jacob.e.keller@intel.com>,
netdev@vger.kernel.org, nhorman@redhat.com, sassmann@redhat.com,
jogreene@redhat.com, Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Subject: [net-next 02/17] fm10k: set netdev features in one location
Date: Thu, 3 Dec 2015 16:29:39 -0800 [thread overview]
Message-ID: <1449188994-64940-3-git-send-email-jeffrey.t.kirsher@intel.com> (raw)
In-Reply-To: <1449188994-64940-1-git-send-email-jeffrey.t.kirsher@intel.com>
From: Jacob Keller <jacob.e.keller@intel.com>
Don't change netdev hw_features later in fm10k_probe, instead set all
values inside fm10k_alloc_netdev. To do so, we need to know the MAC type
(whether it is PF or VF) in order to determine what to do. This helps
ensure that all logic regarding features is co-located.
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Reviewed-by: Bruce Allan <bruce.w.allan@intel.com>
Tested-by: Krishneil Singh <krishneil.k.singh@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
---
drivers/net/ethernet/intel/fm10k/fm10k.h | 2 +-
drivers/net/ethernet/intel/fm10k/fm10k_netdev.c | 31 +++++++++++++++----------
drivers/net/ethernet/intel/fm10k/fm10k_pci.c | 9 +------
3 files changed, 21 insertions(+), 21 deletions(-)
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h
index 48809e5..b178905 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k.h
+++ b/drivers/net/ethernet/intel/fm10k/fm10k.h
@@ -484,7 +484,7 @@ void fm10k_netpoll(struct net_device *netdev);
#endif
/* Netdev */
-struct net_device *fm10k_alloc_netdev(void);
+struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info);
int fm10k_setup_rx_resources(struct fm10k_ring *);
int fm10k_setup_tx_resources(struct fm10k_ring *);
void fm10k_free_rx_resources(struct fm10k_ring *);
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
index 96364c7..38fe2d8 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_netdev.c
@@ -1391,8 +1391,9 @@ static const struct net_device_ops fm10k_netdev_ops = {
#define DEFAULT_DEBUG_LEVEL_SHIFT 3
-struct net_device *fm10k_alloc_netdev(void)
+struct net_device *fm10k_alloc_netdev(const struct fm10k_info *info)
{
+ netdev_features_t hw_features;
struct fm10k_intfc *interface;
struct net_device *dev;
@@ -1415,27 +1416,31 @@ struct net_device *fm10k_alloc_netdev(void)
NETIF_F_TSO |
NETIF_F_TSO6 |
NETIF_F_TSO_ECN |
- NETIF_F_GSO_UDP_TUNNEL |
NETIF_F_RXHASH |
NETIF_F_RXCSUM;
+ /* Only the PF can support VXLAN and NVGRE tunnel offloads */
+ if (info->mac == fm10k_mac_pf) {
+ dev->hw_enc_features = NETIF_F_IP_CSUM |
+ NETIF_F_TSO |
+ NETIF_F_TSO6 |
+ NETIF_F_TSO_ECN |
+ NETIF_F_GSO_UDP_TUNNEL |
+ NETIF_F_IPV6_CSUM |
+ NETIF_F_SG;
+
+ dev->features |= NETIF_F_GSO_UDP_TUNNEL;
+ }
+
/* all features defined to this point should be changeable */
- dev->hw_features |= dev->features;
+ hw_features = dev->features;
/* allow user to enable L2 forwarding acceleration */
- dev->hw_features |= NETIF_F_HW_L2FW_DOFFLOAD;
+ hw_features |= NETIF_F_HW_L2FW_DOFFLOAD;
/* configure VLAN features */
dev->vlan_features |= dev->features;
- /* configure tunnel offloads */
- dev->hw_enc_features |= NETIF_F_IP_CSUM |
- NETIF_F_TSO |
- NETIF_F_TSO6 |
- NETIF_F_TSO_ECN |
- NETIF_F_GSO_UDP_TUNNEL |
- NETIF_F_IPV6_CSUM;
-
/* we want to leave these both on as we cannot disable VLAN tag
* insertion or stripping on the hardware since it is contained
* in the FTAG and not in the frame itself.
@@ -1446,5 +1451,7 @@ struct net_device *fm10k_alloc_netdev(void)
dev->priv_flags |= IFF_UNICAST_FLT;
+ dev->hw_features |= hw_features;
+
return dev;
}
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
index 5fbffba..1af4b22 100644
--- a/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
+++ b/drivers/net/ethernet/intel/fm10k/fm10k_pci.c
@@ -1722,13 +1722,6 @@ static int fm10k_sw_init(struct fm10k_intfc *interface,
pci_resource_len(pdev, 4));
hw->sw_addr = interface->sw_addr;
- /* Only the PF can support VXLAN and NVGRE offloads */
- if (hw->mac.type != fm10k_mac_pf) {
- netdev->hw_enc_features = 0;
- netdev->features &= ~NETIF_F_GSO_UDP_TUNNEL;
- netdev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL;
- }
-
/* initialize DCBNL interface */
fm10k_dcbnl_set_ops(netdev);
@@ -1894,7 +1887,7 @@ static int fm10k_probe(struct pci_dev *pdev,
pci_set_master(pdev);
pci_save_state(pdev);
- netdev = fm10k_alloc_netdev();
+ netdev = fm10k_alloc_netdev(fm10k_info_tbl[ent->driver_data]);
if (!netdev) {
err = -ENOMEM;
goto err_alloc_netdev;
--
2.5.0
next prev parent reply other threads:[~2015-12-04 0:29 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 0:29 [net-next 00/17][pull request] 100GbE Intel Wired LAN Driver Updates 2015-12-03 Jeff Kirsher
2015-12-04 0:29 ` [net-next 01/17] fm10k: Fix error handling in the function fm10k_setup_tc for certain function calls Jeff Kirsher
2015-12-04 0:41 ` Joe Perches
2015-12-04 0:29 ` Jeff Kirsher [this message]
2015-12-04 0:29 ` [net-next 03/17] fm10k: reset max_queues on init_hw_vf failure Jeff Kirsher
2015-12-04 0:29 ` [net-next 04/17] fm10k: always check init_hw for errors Jeff Kirsher
2015-12-04 0:29 ` [net-next 05/17] fm10k: reinitialize queuing scheme after calling init_hw Jeff Kirsher
2015-12-04 0:29 ` [net-next 06/17] fm10k: Correct typecast in fm10k_update_xc_addr_pf Jeff Kirsher
2015-12-04 0:29 ` [net-next 07/17] fm10k: explicitly typecast vlan values to u16 Jeff Kirsher
2015-12-04 0:29 ` [net-next 08/17] fm10k: add statistics for actual DWORD count of mbmem mailbox Jeff Kirsher
2015-12-04 0:29 ` [net-next 09/17] fm10k: rename mbx_tx_oversized statistic to mbx_tx_dropped Jeff Kirsher
2015-12-04 0:29 ` [net-next 10/17] fm10k: add TEB check to fm10k_gre_is_nvgre Jeff Kirsher
2015-12-04 0:54 ` Tom Herbert
2015-12-04 23:03 ` Jeff Kirsher
2015-12-04 0:29 ` [net-next 11/17] fm10k: Add support for ITR scaling based on PCIe link speed Jeff Kirsher
2015-12-04 0:29 ` [net-next 12/17] fm10k: introduce ITR_IS_ADAPTIVE macro Jeff Kirsher
2015-12-04 0:29 ` [net-next 13/17] fm10k: Update adaptive ITR algorithm Jeff Kirsher
2015-12-04 0:29 ` [net-next 14/17] fm10k: use macro for default Tx and Rx ITR values Jeff Kirsher
2015-12-04 0:29 ` [net-next 15/17] fm10k: change default Tx ITR to 25usec Jeff Kirsher
2015-12-04 0:29 ` [net-next 16/17] fm10k: TRIVIAL fix typo of hardware Jeff Kirsher
2015-12-04 0:29 ` [net-next 17/17] fm10k: TRIVIAL cleanup order at top of fm10k_xmit_frame 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=1449188994-64940-3-git-send-email-jeffrey.t.kirsher@intel.com \
--to=jeffrey.t.kirsher@intel.com \
--cc=davem@davemloft.net \
--cc=jacob.e.keller@intel.com \
--cc=jogreene@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=nhorman@redhat.com \
--cc=sassmann@redhat.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;
as well as URLs for NNTP newsgroup(s).