Skip to content

Commit

Permalink
Merge branch 'be2net-next'
Browse files Browse the repository at this point in the history
Sathya Perla says:

====================
be2net: patch set

Patches 1 to 6 address issues with return values of some ndo/ethtool
driver methods. In error scenarios, either an inappropriate error or
a +ve return value (where the stack expects a -ve value) was being returned.

Patch 7 updates description strings for certain UE bits.

Patch 8 cleans up (reduces) argument passing for a few routines in be_cmds.c.

Patch 9 removes some unused code (unused definitions.)

Patch 10 updates NULL check in the driver to a consistent "if (!foo)" style.

Patchs 11 to 13 fix a few minor issues with the earlier patch bec84e6
("create optimal number of queues on SR-IOV config"):
	- patch 11 fixes BEx_get_resources() code to use be_max_vfs() macro
	- patch 12 skips SR-IOV config code for BE2 that doesn't support SRIOV
	- patch 13 uses adapter->flags to track SRIOV enabled state

Patch 14 updates the driver version.
====================

Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Jul 17, 2014
2 parents 23fa5c2 + c346e6e commit 87b200e
Show file tree
Hide file tree
Showing 5 changed files with 89 additions and 105 deletions.
8 changes: 6 additions & 2 deletions drivers/net/ethernet/emulex/benet/be.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "be_hw.h"
#include "be_roce.h"

#define DRV_VER "10.2u"
#define DRV_VER "10.4u"
#define DRV_NAME "be2net"
#define BE_NAME "Emulex BladeEngine2"
#define BE3_NAME "Emulex BladeEngine3"
Expand Down Expand Up @@ -372,6 +372,7 @@ enum vf_state {
};

#define BE_FLAGS_LINK_STATUS_INIT 1
#define BE_FLAGS_SRIOV_ENABLED (1 << 2)
#define BE_FLAGS_WORKER_SCHEDULED (1 << 3)
#define BE_FLAGS_VLAN_PROMISC (1 << 4)
#define BE_FLAGS_MCAST_PROMISC (1 << 5)
Expand Down Expand Up @@ -525,7 +526,8 @@ struct be_adapter {

#define be_physfn(adapter) (!adapter->virtfn)
#define be_virtfn(adapter) (adapter->virtfn)
#define sriov_enabled(adapter) (adapter->num_vfs > 0)
#define sriov_enabled(adapter) (adapter->flags & \
BE_FLAGS_SRIOV_ENABLED)

#define for_all_vfs(adapter, vf_cfg, i) \
for (i = 0, vf_cfg = &adapter->vf_cfg[i]; i < adapter->num_vfs; \
Expand Down Expand Up @@ -672,6 +674,8 @@ static inline void swap_dws(void *wrb, int len)
#endif /* __BIG_ENDIAN */
}

#define be_cmd_status(status) (status > 0 ? -EIO : status)

static inline u8 is_tcp_pkt(struct sk_buff *skb)
{
u8 val = 0;
Expand Down
23 changes: 10 additions & 13 deletions drivers/net/ethernet/emulex/benet/be_cmds.c
Original file line number Diff line number Diff line change
Expand Up @@ -1749,8 +1749,7 @@ void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf)
}

/* Uses synchronous mcc */
int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver,
char *fw_on_flash)
int be_cmd_get_fw_ver(struct be_adapter *adapter)
{
struct be_mcc_wrb *wrb;
struct be_cmd_req_get_fw_version *req;
Expand All @@ -1772,9 +1771,8 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver,
status = be_mcc_notify_wait(adapter);
if (!status) {
struct be_cmd_resp_get_fw_version *resp = embedded_payload(wrb);
strcpy(fw_ver, resp->firmware_version_string);
if (fw_on_flash)
strcpy(fw_on_flash, resp->fw_on_flash_version_string);
strcpy(adapter->fw_ver, resp->firmware_version_string);
strcpy(adapter->fw_on_flash, resp->fw_on_flash_version_string);
}
err:
spin_unlock_bh(&adapter->mcc_lock);
Expand Down Expand Up @@ -1997,8 +1995,7 @@ int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc)
}

/* Uses mbox */
int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
u32 *mode, u32 *caps, u16 *asic_rev)
int be_cmd_query_fw_cfg(struct be_adapter *adapter)
{
struct be_mcc_wrb *wrb;
struct be_cmd_req_query_fw_cfg *req;
Expand All @@ -2017,10 +2014,10 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
status = be_mbox_notify_wait(adapter);
if (!status) {
struct be_cmd_resp_query_fw_cfg *resp = embedded_payload(wrb);
*port_num = le32_to_cpu(resp->phys_port);
*mode = le32_to_cpu(resp->function_mode);
*caps = le32_to_cpu(resp->function_caps);
*asic_rev = le32_to_cpu(resp->asic_revision) & 0xFF;
adapter->port_num = le32_to_cpu(resp->phys_port);
adapter->function_mode = le32_to_cpu(resp->function_mode);
adapter->function_caps = le32_to_cpu(resp->function_caps);
adapter->asic_rev = le32_to_cpu(resp->asic_revision) & 0xFF;
}

mutex_unlock(&adapter->mbox_lock);
Expand Down Expand Up @@ -2224,7 +2221,7 @@ int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,

if (!wait_for_completion_timeout(&adapter->et_cmd_compl,
msecs_to_jiffies(60000)))
status = -1;
status = -ETIMEDOUT;
else
status = adapter->flash_status;

Expand Down Expand Up @@ -2320,7 +2317,7 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,

if (!wait_for_completion_timeout(&adapter->et_cmd_compl,
msecs_to_jiffies(40000)))
status = -1;
status = -ETIMEDOUT;
else
status = adapter->flash_status;

Expand Down
35 changes: 2 additions & 33 deletions drivers/net/ethernet/emulex/benet/be_cmds.h
Original file line number Diff line number Diff line change
Expand Up @@ -1081,11 +1081,6 @@ struct be_cmd_req_modify_eq_delay {
struct be_set_eqd set_eqd[MAX_EVT_QS];
} __packed;

struct be_cmd_resp_modify_eq_delay {
struct be_cmd_resp_hdr hdr;
u32 rsvd0;
} __packed;

/******************** Get FW Config *******************/
/* The HW can come up in either of the following multi-channel modes
* based on the skew/IPL.
Expand Down Expand Up @@ -1156,11 +1151,6 @@ struct be_cmd_req_enable_disable_beacon {
u8 status_duration;
} __packed;

struct be_cmd_resp_enable_disable_beacon {
struct be_cmd_resp_hdr resp_hdr;
u32 rsvd0;
} __packed;

struct be_cmd_req_get_beacon_state {
struct be_cmd_req_hdr hdr;
u8 port_num;
Expand Down Expand Up @@ -1326,11 +1316,6 @@ struct be_cmd_req_set_lmode {
u8 loopback_state;
};

struct be_cmd_resp_set_lmode {
struct be_cmd_resp_hdr resp_hdr;
u8 rsvd0[4];
};

/********************** DDR DMA test *********************/
struct be_cmd_req_ddrdma_test {
struct be_cmd_req_hdr hdr;
Expand Down Expand Up @@ -1434,11 +1419,6 @@ struct be_cmd_req_set_qos {
u32 rsvd[7];
};

struct be_cmd_resp_set_qos {
struct be_cmd_resp_hdr hdr;
u32 rsvd;
};

/*********************** Controller Attributes ***********************/
struct be_cmd_req_cntl_attribs {
struct be_cmd_req_hdr hdr;
Expand Down Expand Up @@ -1572,11 +1552,6 @@ struct be_cmd_req_set_hsw_config {
u8 context[sizeof(struct amap_set_hsw_context) / 8];
} __packed;

struct be_cmd_resp_set_hsw_config {
struct be_cmd_resp_hdr hdr;
u32 rsvd;
};

struct amap_get_hsw_req_context {
u8 interface_id[16];
u8 rsvd0[14];
Expand Down Expand Up @@ -1966,10 +1941,6 @@ struct be_cmd_req_set_profile_config {
u8 desc[2 * RESOURCE_DESC_SIZE_V1];
} __packed;

struct be_cmd_resp_set_profile_config {
struct be_cmd_resp_hdr hdr;
};

struct be_cmd_req_get_active_profile {
struct be_cmd_req_hdr hdr;
u32 rsvd;
Expand Down Expand Up @@ -2071,16 +2042,14 @@ int be_cmd_reset(struct be_adapter *adapter);
int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd);
int lancer_cmd_get_pport_stats(struct be_adapter *adapter,
struct be_dma_mem *nonemb_cmd);
int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver,
char *fw_on_flash);
int be_cmd_get_fw_ver(struct be_adapter *adapter);
int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *, int num);
int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
u32 num);
int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status);
int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc);
int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc);
int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
u32 *function_mode, u32 *function_caps, u16 *asic_rev);
int be_cmd_query_fw_cfg(struct be_adapter *adapter);
int be_cmd_reset_function(struct be_adapter *adapter);
int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
u32 rss_hash_opts, u16 table_size, const u8 *rss_hkey);
Expand Down
12 changes: 7 additions & 5 deletions drivers/net/ethernet/emulex/benet/be_ethtool.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
if (status)
dev_warn(&adapter->pdev->dev, "Pause param set failed.\n");

return status;
return be_cmd_status(status);
}

static int be_set_phys_id(struct net_device *netdev,
Expand Down Expand Up @@ -762,7 +762,7 @@ static int be_test_ddr_dma(struct be_adapter *adapter)
err:
dma_free_coherent(&adapter->pdev->dev, ddrdma_cmd.size, ddrdma_cmd.va,
ddrdma_cmd.dma);
return ret;
return be_cmd_status(ret);
}

static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type,
Expand Down Expand Up @@ -885,7 +885,7 @@ static int be_read_eeprom(struct net_device *netdev,
dma_free_coherent(&adapter->pdev->dev, eeprom_cmd.size, eeprom_cmd.va,
eeprom_cmd.dma);

return status;
return be_cmd_status(status);
}

static u32 be_get_msg_level(struct net_device *netdev)
Expand Down Expand Up @@ -1042,7 +1042,7 @@ static int be_set_rss_hash_opts(struct be_adapter *adapter,
if (!status)
adapter->rss_info.rss_flags = rss_flags;

return status;
return be_cmd_status(status);
}

static int be_set_rxnfc(struct net_device *netdev, struct ethtool_rxnfc *cmd)
Expand Down Expand Up @@ -1080,14 +1080,16 @@ static int be_set_channels(struct net_device *netdev,
struct ethtool_channels *ch)
{
struct be_adapter *adapter = netdev_priv(netdev);
int status;

if (ch->rx_count || ch->tx_count || ch->other_count ||
!ch->combined_count || ch->combined_count > be_max_qs(adapter))
return -EINVAL;

adapter->cfg_num_qs = ch->combined_count;

return be_update_queues(adapter);
status = be_update_queues(adapter);
return be_cmd_status(status);
}

static u32 be_get_rxfh_indir_size(struct net_device *netdev)
Expand Down
Loading

0 comments on commit 87b200e

Please sign in to comment.