Skip to content

Commit

Permalink
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/jkirsher/net-next

Jeff Kirsher says:

====================
Intel Wired LAN Driver Updates 2015-02-24

This series contains updates to i40e and i40evf only, which bumps their
versions to i40e 1.2.9 and i40evf 1.2.3.

Paul fixes i40e_debug_aq() for big endian machines by adding the
appropriate LExx_TO_CPU wrappers.

Catherine adds a requested speed variable to the link_status to store the
last speeds we requested from the firmware and use the advertised speed
settings in get_settings in ethtool now that we have it.  Due to the
new code addition, she also refactors get_settings to improve readability
and to accommodate some of the longer lines of code by adding two
functions i40e_get_settings_link_up() and i40e_get_settings_link_down().

Carolyn adds a struct to the VSI struct to keep track of RXNFC settings
done via ethtool.  Adds more information to the interrupt vector
names, specifically to the VF misc vector name so that we can distinguish
between all the interrupts.

Ashish enables the i40evf driver to enable debug prints via ethtool.

Mitch updates i40e to enable packet split only when IOMMU is in use,
since it shows a distinct advantage over the single-buffer path
because it minimizes DMA mapping and unmapping.  Also adds the receive
routine in use to the features log message to be able to print the
receive packet split status.

Greg adds the ability to get, set and commit permanently the NPAR
partition BW configuration through configfs.  Enables an application
to query the i40e driver's private flags to get the status of NPAR
enablement via ethtool.

Neerav adds support for bridge offload ndo_ops getlink and setlink
to enable bridge hardware mode as per the mode set via IFLA_BRIDGE_MODE.
The support is only enabled in the case of a PF VSI and not available for
any other VSI type.

Kevin fixes i40e by ensuring the BUF and FLAG_RD flags are set for
indirect admin queue command.

Vasu updates the driver to setup FCoE netdev device type as "fcoe", so that
it shows up in sysfs as FCoE device.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Feb 25, 2015
2 parents d79d210 + 5b8eb17 commit 009f33e
Show file tree
Hide file tree
Showing 16 changed files with 1,130 additions and 189 deletions.
3 changes: 2 additions & 1 deletion drivers/net/ethernet/intel/i40e/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
################################################################################
#
# Intel Ethernet Controller XL710 Family Linux Driver
# Copyright(c) 2013 - 2014 Intel Corporation.
# Copyright(c) 2013 - 2015 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
Expand Down Expand Up @@ -37,6 +37,7 @@ i40e-objs := i40e_main.o \
i40e_hmc.o \
i40e_lan_hmc.o \
i40e_nvm.o \
i40e_configfs.o \
i40e_debugfs.o \
i40e_diag.o \
i40e_txrx.o \
Expand Down
24 changes: 22 additions & 2 deletions drivers/net/ethernet/intel/i40e/i40e.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Intel Ethernet Controller XL710 Family Linux Driver
* Copyright(c) 2013 - 2014 Intel Corporation.
* Copyright(c) 2013 - 2015 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
Expand Down Expand Up @@ -36,6 +36,7 @@
#include <linux/aer.h>
#include <linux/netdevice.h>
#include <linux/ioport.h>
#include <linux/iommu.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/string.h>
Expand All @@ -49,6 +50,7 @@
#include <net/ip6_checksum.h>
#include <linux/ethtool.h>
#include <linux/if_vlan.h>
#include <linux/if_bridge.h>
#include <linux/clocksource.h>
#include <linux/net_tstamp.h>
#include <linux/ptp_clock_kernel.h>
Expand Down Expand Up @@ -94,6 +96,9 @@
#define I40E_QUEUE_WAIT_RETRY_LIMIT 10
#define I40E_INT_NAME_STR_LEN (IFNAMSIZ + 9)

/* Ethtool Private Flags */
#define I40E_PRIV_FLAGS_NPAR_FLAG (1 << 0)

#define I40E_NVM_VERSION_LO_SHIFT 0
#define I40E_NVM_VERSION_LO_MASK (0xff << I40E_NVM_VERSION_LO_SHIFT)
#define I40E_NVM_VERSION_HI_SHIFT 12
Expand Down Expand Up @@ -384,6 +389,9 @@ struct i40e_pf {
bool ptp_tx;
bool ptp_rx;
u16 rss_table_size;
/* These are only valid in NPAR modes */
u32 npar_max_bw;
u32 npar_min_bw;
};

struct i40e_mac_filter {
Expand All @@ -406,6 +414,7 @@ struct i40e_veb {
u16 uplink_seid;
u16 stats_idx; /* index of VEB parent */
u8 enabled_tc;
u16 bridge_mode; /* Bridge Mode (VEB/VEPA) */
u16 flags;
u16 bw_limit;
u8 bw_max_quanta;
Expand Down Expand Up @@ -505,6 +514,9 @@ struct i40e_vsi {

/* VSI specific handlers */
irqreturn_t (*irq_handler)(int irq, void *data);

/* current rxnfc data */
struct ethtool_rxnfc rxnfc; /* current rss hash opts */
} ____cacheline_internodealigned_in_smp;

struct i40e_netdev_priv {
Expand Down Expand Up @@ -681,6 +693,7 @@ int i40e_vlan_rx_add_vid(struct net_device *netdev,
int i40e_vlan_rx_kill_vid(struct net_device *netdev,
__always_unused __be16 proto, u16 vid);
#endif
int i40e_open(struct net_device *netdev);
int i40e_vsi_open(struct i40e_vsi *vsi);
void i40e_vlan_stripping_disable(struct i40e_vsi *vsi);
int i40e_vsi_add_vlan(struct i40e_vsi *vsi, s16 vid);
Expand All @@ -691,7 +704,6 @@ bool i40e_is_vsi_in_vlan(struct i40e_vsi *vsi);
struct i40e_mac_filter *i40e_find_mac(struct i40e_vsi *vsi, u8 *macaddr,
bool is_vf, bool is_netdev);
#ifdef I40E_FCOE
int i40e_open(struct net_device *netdev);
int i40e_close(struct net_device *netdev);
int i40e_setup_tc(struct net_device *netdev, u8 tc);
void i40e_netpoll(struct net_device *netdev);
Expand Down Expand Up @@ -728,4 +740,12 @@ int i40e_ptp_set_ts_config(struct i40e_pf *pf, struct ifreq *ifr);
int i40e_ptp_get_ts_config(struct i40e_pf *pf, struct ifreq *ifr);
void i40e_ptp_init(struct i40e_pf *pf);
void i40e_ptp_stop(struct i40e_pf *pf);
int i40e_is_vsi_uplink_mode_veb(struct i40e_vsi *vsi);
#if IS_ENABLED(CONFIG_CONFIGFS_FS)
int i40e_configfs_init(void);
void i40e_configfs_exit(void);
#endif /* CONFIG_CONFIGFS_FS */
i40e_status i40e_get_npar_bw_setting(struct i40e_pf *pf);
i40e_status i40e_set_npar_bw_setting(struct i40e_pf *pf);
i40e_status i40e_commit_npar_bw_setting(struct i40e_pf *pf);
#endif /* _I40E_H_ */
150 changes: 137 additions & 13 deletions drivers/net/ethernet/intel/i40e/i40e_common.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*******************************************************************************
*
* Intel Ethernet Controller XL710 Family Linux Driver
* Copyright(c) 2013 - 2014 Intel Corporation.
* Copyright(c) 2013 - 2015 Intel Corporation.
*
* This program is free software; you can redistribute it and/or modify it
* under the terms and conditions of the GNU General Public License,
Expand Down Expand Up @@ -94,16 +94,19 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,

i40e_debug(hw, mask,
"AQ CMD: opcode 0x%04X, flags 0x%04X, datalen 0x%04X, retval 0x%04X\n",
aq_desc->opcode, aq_desc->flags, aq_desc->datalen,
aq_desc->retval);
le16_to_cpu(aq_desc->opcode),
le16_to_cpu(aq_desc->flags),
le16_to_cpu(aq_desc->datalen),
le16_to_cpu(aq_desc->retval));
i40e_debug(hw, mask, "\tcookie (h,l) 0x%08X 0x%08X\n",
aq_desc->cookie_high, aq_desc->cookie_low);
le32_to_cpu(aq_desc->cookie_high),
le32_to_cpu(aq_desc->cookie_low));
i40e_debug(hw, mask, "\tparam (0,1) 0x%08X 0x%08X\n",
aq_desc->params.internal.param0,
aq_desc->params.internal.param1);
le32_to_cpu(aq_desc->params.internal.param0),
le32_to_cpu(aq_desc->params.internal.param1));
i40e_debug(hw, mask, "\taddr (h,l) 0x%08X 0x%08X\n",
aq_desc->params.external.addr_high,
aq_desc->params.external.addr_low);
le32_to_cpu(aq_desc->params.external.addr_high),
le32_to_cpu(aq_desc->params.external.addr_low));

if ((buffer != NULL) && (aq_desc->datalen != 0)) {
memset(data, 0, sizeof(data));
Expand All @@ -116,15 +119,19 @@ void i40e_debug_aq(struct i40e_hw *hw, enum i40e_debug_mask mask, void *desc,
if ((i % 16) == 15) {
i40e_debug(hw, mask,
"\t0x%04X %08X %08X %08X %08X\n",
i - 15, data[0], data[1], data[2],
data[3]);
i - 15, le32_to_cpu(data[0]),
le32_to_cpu(data[1]),
le32_to_cpu(data[2]),
le32_to_cpu(data[3]));
memset(data, 0, sizeof(data));
}
}
if ((i % 16) != 0)
i40e_debug(hw, mask, "\t0x%04X %08X %08X %08X %08X\n",
i - (i % 16), data[0], data[1], data[2],
data[3]);
i - (i % 16), le32_to_cpu(data[0]),
le32_to_cpu(data[1]),
le32_to_cpu(data[2]),
le32_to_cpu(data[3]));
}
}

Expand Down Expand Up @@ -1787,7 +1794,7 @@ i40e_status i40e_aq_send_driver_version(struct i40e_hw *hw,

i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_driver_version);

desc.flags |= cpu_to_le16(I40E_AQ_FLAG_SI);
desc.flags |= cpu_to_le16(I40E_AQ_FLAG_BUF | I40E_AQ_FLAG_RD);
cmd->driver_major_ver = dv->major_version;
cmd->driver_minor_ver = dv->minor_version;
cmd->driver_build_ver = dv->build_version;
Expand Down Expand Up @@ -3346,6 +3353,47 @@ i40e_status i40e_aq_add_rem_control_packet_filter(struct i40e_hw *hw,
return status;
}

/**
* i40e_aq_alternate_read
* @hw: pointer to the hardware structure
* @reg_addr0: address of first dword to be read
* @reg_val0: pointer for data read from 'reg_addr0'
* @reg_addr1: address of second dword to be read
* @reg_val1: pointer for data read from 'reg_addr1'
*
* Read one or two dwords from alternate structure. Fields are indicated
* by 'reg_addr0' and 'reg_addr1' register numbers. If 'reg_val1' pointer
* is not passed then only register at 'reg_addr0' is read.
*
**/
i40e_status i40e_aq_alternate_read(struct i40e_hw *hw,
u32 reg_addr0, u32 *reg_val0,
u32 reg_addr1, u32 *reg_val1)
{
struct i40e_aq_desc desc;
struct i40e_aqc_alternate_write *cmd_resp =
(struct i40e_aqc_alternate_write *)&desc.params.raw;
i40e_status status;

if (!reg_val0)
return I40E_ERR_PARAM;

i40e_fill_default_direct_cmd_desc(&desc, i40e_aqc_opc_alternate_read);
cmd_resp->address0 = cpu_to_le32(reg_addr0);
cmd_resp->address1 = cpu_to_le32(reg_addr1);

status = i40e_asq_send_command(hw, &desc, NULL, 0, NULL);

if (!status) {
*reg_val0 = le32_to_cpu(cmd_resp->data0);

if (reg_val1)
*reg_val1 = le32_to_cpu(cmd_resp->data1);
}

return status;
}

/**
* i40e_aq_resume_port_tx
* @hw: pointer to the hardware structure
Expand Down Expand Up @@ -3410,3 +3458,79 @@ void i40e_set_pci_config_data(struct i40e_hw *hw, u16 link_status)
break;
}
}

/**
* i40e_read_bw_from_alt_ram
* @hw: pointer to the hardware structure
* @max_bw: pointer for max_bw read
* @min_bw: pointer for min_bw read
* @min_valid: pointer for bool that is true if min_bw is a valid value
* @max_valid: pointer for bool that is true if max_bw is a valid value
*
* Read bw from the alternate ram for the given pf
**/
i40e_status i40e_read_bw_from_alt_ram(struct i40e_hw *hw,
u32 *max_bw, u32 *min_bw,
bool *min_valid, bool *max_valid)
{
i40e_status status;
u32 max_bw_addr, min_bw_addr;

/* Calculate the address of the min/max bw registers */
max_bw_addr = I40E_ALT_STRUCT_FIRST_PF_OFFSET +
I40E_ALT_STRUCT_MAX_BW_OFFSET +
(I40E_ALT_STRUCT_DWORDS_PER_PF * hw->pf_id);
min_bw_addr = I40E_ALT_STRUCT_FIRST_PF_OFFSET +
I40E_ALT_STRUCT_MIN_BW_OFFSET +
(I40E_ALT_STRUCT_DWORDS_PER_PF * hw->pf_id);

/* Read the bandwidths from alt ram */
status = i40e_aq_alternate_read(hw, max_bw_addr, max_bw,
min_bw_addr, min_bw);

if (*min_bw & I40E_ALT_BW_VALID_MASK)
*min_valid = true;
else
*min_valid = false;

if (*max_bw & I40E_ALT_BW_VALID_MASK)
*max_valid = true;
else
*max_valid = false;

return status;
}

/**
* i40e_aq_configure_partition_bw
* @hw: pointer to the hardware structure
* @bw_data: Buffer holding valid pfs and bw limits
* @cmd_details: pointer to command details
*
* Configure partitions guaranteed/max bw
**/
i40e_status i40e_aq_configure_partition_bw(struct i40e_hw *hw,
struct i40e_aqc_configure_partition_bw_data *bw_data,
struct i40e_asq_cmd_details *cmd_details)
{
i40e_status status;
struct i40e_aq_desc desc;
u16 bwd_size = sizeof(*bw_data);

i40e_fill_default_direct_cmd_desc(&desc,
i40e_aqc_opc_configure_partition_bw);

/* Indirect command */
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_BUF);
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_RD);

if (bwd_size > I40E_AQ_LARGE_BUF)
desc.flags |= cpu_to_le16((u16)I40E_AQ_FLAG_LB);

desc.datalen = cpu_to_le16(bwd_size);

status = i40e_asq_send_command(hw, &desc, bw_data, bwd_size,
cmd_details);

return status;
}
Loading

0 comments on commit 009f33e

Please sign in to comment.