diff options
author | Alexander Duyck <alexander.h.duyck@intel.com> | 2014-09-20 19:48:10 -0400 |
---|---|---|
committer | Jeff Kirsher <jeffrey.t.kirsher@intel.com> | 2014-09-23 03:59:15 -0700 |
commit | 0e7b364408176362a6370f7182a8fa1c5c4e0628 (patch) | |
tree | c353730fd4c57bdc0f49e7a5c781a0f82c542c68 /drivers/net/ethernet/intel/fm10k/fm10k.h | |
parent | fm10k: Add support for configuring PF interface (diff) | |
download | linux-dev-0e7b364408176362a6370f7182a8fa1c5c4e0628.tar.xz linux-dev-0e7b364408176362a6370f7182a8fa1c5c4e0628.zip |
fm10k: Add netdev
Now that we have the ability to configure the basic settings on the device
we can start allocating and configuring a netdev for the interface.
Signed-off-by: Alexander Duyck <alexander.h.duyck@intel.com>
Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Diffstat (limited to 'drivers/net/ethernet/intel/fm10k/fm10k.h')
-rw-r--r-- | drivers/net/ethernet/intel/fm10k/fm10k.h | 92 |
1 files changed, 91 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/fm10k/fm10k.h b/drivers/net/ethernet/intel/fm10k/fm10k.h index 3da3a9904d56..b2ee4fce7635 100644 --- a/drivers/net/ethernet/intel/fm10k/fm10k.h +++ b/drivers/net/ethernet/intel/fm10k/fm10k.h @@ -27,15 +27,102 @@ #include <linux/if_vlan.h> #include <linux/pci.h> -#include "fm10k_common.h" +#include "fm10k_pf.h" + +#define FM10K_MAX_JUMBO_FRAME_SIZE 15358 /* Maximum supported size 15K */ + +enum fm10k_ring_f_enum { + RING_F_RSS, + RING_F_QOS, + RING_F_ARRAY_SIZE /* must be last in enum set */ +}; + +struct fm10k_ring_feature { + u16 limit; /* upper limit on feature indices */ + u16 indices; /* current value of indices */ + u16 mask; /* Mask used for feature to ring mapping */ + u16 offset; /* offset to start of feature */ +}; + +#define fm10k_vxlan_port_for_each(vp, intfc) \ + list_for_each_entry(vp, &(intfc)->vxlan_port, list) +struct fm10k_vxlan_port { + struct list_head list; + sa_family_t sa_family; + __be16 port; +}; struct fm10k_intfc { + unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)]; + struct net_device *netdev; struct pci_dev *pdev; + unsigned long state; + + u32 flags; +#define FM10K_FLAG_RESET_REQUESTED (u32)(1 << 0) +#define FM10K_FLAG_RSS_FIELD_IPV4_UDP (u32)(1 << 1) +#define FM10K_FLAG_RSS_FIELD_IPV6_UDP (u32)(1 << 2) +#define FM10K_FLAG_RX_TS_ENABLED (u32)(1 << 3) +#define FM10K_FLAG_SWPRI_CONFIG (u32)(1 << 4) + int xcast_mode; + + u64 rx_overrun_pf; + u64 rx_overrun_vf; + struct fm10k_ring_feature ring_feature[RING_F_ARRAY_SIZE]; + + struct fm10k_hw_stats stats; struct fm10k_hw hw; u32 __iomem *uc_addr; + u16 msg_enable; + + u32 reta[FM10K_RETA_SIZE]; + u32 rssrk[FM10K_RSSRK_SIZE]; + + /* VXLAN port tracking information */ + struct list_head vxlan_port; + +#if defined(HAVE_DCBNL_IEEE) && defined(CONFIG_DCB) + u8 pfc_en; +#endif + u8 rx_pause; + + /* GLORT resources in use by PF */ + u16 glort; + u16 glort_count; + + /* VLAN ID for updating multicast/unicast lists */ + u16 vid; +}; + +enum fm10k_state_t { + __FM10K_RESETTING, + __FM10K_DOWN, + __FM10K_MBX_LOCK, + __FM10K_LINK_DOWN, }; +static inline void fm10k_mbx_lock(struct fm10k_intfc *interface) +{ + /* busy loop if we cannot obtain the lock as some calls + * such as ndo_set_rx_mode may be made in atomic context + */ + while (test_and_set_bit(__FM10K_MBX_LOCK, &interface->state)) + udelay(20); +} + +static inline void fm10k_mbx_unlock(struct fm10k_intfc *interface) +{ + /* flush memory to make sure state is correct */ + smp_mb__before_atomic(); + clear_bit(__FM10K_MBX_LOCK, &interface->state); +} + +static inline int fm10k_mbx_trylock(struct fm10k_intfc *interface) +{ + return !test_and_set_bit(__FM10K_MBX_LOCK, &interface->state); +} + /* main */ extern char fm10k_driver_name[]; extern const char fm10k_driver_version[]; @@ -43,4 +130,7 @@ extern const char fm10k_driver_version[]; /* PCI */ int fm10k_register_pci_driver(void); void fm10k_unregister_pci_driver(void); + +/* Netdev */ +struct net_device *fm10k_alloc_netdev(void); #endif /* _FM10K_H_ */ |