Commit 97e72829 authored by David S. Miller's avatar David S. Miller

Merge branch 'be2net-next'

Sathya Perla says:

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

This patch set contains the following modificatons:
* three patches (1/7 to 3/7) that fix indentation style issues
* convert the u8 vlan[] array to a bit-map to reduce memory usage
* use MCCQ instead of MBOX in be_cmd_rss_config() as the MCCQ is already
  created by that time
* include rx-comp-error counter in ethtool stats
* remove the unused promiscuous setting from be_cmd_vlan_config()

Pls apply to net-next tree. Thanks!
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents fe6f397c b51aa367
...@@ -455,7 +455,7 @@ struct be_adapter { ...@@ -455,7 +455,7 @@ struct be_adapter {
struct be_drv_stats drv_stats; struct be_drv_stats drv_stats;
struct be_aic_obj aic_obj[MAX_EVT_QS]; struct be_aic_obj aic_obj[MAX_EVT_QS];
u16 vlans_added; u16 vlans_added;
u8 vlan_tag[VLAN_N_VID]; unsigned long vids[BITS_TO_LONGS(VLAN_N_VID)];
u8 vlan_prio_bmap; /* Available Priority BitMap */ u8 vlan_prio_bmap; /* Available Priority BitMap */
u16 recommended_prio; /* Recommended Priority */ u16 recommended_prio; /* Recommended Priority */
struct be_dma_mem rx_filter; /* Cmd DMA mem for rx-filter */ struct be_dma_mem rx_filter; /* Cmd DMA mem for rx-filter */
......
...@@ -52,8 +52,7 @@ static struct be_cmd_priv_map cmd_priv_map[] = { ...@@ -52,8 +52,7 @@ static struct be_cmd_priv_map cmd_priv_map[] = {
} }
}; };
static bool be_cmd_allowed(struct be_adapter *adapter, u8 opcode, static bool be_cmd_allowed(struct be_adapter *adapter, u8 opcode, u8 subsystem)
u8 subsystem)
{ {
int i; int i;
int num_entries = sizeof(cmd_priv_map)/sizeof(struct be_cmd_priv_map); int num_entries = sizeof(cmd_priv_map)/sizeof(struct be_cmd_priv_map);
...@@ -221,7 +220,9 @@ static void be_async_link_state_process(struct be_adapter *adapter, ...@@ -221,7 +220,9 @@ static void be_async_link_state_process(struct be_adapter *adapter,
/* Grp5 CoS Priority evt */ /* Grp5 CoS Priority evt */
static void be_async_grp5_cos_priority_process(struct be_adapter *adapter, static void be_async_grp5_cos_priority_process(struct be_adapter *adapter,
struct be_async_event_grp5_cos_priority *evt) struct
be_async_event_grp5_cos_priority
*evt)
{ {
if (evt->valid) { if (evt->valid) {
adapter->vlan_prio_bmap = evt->available_priority_bmap; adapter->vlan_prio_bmap = evt->available_priority_bmap;
...@@ -233,7 +234,9 @@ static void be_async_grp5_cos_priority_process(struct be_adapter *adapter, ...@@ -233,7 +234,9 @@ static void be_async_grp5_cos_priority_process(struct be_adapter *adapter,
/* Grp5 QOS Speed evt: qos_link_speed is in units of 10 Mbps */ /* Grp5 QOS Speed evt: qos_link_speed is in units of 10 Mbps */
static void be_async_grp5_qos_speed_process(struct be_adapter *adapter, static void be_async_grp5_qos_speed_process(struct be_adapter *adapter,
struct be_async_event_grp5_qos_link_speed *evt) struct
be_async_event_grp5_qos_link_speed
*evt)
{ {
if (adapter->phy.link_speed >= 0 && if (adapter->phy.link_speed >= 0 &&
evt->physical_port == adapter->port_num) evt->physical_port == adapter->port_num)
...@@ -242,7 +245,9 @@ static void be_async_grp5_qos_speed_process(struct be_adapter *adapter, ...@@ -242,7 +245,9 @@ static void be_async_grp5_qos_speed_process(struct be_adapter *adapter,
/*Grp5 PVID evt*/ /*Grp5 PVID evt*/
static void be_async_grp5_pvid_state_process(struct be_adapter *adapter, static void be_async_grp5_pvid_state_process(struct be_adapter *adapter,
struct be_async_event_grp5_pvid_state *evt) struct
be_async_event_grp5_pvid_state
*evt)
{ {
if (evt->enabled) { if (evt->enabled) {
adapter->pvid = le16_to_cpu(evt->tag) & VLAN_VID_MASK; adapter->pvid = le16_to_cpu(evt->tag) & VLAN_VID_MASK;
...@@ -560,10 +565,8 @@ static bool lancer_provisioning_error(struct be_adapter *adapter) ...@@ -560,10 +565,8 @@ static bool lancer_provisioning_error(struct be_adapter *adapter)
u32 sliport_status = 0, sliport_err1 = 0, sliport_err2 = 0; u32 sliport_status = 0, sliport_err1 = 0, sliport_err2 = 0;
sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET); sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET);
if (sliport_status & SLIPORT_STATUS_ERR_MASK) { if (sliport_status & SLIPORT_STATUS_ERR_MASK) {
sliport_err1 = ioread32(adapter->db + sliport_err1 = ioread32(adapter->db + SLIPORT_ERROR1_OFFSET);
SLIPORT_ERROR1_OFFSET); sliport_err2 = ioread32(adapter->db + SLIPORT_ERROR2_OFFSET);
sliport_err2 = ioread32(adapter->db +
SLIPORT_ERROR2_OFFSET);
if (sliport_err1 == SLIPORT_ERROR_NO_RESOURCE1 && if (sliport_err1 == SLIPORT_ERROR_NO_RESOURCE1 &&
sliport_err2 == SLIPORT_ERROR_NO_RESOURCE2) sliport_err2 == SLIPORT_ERROR_NO_RESOURCE2)
...@@ -630,8 +633,7 @@ int be_fw_wait_ready(struct be_adapter *adapter) ...@@ -630,8 +633,7 @@ int be_fw_wait_ready(struct be_adapter *adapter)
if (stage == POST_STAGE_ARMFW_RDY) if (stage == POST_STAGE_ARMFW_RDY)
return 0; return 0;
dev_info(dev, "Waiting for POST, %ds elapsed\n", dev_info(dev, "Waiting for POST, %ds elapsed\n", timeout);
timeout);
if (msleep_interruptible(2000)) { if (msleep_interruptible(2000)) {
dev_err(dev, "Waiting for POST aborted\n"); dev_err(dev, "Waiting for POST aborted\n");
return -EINTR; return -EINTR;
...@@ -649,8 +651,7 @@ static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb) ...@@ -649,8 +651,7 @@ static inline struct be_sge *nonembedded_sgl(struct be_mcc_wrb *wrb)
return &wrb->payload.sgl[0]; return &wrb->payload.sgl[0];
} }
static inline void fill_wrb_tags(struct be_mcc_wrb *wrb, static inline void fill_wrb_tags(struct be_mcc_wrb *wrb, unsigned long addr)
unsigned long addr)
{ {
wrb->tag0 = addr & 0xFFFFFFFF; wrb->tag0 = addr & 0xFFFFFFFF;
wrb->tag1 = upper_32_bits(addr); wrb->tag1 = upper_32_bits(addr);
...@@ -660,7 +661,8 @@ static inline void fill_wrb_tags(struct be_mcc_wrb *wrb, ...@@ -660,7 +661,8 @@ static inline void fill_wrb_tags(struct be_mcc_wrb *wrb,
/* mem will be NULL for embedded commands */ /* mem will be NULL for embedded commands */
static void be_wrb_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr, static void be_wrb_cmd_hdr_prepare(struct be_cmd_req_hdr *req_hdr,
u8 subsystem, u8 opcode, int cmd_len, u8 subsystem, u8 opcode, int cmd_len,
struct be_mcc_wrb *wrb, struct be_dma_mem *mem) struct be_mcc_wrb *wrb,
struct be_dma_mem *mem)
{ {
struct be_sge *sge; struct be_sge *sge;
...@@ -868,7 +870,8 @@ int be_cmd_eq_create(struct be_adapter *adapter, struct be_eq_obj *eqo) ...@@ -868,7 +870,8 @@ int be_cmd_eq_create(struct be_adapter *adapter, struct be_eq_obj *eqo)
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_EQ_CREATE, sizeof(*req), wrb, NULL); OPCODE_COMMON_EQ_CREATE, sizeof(*req), wrb,
NULL);
/* Support for EQ_CREATEv2 available only SH-R onwards */ /* Support for EQ_CREATEv2 available only SH-R onwards */
if (!(BEx_chip(adapter) || lancer_chip(adapter))) if (!(BEx_chip(adapter) || lancer_chip(adapter)))
...@@ -917,7 +920,8 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr, ...@@ -917,7 +920,8 @@ int be_cmd_mac_addr_query(struct be_adapter *adapter, u8 *mac_addr,
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_NTWK_MAC_QUERY, sizeof(*req), wrb, NULL); OPCODE_COMMON_NTWK_MAC_QUERY, sizeof(*req), wrb,
NULL);
req->type = MAC_ADDRESS_TYPE_NETWORK; req->type = MAC_ADDRESS_TYPE_NETWORK;
if (permanent) { if (permanent) {
req->permanent = 1; req->permanent = 1;
...@@ -956,7 +960,8 @@ int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr, ...@@ -956,7 +960,8 @@ int be_cmd_pmac_add(struct be_adapter *adapter, u8 *mac_addr,
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_NTWK_PMAC_ADD, sizeof(*req), wrb, NULL); OPCODE_COMMON_NTWK_PMAC_ADD, sizeof(*req), wrb,
NULL);
req->hdr.domain = domain; req->hdr.domain = domain;
req->if_id = cpu_to_le32(if_id); req->if_id = cpu_to_le32(if_id);
...@@ -1028,7 +1033,8 @@ int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq, ...@@ -1028,7 +1033,8 @@ int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq,
ctxt = &req->context; ctxt = &req->context;
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_CQ_CREATE, sizeof(*req), wrb, NULL); OPCODE_COMMON_CQ_CREATE, sizeof(*req), wrb,
NULL);
req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
...@@ -1038,7 +1044,7 @@ int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq, ...@@ -1038,7 +1044,7 @@ int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq,
AMAP_SET_BITS(struct amap_cq_context_be, nodelay, AMAP_SET_BITS(struct amap_cq_context_be, nodelay,
ctxt, no_delay); ctxt, no_delay);
AMAP_SET_BITS(struct amap_cq_context_be, count, ctxt, AMAP_SET_BITS(struct amap_cq_context_be, count, ctxt,
__ilog2_u32(cq->len/256)); __ilog2_u32(cq->len / 256));
AMAP_SET_BITS(struct amap_cq_context_be, valid, ctxt, 1); AMAP_SET_BITS(struct amap_cq_context_be, valid, ctxt, 1);
AMAP_SET_BITS(struct amap_cq_context_be, eventable, ctxt, 1); AMAP_SET_BITS(struct amap_cq_context_be, eventable, ctxt, 1);
AMAP_SET_BITS(struct amap_cq_context_be, eqid, ctxt, eq->id); AMAP_SET_BITS(struct amap_cq_context_be, eqid, ctxt, eq->id);
...@@ -1055,12 +1061,10 @@ int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq, ...@@ -1055,12 +1061,10 @@ int be_cmd_cq_create(struct be_adapter *adapter, struct be_queue_info *cq,
AMAP_SET_BITS(struct amap_cq_context_v2, nodelay, ctxt, AMAP_SET_BITS(struct amap_cq_context_v2, nodelay, ctxt,
no_delay); no_delay);
AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt, AMAP_SET_BITS(struct amap_cq_context_v2, count, ctxt,
__ilog2_u32(cq->len/256)); __ilog2_u32(cq->len / 256));
AMAP_SET_BITS(struct amap_cq_context_v2, valid, ctxt, 1); AMAP_SET_BITS(struct amap_cq_context_v2, valid, ctxt, 1);
AMAP_SET_BITS(struct amap_cq_context_v2, eventable, AMAP_SET_BITS(struct amap_cq_context_v2, eventable, ctxt, 1);
ctxt, 1); AMAP_SET_BITS(struct amap_cq_context_v2, eqid, ctxt, eq->id);
AMAP_SET_BITS(struct amap_cq_context_v2, eqid,
ctxt, eq->id);
} }
be_dws_cpu_to_le(ctxt, sizeof(req->context)); be_dws_cpu_to_le(ctxt, sizeof(req->context));
...@@ -1105,7 +1109,8 @@ static int be_cmd_mccq_ext_create(struct be_adapter *adapter, ...@@ -1105,7 +1109,8 @@ static int be_cmd_mccq_ext_create(struct be_adapter *adapter,
ctxt = &req->context; ctxt = &req->context;
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_MCC_CREATE_EXT, sizeof(*req), wrb, NULL); OPCODE_COMMON_MCC_CREATE_EXT, sizeof(*req), wrb,
NULL);
req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
if (BEx_chip(adapter)) { if (BEx_chip(adapter)) {
...@@ -1162,7 +1167,8 @@ static int be_cmd_mccq_org_create(struct be_adapter *adapter, ...@@ -1162,7 +1167,8 @@ static int be_cmd_mccq_org_create(struct be_adapter *adapter,
ctxt = &req->context; ctxt = &req->context;
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_MCC_CREATE, sizeof(*req), wrb, NULL); OPCODE_COMMON_MCC_CREATE, sizeof(*req), wrb,
NULL);
req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size)); req->num_pages = cpu_to_le16(PAGES_4K_SPANNED(q_mem->va, q_mem->size));
...@@ -1187,8 +1193,7 @@ static int be_cmd_mccq_org_create(struct be_adapter *adapter, ...@@ -1187,8 +1193,7 @@ static int be_cmd_mccq_org_create(struct be_adapter *adapter,
} }
int be_cmd_mccq_create(struct be_adapter *adapter, int be_cmd_mccq_create(struct be_adapter *adapter,
struct be_queue_info *mccq, struct be_queue_info *mccq, struct be_queue_info *cq)
struct be_queue_info *cq)
{ {
int status; int status;
...@@ -1384,7 +1389,8 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags, ...@@ -1384,7 +1389,8 @@ int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags,
req = embedded_payload(&wrb); req = embedded_payload(&wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_NTWK_INTERFACE_CREATE, sizeof(*req), &wrb, NULL); OPCODE_COMMON_NTWK_INTERFACE_CREATE,
sizeof(*req), &wrb, NULL);
req->hdr.domain = domain; req->hdr.domain = domain;
req->capability_flags = cpu_to_le32(cap_flags); req->capability_flags = cpu_to_le32(cap_flags);
req->enable_flags = cpu_to_le32(en_flags); req->enable_flags = cpu_to_le32(en_flags);
...@@ -1422,7 +1428,8 @@ int be_cmd_if_destroy(struct be_adapter *adapter, int interface_id, u32 domain) ...@@ -1422,7 +1428,8 @@ int be_cmd_if_destroy(struct be_adapter *adapter, int interface_id, u32 domain)
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_NTWK_INTERFACE_DESTROY, sizeof(*req), wrb, NULL); OPCODE_COMMON_NTWK_INTERFACE_DESTROY,
sizeof(*req), wrb, NULL);
req->hdr.domain = domain; req->hdr.domain = domain;
req->interface_id = cpu_to_le32(interface_id); req->interface_id = cpu_to_le32(interface_id);
...@@ -1452,7 +1459,8 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd) ...@@ -1452,7 +1459,8 @@ int be_cmd_get_stats(struct be_adapter *adapter, struct be_dma_mem *nonemb_cmd)
hdr = nonemb_cmd->va; hdr = nonemb_cmd->va;
be_wrb_cmd_hdr_prepare(hdr, CMD_SUBSYSTEM_ETH, be_wrb_cmd_hdr_prepare(hdr, CMD_SUBSYSTEM_ETH,
OPCODE_ETH_GET_STATISTICS, nonemb_cmd->size, wrb, nonemb_cmd); OPCODE_ETH_GET_STATISTICS, nonemb_cmd->size, wrb,
nonemb_cmd);
/* version 1 of the cmd is not supported only by BE2 */ /* version 1 of the cmd is not supported only by BE2 */
if (BE2_chip(adapter)) if (BE2_chip(adapter))
...@@ -1493,8 +1501,8 @@ int lancer_cmd_get_pport_stats(struct be_adapter *adapter, ...@@ -1493,8 +1501,8 @@ int lancer_cmd_get_pport_stats(struct be_adapter *adapter,
req = nonemb_cmd->va; req = nonemb_cmd->va;
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH,
OPCODE_ETH_GET_PPORT_STATS, nonemb_cmd->size, wrb, OPCODE_ETH_GET_PPORT_STATS, nonemb_cmd->size,
nonemb_cmd); wrb, nonemb_cmd);
req->cmd_params.params.pport_num = cpu_to_le16(adapter->hba_port_num); req->cmd_params.params.pport_num = cpu_to_le16(adapter->hba_port_num);
req->cmd_params.params.reset_stats = 0; req->cmd_params.params.reset_stats = 0;
...@@ -1553,7 +1561,8 @@ int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed, ...@@ -1553,7 +1561,8 @@ int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed,
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_NTWK_LINK_STATUS_QUERY, sizeof(*req), wrb, NULL); OPCODE_COMMON_NTWK_LINK_STATUS_QUERY,
sizeof(*req), wrb, NULL);
/* version 1 of the cmd is not supported only by BE2 */ /* version 1 of the cmd is not supported only by BE2 */
if (!BE2_chip(adapter)) if (!BE2_chip(adapter))
...@@ -1598,8 +1607,8 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter) ...@@ -1598,8 +1607,8 @@ int be_cmd_get_die_temperature(struct be_adapter *adapter)
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES, sizeof(*req), OPCODE_COMMON_GET_CNTL_ADDITIONAL_ATTRIBUTES,
wrb, NULL); sizeof(*req), wrb, NULL);
be_mcc_notify(adapter); be_mcc_notify(adapter);
...@@ -1625,7 +1634,8 @@ int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size) ...@@ -1625,7 +1634,8 @@ int be_cmd_get_reg_len(struct be_adapter *adapter, u32 *log_size)
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_MANAGE_FAT, sizeof(*req), wrb, NULL); OPCODE_COMMON_MANAGE_FAT, sizeof(*req), wrb,
NULL);
req->fat_operation = cpu_to_le32(QUERY_FAT); req->fat_operation = cpu_to_le32(QUERY_FAT);
status = be_mcc_notify_wait(adapter); status = be_mcc_notify_wait(adapter);
if (!status) { if (!status) {
...@@ -1679,8 +1689,8 @@ void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf) ...@@ -1679,8 +1689,8 @@ void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf)
payload_len = sizeof(struct be_cmd_req_get_fat) + buf_size; payload_len = sizeof(struct be_cmd_req_get_fat) + buf_size;
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_MANAGE_FAT, payload_len, wrb, OPCODE_COMMON_MANAGE_FAT, payload_len,
&get_fat_cmd); wrb, &get_fat_cmd);
req->fat_operation = cpu_to_le32(RETRIEVE_FAT); req->fat_operation = cpu_to_le32(RETRIEVE_FAT);
req->read_log_offset = cpu_to_le32(log_offset); req->read_log_offset = cpu_to_le32(log_offset);
...@@ -1702,8 +1712,7 @@ void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf) ...@@ -1702,8 +1712,7 @@ void be_cmd_get_regs(struct be_adapter *adapter, u32 buf_len, void *buf)
} }
err: err:
pci_free_consistent(adapter->pdev, get_fat_cmd.size, pci_free_consistent(adapter->pdev, get_fat_cmd.size,
get_fat_cmd.va, get_fat_cmd.va, get_fat_cmd.dma);
get_fat_cmd.dma);
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
} }
...@@ -1726,7 +1735,8 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver, ...@@ -1726,7 +1735,8 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver,
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_GET_FW_VERSION, sizeof(*req), wrb, NULL); OPCODE_COMMON_GET_FW_VERSION, sizeof(*req), wrb,
NULL);
status = be_mcc_notify_wait(adapter); status = be_mcc_notify_wait(adapter);
if (!status) { if (!status) {
struct be_cmd_resp_get_fw_version *resp = embedded_payload(wrb); struct be_cmd_resp_get_fw_version *resp = embedded_payload(wrb);
...@@ -1759,7 +1769,8 @@ int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *set_eqd, ...@@ -1759,7 +1769,8 @@ int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *set_eqd,
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_MODIFY_EQ_DELAY, sizeof(*req), wrb, NULL); OPCODE_COMMON_MODIFY_EQ_DELAY, sizeof(*req), wrb,
NULL);
req->num_eq = cpu_to_le32(num); req->num_eq = cpu_to_le32(num);
for (i = 0; i < num; i++) { for (i = 0; i < num; i++) {
...@@ -1777,7 +1788,7 @@ int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *set_eqd, ...@@ -1777,7 +1788,7 @@ int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *set_eqd,
/* Uses sycnhronous mcc */ /* Uses sycnhronous mcc */
int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
u32 num, bool promiscuous) u32 num)
{ {
struct be_mcc_wrb *wrb; struct be_mcc_wrb *wrb;
struct be_cmd_req_vlan_config *req; struct be_cmd_req_vlan_config *req;
...@@ -1793,19 +1804,16 @@ int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array, ...@@ -1793,19 +1804,16 @@ int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_NTWK_VLAN_CONFIG, sizeof(*req), wrb, NULL); OPCODE_COMMON_NTWK_VLAN_CONFIG, sizeof(*req),
wrb, NULL);
req->interface_id = if_id; req->interface_id = if_id;
req->promiscuous = promiscuous;
req->untagged = BE_IF_FLAGS_UNTAGGED & be_if_cap_flags(adapter) ? 1 : 0; req->untagged = BE_IF_FLAGS_UNTAGGED & be_if_cap_flags(adapter) ? 1 : 0;
req->num_vlan = num; req->num_vlan = num;
if (!promiscuous) {
memcpy(req->normal_vlan, vtag_array, memcpy(req->normal_vlan, vtag_array,
req->num_vlan * sizeof(vtag_array[0])); req->num_vlan * sizeof(vtag_array[0]));
}
status = be_mcc_notify_wait(adapter); status = be_mcc_notify_wait(adapter);
err: err:
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
return status; return status;
...@@ -1836,7 +1844,8 @@ int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value) ...@@ -1836,7 +1844,8 @@ int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 value)
BE_IF_FLAGS_VLAN_PROMISCUOUS | BE_IF_FLAGS_VLAN_PROMISCUOUS |
BE_IF_FLAGS_MCAST_PROMISCUOUS); BE_IF_FLAGS_MCAST_PROMISCUOUS);
if (value == ON) if (value == ON)
req->if_flags = cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS | req->if_flags =
cpu_to_le32(BE_IF_FLAGS_PROMISCUOUS |
BE_IF_FLAGS_VLAN_PROMISCUOUS | BE_IF_FLAGS_VLAN_PROMISCUOUS |
BE_IF_FLAGS_MCAST_PROMISCUOUS); BE_IF_FLAGS_MCAST_PROMISCUOUS);
} else if (flags & IFF_ALLMULTI) { } else if (flags & IFF_ALLMULTI) {
...@@ -1905,7 +1914,8 @@ int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc) ...@@ -1905,7 +1914,8 @@ int be_cmd_set_flow_control(struct be_adapter *adapter, u32 tx_fc, u32 rx_fc)
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_SET_FLOW_CONTROL, sizeof(*req), wrb, NULL); OPCODE_COMMON_SET_FLOW_CONTROL, sizeof(*req),
wrb, NULL);
req->tx_flow_control = cpu_to_le16((u16)tx_fc); req->tx_flow_control = cpu_to_le16((u16)tx_fc);
req->rx_flow_control = cpu_to_le16((u16)rx_fc); req->rx_flow_control = cpu_to_le16((u16)rx_fc);
...@@ -1938,7 +1948,8 @@ int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc) ...@@ -1938,7 +1948,8 @@ int be_cmd_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc)
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_GET_FLOW_CONTROL, sizeof(*req), wrb, NULL); OPCODE_COMMON_GET_FLOW_CONTROL, sizeof(*req),
wrb, NULL);
status = be_mcc_notify_wait(adapter); status = be_mcc_notify_wait(adapter);
if (!status) { if (!status) {
...@@ -1968,7 +1979,8 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num, ...@@ -1968,7 +1979,8 @@ int be_cmd_query_fw_cfg(struct be_adapter *adapter, u32 *port_num,
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_QUERY_FIRMWARE_CONFIG, sizeof(*req), wrb, NULL); OPCODE_COMMON_QUERY_FIRMWARE_CONFIG,
sizeof(*req), wrb, NULL);
status = be_mbox_notify_wait(adapter); status = be_mbox_notify_wait(adapter);
if (!status) { if (!status) {
...@@ -2011,7 +2023,8 @@ int be_cmd_reset_function(struct be_adapter *adapter) ...@@ -2011,7 +2023,8 @@ int be_cmd_reset_function(struct be_adapter *adapter)
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(req, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(req, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_FUNCTION_RESET, sizeof(*req), wrb, NULL); OPCODE_COMMON_FUNCTION_RESET, sizeof(*req), wrb,
NULL);
status = be_mbox_notify_wait(adapter); status = be_mbox_notify_wait(adapter);
...@@ -2029,10 +2042,13 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, ...@@ -2029,10 +2042,13 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
if (!(be_if_cap_flags(adapter) & BE_IF_FLAGS_RSS)) if (!(be_if_cap_flags(adapter) & BE_IF_FLAGS_RSS))
return 0; return 0;
if (mutex_lock_interruptible(&adapter->mbox_lock)) spin_lock_bh(&adapter->mcc_lock);
return -1;
wrb = wrb_from_mbox(adapter); wrb = wrb_from_mccq(adapter);
if (!wrb) {
status = -EBUSY;
goto err;
}
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH,
...@@ -2042,16 +2058,16 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable, ...@@ -2042,16 +2058,16 @@ int be_cmd_rss_config(struct be_adapter *adapter, u8 *rsstable,
req->enable_rss = cpu_to_le16(rss_hash_opts); req->enable_rss = cpu_to_le16(rss_hash_opts);
req->cpu_table_size_log2 = cpu_to_le16(fls(table_size) - 1); req->cpu_table_size_log2 = cpu_to_le16(fls(table_size) - 1);
if (lancer_chip(adapter) || skyhawk_chip(adapter)) if (!BEx_chip(adapter))
req->hdr.version = 1; req->hdr.version = 1;
memcpy(req->cpu_table, rsstable, table_size); memcpy(req->cpu_table, rsstable, table_size);
memcpy(req->hash, rss_hkey, RSS_HASH_KEY_LEN); memcpy(req->hash, rss_hkey, RSS_HASH_KEY_LEN);
be_dws_cpu_to_le(req->hash, sizeof(req->hash)); be_dws_cpu_to_le(req->hash, sizeof(req->hash));
status = be_mbox_notify_wait(adapter); status = be_mcc_notify_wait(adapter);
err:
mutex_unlock(&adapter->mbox_lock); spin_unlock_bh(&adapter->mcc_lock);
return status; return status;
} }
...@@ -2073,7 +2089,8 @@ int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num, ...@@ -2073,7 +2089,8 @@ int be_cmd_set_beacon_state(struct be_adapter *adapter, u8 port_num,
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_ENABLE_DISABLE_BEACON, sizeof(*req), wrb, NULL); OPCODE_COMMON_ENABLE_DISABLE_BEACON,
sizeof(*req), wrb, NULL);
req->port_num = port_num; req->port_num = port_num;
req->beacon_state = state; req->beacon_state = state;
...@@ -2104,7 +2121,8 @@ int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, u32 *state) ...@@ -2104,7 +2121,8 @@ int be_cmd_get_beacon_state(struct be_adapter *adapter, u8 port_num, u32 *state)
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_GET_BEACON_STATE, sizeof(*req), wrb, NULL); OPCODE_COMMON_GET_BEACON_STATE, sizeof(*req),
wrb, NULL);
req->port_num = port_num; req->port_num = port_num;
...@@ -2258,7 +2276,8 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd, ...@@ -2258,7 +2276,8 @@ int be_cmd_write_flashrom(struct be_adapter *adapter, struct be_dma_mem *cmd,
req = cmd->va; req = cmd->va;
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_WRITE_FLASHROM, cmd->size, wrb, cmd); OPCODE_COMMON_WRITE_FLASHROM, cmd->size, wrb,
cmd);
req->params.op_type = cpu_to_le32(flash_type); req->params.op_type = cpu_to_le32(flash_type);
req->params.op_code = cpu_to_le32(flash_opcode); req->params.op_code = cpu_to_le32(flash_opcode);
...@@ -2331,8 +2350,8 @@ int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac, ...@@ -2331,8 +2350,8 @@ int be_cmd_enable_magic_wol(struct be_adapter *adapter, u8 *mac,
req = nonemb_cmd->va; req = nonemb_cmd->va;
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_ETH,
OPCODE_ETH_ACPI_WOL_MAGIC_CONFIG, sizeof(*req), wrb, OPCODE_ETH_ACPI_WOL_MAGIC_CONFIG, sizeof(*req),
nonemb_cmd); wrb, nonemb_cmd);
memcpy(req->magic_mac, mac, ETH_ALEN); memcpy(req->magic_mac, mac, ETH_ALEN);
status = be_mcc_notify_wait(adapter); status = be_mcc_notify_wait(adapter);
...@@ -2360,8 +2379,8 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, ...@@ -2360,8 +2379,8 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL,
OPCODE_LOWLEVEL_SET_LOOPBACK_MODE, sizeof(*req), wrb, OPCODE_LOWLEVEL_SET_LOOPBACK_MODE, sizeof(*req),
NULL); wrb, NULL);
req->src_port = port_num; req->src_port = port_num;
req->dest_port = port_num; req->dest_port = port_num;
...@@ -2375,7 +2394,8 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num, ...@@ -2375,7 +2394,8 @@ int be_cmd_set_loopback(struct be_adapter *adapter, u8 port_num,
} }
int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
u32 loopback_type, u32 pkt_size, u32 num_pkts, u64 pattern) u32 loopback_type, u32 pkt_size, u32 num_pkts,
u64 pattern)
{ {
struct be_mcc_wrb *wrb; struct be_mcc_wrb *wrb;
struct be_cmd_req_loopback_test *req; struct be_cmd_req_loopback_test *req;
...@@ -2393,7 +2413,8 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num, ...@@ -2393,7 +2413,8 @@ int be_cmd_loopback_test(struct be_adapter *adapter, u32 port_num,
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL,
OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req), wrb, NULL); OPCODE_LOWLEVEL_LOOPBACK_TEST, sizeof(*req), wrb,
NULL);
req->hdr.timeout = cpu_to_le32(15); req->hdr.timeout = cpu_to_le32(15);
req->pattern = cpu_to_le64(pattern); req->pattern = cpu_to_le64(pattern);
...@@ -2434,7 +2455,8 @@ int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern, ...@@ -2434,7 +2455,8 @@ int be_cmd_ddr_dma_test(struct be_adapter *adapter, u64 pattern,
} }
req = cmd->va; req = cmd->va;
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_LOWLEVEL,
OPCODE_LOWLEVEL_HOST_DDR_DMA, cmd->size, wrb, cmd); OPCODE_LOWLEVEL_HOST_DDR_DMA, cmd->size, wrb,
cmd);
req->pattern = cpu_to_le64(pattern); req->pattern = cpu_to_le64(pattern);
req->byte_count = cpu_to_le32(byte_cnt); req->byte_count = cpu_to_le32(byte_cnt);
...@@ -2507,8 +2529,7 @@ int be_cmd_get_phy_info(struct be_adapter *adapter) ...@@ -2507,8 +2529,7 @@ int be_cmd_get_phy_info(struct be_adapter *adapter)
goto err; goto err;
} }
cmd.size = sizeof(struct be_cmd_req_get_phy_info); cmd.size = sizeof(struct be_cmd_req_get_phy_info);
cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma);
&cmd.dma);
if (!cmd.va) { if (!cmd.va) {
dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); dev_err(&adapter->pdev->dev, "Memory alloc failure\n");
status = -ENOMEM; status = -ENOMEM;
...@@ -2541,8 +2562,7 @@ int be_cmd_get_phy_info(struct be_adapter *adapter) ...@@ -2541,8 +2562,7 @@ int be_cmd_get_phy_info(struct be_adapter *adapter)
BE_SUPPORTED_SPEED_1GBPS; BE_SUPPORTED_SPEED_1GBPS;
} }
} }
pci_free_consistent(adapter->pdev, cmd.size, pci_free_consistent(adapter->pdev, cmd.size, cmd.va, cmd.dma);
cmd.va, cmd.dma);
err: err:
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
return status; return status;
...@@ -2596,8 +2616,7 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter) ...@@ -2596,8 +2616,7 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter)
attribs_cmd.va = pci_alloc_consistent(adapter->pdev, attribs_cmd.size, attribs_cmd.va = pci_alloc_consistent(adapter->pdev, attribs_cmd.size,
&attribs_cmd.dma); &attribs_cmd.dma);
if (!attribs_cmd.va) { if (!attribs_cmd.va) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev, "Memory allocation failure\n");
"Memory allocation failure\n");
status = -ENOMEM; status = -ENOMEM;
goto err; goto err;
} }
...@@ -2610,8 +2629,8 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter) ...@@ -2610,8 +2629,8 @@ int be_cmd_get_cntl_attributes(struct be_adapter *adapter)
req = attribs_cmd.va; req = attribs_cmd.va;
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_GET_CNTL_ATTRIBUTES, payload_len, wrb, OPCODE_COMMON_GET_CNTL_ATTRIBUTES, payload_len,
&attribs_cmd); wrb, &attribs_cmd);
status = be_mbox_notify_wait(adapter); status = be_mbox_notify_wait(adapter);
if (!status) { if (!status) {
...@@ -2646,7 +2665,8 @@ int be_cmd_req_native_mode(struct be_adapter *adapter) ...@@ -2646,7 +2665,8 @@ int be_cmd_req_native_mode(struct be_adapter *adapter)
req = embedded_payload(wrb); req = embedded_payload(wrb);
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_SET_DRIVER_FUNCTION_CAP, sizeof(*req), wrb, NULL); OPCODE_COMMON_SET_DRIVER_FUNCTION_CAP,
sizeof(*req), wrb, NULL);
req->valid_cap_flags = cpu_to_le32(CAPABILITY_SW_TIMESTAMPS | req->valid_cap_flags = cpu_to_le32(CAPABILITY_SW_TIMESTAMPS |
CAPABILITY_BE3_NATIVE_ERX_API); CAPABILITY_BE3_NATIVE_ERX_API);
...@@ -2838,8 +2858,8 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac, ...@@ -2838,8 +2858,8 @@ int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
return status; return status;
} }
int be_cmd_get_active_mac(struct be_adapter *adapter, u32 curr_pmac_id, u8 *mac, int be_cmd_get_active_mac(struct be_adapter *adapter, u32 curr_pmac_id,
u32 if_handle, bool active, u32 domain) u8 *mac, u32 if_handle, bool active, u32 domain)
{ {
if (!active) if (!active)
...@@ -2914,8 +2934,7 @@ int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array, ...@@ -2914,8 +2934,7 @@ int be_cmd_set_mac_list(struct be_adapter *adapter, u8 *mac_array,
status = be_mcc_notify_wait(adapter); status = be_mcc_notify_wait(adapter);
err: err:
dma_free_coherent(&adapter->pdev->dev, cmd.size, dma_free_coherent(&adapter->pdev->dev, cmd.size, cmd.va, cmd.dma);
cmd.va, cmd.dma);
spin_unlock_bh(&adapter->mcc_lock); spin_unlock_bh(&adapter->mcc_lock);
return status; return status;
} }
...@@ -2960,7 +2979,8 @@ int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid, ...@@ -2960,7 +2979,8 @@ int be_cmd_set_hsw_config(struct be_adapter *adapter, u16 pvid,
ctxt = &req->context; ctxt = &req->context;
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_SET_HSW_CONFIG, sizeof(*req), wrb, NULL); OPCODE_COMMON_SET_HSW_CONFIG, sizeof(*req), wrb,
NULL);
req->hdr.domain = domain; req->hdr.domain = domain;
AMAP_SET_BITS(struct amap_set_hsw_context, interface_id, ctxt, intf_id); AMAP_SET_BITS(struct amap_set_hsw_context, interface_id, ctxt, intf_id);
...@@ -3006,7 +3026,8 @@ int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, ...@@ -3006,7 +3026,8 @@ int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid,
ctxt = &req->context; ctxt = &req->context;
be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON, be_wrb_cmd_hdr_prepare(&req->hdr, CMD_SUBSYSTEM_COMMON,
OPCODE_COMMON_GET_HSW_CONFIG, sizeof(*req), wrb, NULL); OPCODE_COMMON_GET_HSW_CONFIG, sizeof(*req), wrb,
NULL);
req->hdr.domain = domain; req->hdr.domain = domain;
AMAP_SET_BITS(struct amap_get_hsw_req_context, interface_id, AMAP_SET_BITS(struct amap_get_hsw_req_context, interface_id,
...@@ -3024,8 +3045,7 @@ int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid, ...@@ -3024,8 +3045,7 @@ int be_cmd_get_hsw_config(struct be_adapter *adapter, u16 *pvid,
if (!status) { if (!status) {
struct be_cmd_resp_get_hsw_config *resp = struct be_cmd_resp_get_hsw_config *resp =
embedded_payload(wrb); embedded_payload(wrb);
be_dws_le_to_cpu(&resp->context, be_dws_le_to_cpu(&resp->context, sizeof(resp->context));
sizeof(resp->context));
vid = AMAP_GET_BITS(struct amap_get_hsw_resp_context, vid = AMAP_GET_BITS(struct amap_get_hsw_resp_context,
pvid, &resp->context); pvid, &resp->context);
if (pvid) if (pvid)
...@@ -3059,11 +3079,9 @@ int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter) ...@@ -3059,11 +3079,9 @@ int be_cmd_get_acpi_wol_cap(struct be_adapter *adapter)
memset(&cmd, 0, sizeof(struct be_dma_mem)); memset(&cmd, 0, sizeof(struct be_dma_mem));
cmd.size = sizeof(struct be_cmd_resp_acpi_wol_magic_config_v1); cmd.size = sizeof(struct be_cmd_resp_acpi_wol_magic_config_v1);
cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma);
&cmd.dma);
if (!cmd.va) { if (!cmd.va) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev, "Memory allocation failure\n");
"Memory allocation failure\n");
status = -ENOMEM; status = -ENOMEM;
goto err; goto err;
} }
...@@ -3346,8 +3364,7 @@ int be_cmd_get_func_config(struct be_adapter *adapter, struct be_resources *res) ...@@ -3346,8 +3364,7 @@ int be_cmd_get_func_config(struct be_adapter *adapter, struct be_resources *res)
memset(&cmd, 0, sizeof(struct be_dma_mem)); memset(&cmd, 0, sizeof(struct be_dma_mem));
cmd.size = sizeof(struct be_cmd_resp_get_func_config); cmd.size = sizeof(struct be_cmd_resp_get_func_config);
cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, cmd.va = pci_alloc_consistent(adapter->pdev, cmd.size, &cmd.dma);
&cmd.dma);
if (!cmd.va) { if (!cmd.va) {
dev_err(&adapter->pdev->dev, "Memory alloc failure\n"); dev_err(&adapter->pdev->dev, "Memory alloc failure\n");
status = -ENOMEM; status = -ENOMEM;
......
...@@ -2060,7 +2060,7 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver, ...@@ -2060,7 +2060,7 @@ int be_cmd_get_fw_ver(struct be_adapter *adapter, char *fw_ver,
char *fw_on_flash); char *fw_on_flash);
int be_cmd_modify_eqd(struct be_adapter *adapter, struct be_set_eqd *, int num); 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, int be_cmd_vlan_config(struct be_adapter *adapter, u32 if_id, u16 *vtag_array,
u32 num, bool promiscuous); u32 num);
int be_cmd_rx_filter(struct be_adapter *adapter, u32 flags, u32 status); 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_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_get_flow_control(struct be_adapter *adapter, u32 *tx_fc, u32 *rx_fc);
......
...@@ -132,6 +132,7 @@ static const struct be_ethtool_stat et_rx_stats[] = { ...@@ -132,6 +132,7 @@ static const struct be_ethtool_stat et_rx_stats[] = {
{DRVSTAT_RX_INFO(rx_bytes)},/* If moving this member see above note */ {DRVSTAT_RX_INFO(rx_bytes)},/* If moving this member see above note */
{DRVSTAT_RX_INFO(rx_pkts)}, /* If moving this member see above note */ {DRVSTAT_RX_INFO(rx_pkts)}, /* If moving this member see above note */
{DRVSTAT_RX_INFO(rx_compl)}, {DRVSTAT_RX_INFO(rx_compl)},
{DRVSTAT_RX_INFO(rx_compl_err)},
{DRVSTAT_RX_INFO(rx_mcast_pkts)}, {DRVSTAT_RX_INFO(rx_mcast_pkts)},
/* Number of page allocation failures while posting receive buffers /* Number of page allocation failures while posting receive buffers
* to HW. * to HW.
...@@ -201,8 +202,7 @@ static void be_get_drvinfo(struct net_device *netdev, ...@@ -201,8 +202,7 @@ static void be_get_drvinfo(struct net_device *netdev,
drvinfo->eedump_len = 0; drvinfo->eedump_len = 0;
} }
static u32 static u32 lancer_cmd_get_file_len(struct be_adapter *adapter, u8 *file_name)
lancer_cmd_get_file_len(struct be_adapter *adapter, u8 *file_name)
{ {
u32 data_read = 0, eof; u32 data_read = 0, eof;
u8 addn_status; u8 addn_status;
...@@ -212,13 +212,13 @@ lancer_cmd_get_file_len(struct be_adapter *adapter, u8 *file_name) ...@@ -212,13 +212,13 @@ lancer_cmd_get_file_len(struct be_adapter *adapter, u8 *file_name)
memset(&data_len_cmd, 0, sizeof(data_len_cmd)); memset(&data_len_cmd, 0, sizeof(data_len_cmd));
/* data_offset and data_size should be 0 to get reg len */ /* data_offset and data_size should be 0 to get reg len */
status = lancer_cmd_read_object(adapter, &data_len_cmd, 0, 0, status = lancer_cmd_read_object(adapter, &data_len_cmd, 0, 0,
file_name, &data_read, &eof, &addn_status); file_name, &data_read, &eof,
&addn_status);
return data_read; return data_read;
} }
static int static int lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name,
lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name,
u32 buf_len, void *buf) u32 buf_len, void *buf)
{ {
struct be_dma_mem read_cmd; struct be_dma_mem read_cmd;
...@@ -242,8 +242,8 @@ lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name, ...@@ -242,8 +242,8 @@ lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name,
LANCER_READ_FILE_CHUNK); LANCER_READ_FILE_CHUNK);
chunk_size = ALIGN(chunk_size, 4); chunk_size = ALIGN(chunk_size, 4);
status = lancer_cmd_read_object(adapter, &read_cmd, chunk_size, status = lancer_cmd_read_object(adapter, &read_cmd, chunk_size,
total_read_len, file_name, &read_len, total_read_len, file_name,
&eof, &addn_status); &read_len, &eof, &addn_status);
if (!status) { if (!status) {
memcpy(buf + total_read_len, read_cmd.va, read_len); memcpy(buf + total_read_len, read_cmd.va, read_len);
total_read_len += read_len; total_read_len += read_len;
...@@ -259,8 +259,7 @@ lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name, ...@@ -259,8 +259,7 @@ lancer_cmd_read_file(struct be_adapter *adapter, u8 *file_name,
return status; return status;
} }
static int static int be_get_reg_len(struct net_device *netdev)
be_get_reg_len(struct net_device *netdev)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
u32 log_size = 0; u32 log_size = 0;
...@@ -337,8 +336,7 @@ static int be_set_coalesce(struct net_device *netdev, ...@@ -337,8 +336,7 @@ static int be_set_coalesce(struct net_device *netdev,
return 0; return 0;
} }
static void static void be_get_ethtool_stats(struct net_device *netdev,
be_get_ethtool_stats(struct net_device *netdev,
struct ethtool_stats *stats, uint64_t *data) struct ethtool_stats *stats, uint64_t *data)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
...@@ -390,8 +388,7 @@ be_get_ethtool_stats(struct net_device *netdev, ...@@ -390,8 +388,7 @@ be_get_ethtool_stats(struct net_device *netdev,
} }
} }
static void static void be_get_stat_strings(struct net_device *netdev, uint32_t stringset,
be_get_stat_strings(struct net_device *netdev, uint32_t stringset,
uint8_t *data) uint8_t *data)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
...@@ -649,8 +646,7 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd) ...@@ -649,8 +646,7 @@ be_set_pauseparam(struct net_device *netdev, struct ethtool_pauseparam *ecmd)
return status; return status;
} }
static int static int be_set_phys_id(struct net_device *netdev,
be_set_phys_id(struct net_device *netdev,
enum ethtool_phys_id_state state) enum ethtool_phys_id_state state)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
...@@ -708,8 +704,7 @@ static int be_set_dump(struct net_device *netdev, struct ethtool_dump *dump) ...@@ -708,8 +704,7 @@ static int be_set_dump(struct net_device *netdev, struct ethtool_dump *dump)
return status; return status;
} }
static void static void be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
...@@ -723,8 +718,7 @@ be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) ...@@ -723,8 +718,7 @@ be_get_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
memset(&wol->sopass, 0, sizeof(wol->sopass)); memset(&wol->sopass, 0, sizeof(wol->sopass));
} }
static int static int be_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
be_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
...@@ -744,8 +738,7 @@ be_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol) ...@@ -744,8 +738,7 @@ be_set_wol(struct net_device *netdev, struct ethtool_wolinfo *wol)
return 0; return 0;
} }
static int static int be_test_ddr_dma(struct be_adapter *adapter)
be_test_ddr_dma(struct be_adapter *adapter)
{ {
int ret, i; int ret, i;
struct be_dma_mem ddrdma_cmd; struct be_dma_mem ddrdma_cmd;
...@@ -775,18 +768,15 @@ be_test_ddr_dma(struct be_adapter *adapter) ...@@ -775,18 +768,15 @@ be_test_ddr_dma(struct be_adapter *adapter)
static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type, static u64 be_loopback_test(struct be_adapter *adapter, u8 loopback_type,
u64 *status) u64 *status)
{ {
be_cmd_set_loopback(adapter, adapter->hba_port_num, be_cmd_set_loopback(adapter, adapter->hba_port_num, loopback_type, 1);
loopback_type, 1);
*status = be_cmd_loopback_test(adapter, adapter->hba_port_num, *status = be_cmd_loopback_test(adapter, adapter->hba_port_num,
loopback_type, 1500, loopback_type, 1500, 2, 0xabc);
2, 0xabc); be_cmd_set_loopback(adapter, adapter->hba_port_num, BE_NO_LOOPBACK, 1);
be_cmd_set_loopback(adapter, adapter->hba_port_num,
BE_NO_LOOPBACK, 1);
return *status; return *status;
} }
static void static void be_self_test(struct net_device *netdev, struct ethtool_test *test,
be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) u64 *data)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
int status; int status;
...@@ -801,12 +791,10 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) ...@@ -801,12 +791,10 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM); memset(data, 0, sizeof(u64) * ETHTOOL_TESTS_NUM);
if (test->flags & ETH_TEST_FL_OFFLINE) { if (test->flags & ETH_TEST_FL_OFFLINE) {
if (be_loopback_test(adapter, BE_MAC_LOOPBACK, if (be_loopback_test(adapter, BE_MAC_LOOPBACK, &data[0]) != 0)
&data[0]) != 0)
test->flags |= ETH_TEST_FL_FAILED; test->flags |= ETH_TEST_FL_FAILED;
if (be_loopback_test(adapter, BE_PHY_LOOPBACK, if (be_loopback_test(adapter, BE_PHY_LOOPBACK, &data[1]) != 0)
&data[1]) != 0)
test->flags |= ETH_TEST_FL_FAILED; test->flags |= ETH_TEST_FL_FAILED;
if (test->flags & ETH_TEST_FL_EXTERNAL_LB) { if (test->flags & ETH_TEST_FL_EXTERNAL_LB) {
...@@ -832,16 +820,14 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data) ...@@ -832,16 +820,14 @@ be_self_test(struct net_device *netdev, struct ethtool_test *test, u64 *data)
} }
} }
static int static int be_do_flash(struct net_device *netdev, struct ethtool_flash *efl)
be_do_flash(struct net_device *netdev, struct ethtool_flash *efl)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
return be_load_fw(adapter, efl->data); return be_load_fw(adapter, efl->data);
} }
static int static int be_get_eeprom_len(struct net_device *netdev)
be_get_eeprom_len(struct net_device *netdev)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
...@@ -860,9 +846,8 @@ be_get_eeprom_len(struct net_device *netdev) ...@@ -860,9 +846,8 @@ be_get_eeprom_len(struct net_device *netdev)
} }
} }
static int static int be_read_eeprom(struct net_device *netdev,
be_read_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom, struct ethtool_eeprom *eeprom, uint8_t *data)
uint8_t *data)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
struct be_dma_mem eeprom_cmd; struct be_dma_mem eeprom_cmd;
......
...@@ -210,8 +210,7 @@ static void be_eq_notify(struct be_adapter *adapter, u16 qid, ...@@ -210,8 +210,7 @@ static void be_eq_notify(struct be_adapter *adapter, u16 qid,
{ {
u32 val = 0; u32 val = 0;
val |= qid & DB_EQ_RING_ID_MASK; val |= qid & DB_EQ_RING_ID_MASK;
val |= ((qid & DB_EQ_RING_ID_EXT_MASK) << val |= ((qid & DB_EQ_RING_ID_EXT_MASK) << DB_EQ_RING_ID_EXT_MASK_SHIFT);
DB_EQ_RING_ID_EXT_MASK_SHIFT);
if (adapter->eeh_error) if (adapter->eeh_error)
return; return;
...@@ -491,8 +490,7 @@ static void populate_lancer_stats(struct be_adapter *adapter) ...@@ -491,8 +490,7 @@ static void populate_lancer_stats(struct be_adapter *adapter)
{ {
struct be_drv_stats *drvs = &adapter->drv_stats; struct be_drv_stats *drvs = &adapter->drv_stats;
struct lancer_pport_stats *pport_stats = struct lancer_pport_stats *pport_stats = pport_stats_from_cmd(adapter);
pport_stats_from_cmd(adapter);
be_dws_le_to_cpu(pport_stats, sizeof(*pport_stats)); be_dws_le_to_cpu(pport_stats, sizeof(*pport_stats));
drvs->rx_pause_frames = pport_stats->rx_pause_frames_lo; drvs->rx_pause_frames = pport_stats->rx_pause_frames_lo;
...@@ -539,8 +537,7 @@ static void accumulate_16bit_val(u32 *acc, u16 val) ...@@ -539,8 +537,7 @@ static void accumulate_16bit_val(u32 *acc, u16 val)
} }
static void populate_erx_stats(struct be_adapter *adapter, static void populate_erx_stats(struct be_adapter *adapter,
struct be_rx_obj *rxo, struct be_rx_obj *rxo, u32 erx_stat)
u32 erx_stat)
{ {
if (!BEx_chip(adapter)) if (!BEx_chip(adapter))
rx_stats(rxo)->rx_drops_no_frags = erx_stat; rx_stats(rxo)->rx_drops_no_frags = erx_stat;
...@@ -660,7 +657,8 @@ void be_link_status_update(struct be_adapter *adapter, u8 link_status) ...@@ -660,7 +657,8 @@ void be_link_status_update(struct be_adapter *adapter, u8 link_status)
} }
static void be_tx_stats_update(struct be_tx_obj *txo, static void be_tx_stats_update(struct be_tx_obj *txo,
u32 wrb_cnt, u32 copied, u32 gso_segs, bool stopped) u32 wrb_cnt, u32 copied, u32 gso_segs,
bool stopped)
{ {
struct be_tx_stats *stats = tx_stats(txo); struct be_tx_stats *stats = tx_stats(txo);
...@@ -733,7 +731,8 @@ static u16 skb_ip_proto(struct sk_buff *skb) ...@@ -733,7 +731,8 @@ static u16 skb_ip_proto(struct sk_buff *skb)
} }
static void wrb_fill_hdr(struct be_adapter *adapter, struct be_eth_hdr_wrb *hdr, static void wrb_fill_hdr(struct be_adapter *adapter, struct be_eth_hdr_wrb *hdr,
struct sk_buff *skb, u32 wrb_cnt, u32 len, bool skip_hw_vlan) struct sk_buff *skb, u32 wrb_cnt, u32 len,
bool skip_hw_vlan)
{ {
u16 vlan_tag, proto; u16 vlan_tag, proto;
...@@ -821,8 +820,7 @@ static int make_tx_wrbs(struct be_adapter *adapter, struct be_queue_info *txq, ...@@ -821,8 +820,7 @@ static int make_tx_wrbs(struct be_adapter *adapter, struct be_queue_info *txq,
} }
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
const struct skb_frag_struct *frag = const struct skb_frag_struct *frag = &skb_shinfo(skb)->frags[i];
&skb_shinfo(skb)->frags[i];
busaddr = skb_frag_dma_map(dev, frag, 0, busaddr = skb_frag_dma_map(dev, frag, 0,
skb_frag_size(frag), DMA_TO_DEVICE); skb_frag_size(frag), DMA_TO_DEVICE);
if (dma_mapping_error(dev, busaddr)) if (dma_mapping_error(dev, busaddr))
...@@ -927,8 +925,7 @@ static int be_vlan_tag_tx_chk(struct be_adapter *adapter, struct sk_buff *skb) ...@@ -927,8 +925,7 @@ static int be_vlan_tag_tx_chk(struct be_adapter *adapter, struct sk_buff *skb)
return vlan_tx_tag_present(skb) || adapter->pvid || adapter->qnq_vid; return vlan_tx_tag_present(skb) || adapter->pvid || adapter->qnq_vid;
} }
static int be_ipv6_tx_stall_chk(struct be_adapter *adapter, static int be_ipv6_tx_stall_chk(struct be_adapter *adapter, struct sk_buff *skb)
struct sk_buff *skb)
{ {
return BE3_chip(adapter) && be_ipv6_exthdr_check(skb); return BE3_chip(adapter) && be_ipv6_exthdr_check(skb);
} }
...@@ -1077,8 +1074,7 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -1077,8 +1074,7 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
if (new_mtu < BE_MIN_MTU || if (new_mtu < BE_MIN_MTU ||
new_mtu > (BE_MAX_JUMBO_FRAME_SIZE - new_mtu > (BE_MAX_JUMBO_FRAME_SIZE - (ETH_HLEN + ETH_FCS_LEN))) {
(ETH_HLEN + ETH_FCS_LEN))) {
dev_info(&adapter->pdev->dev, dev_info(&adapter->pdev->dev,
"MTU must be between %d and %d bytes\n", "MTU must be between %d and %d bytes\n",
BE_MIN_MTU, BE_MIN_MTU,
...@@ -1098,7 +1094,7 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu) ...@@ -1098,7 +1094,7 @@ static int be_change_mtu(struct net_device *netdev, int new_mtu)
static int be_vid_config(struct be_adapter *adapter) static int be_vid_config(struct be_adapter *adapter)
{ {
u16 vids[BE_NUM_VLANS_SUPPORTED]; u16 vids[BE_NUM_VLANS_SUPPORTED];
u16 num = 0, i; u16 num = 0, i = 0;
int status = 0; int status = 0;
/* No need to further configure vids if in promiscuous mode */ /* No need to further configure vids if in promiscuous mode */
...@@ -1109,13 +1105,10 @@ static int be_vid_config(struct be_adapter *adapter) ...@@ -1109,13 +1105,10 @@ static int be_vid_config(struct be_adapter *adapter)
goto set_vlan_promisc; goto set_vlan_promisc;
/* Construct VLAN Table to give to HW */ /* Construct VLAN Table to give to HW */
for (i = 0; i < VLAN_N_VID; i++) for_each_set_bit(i, adapter->vids, VLAN_N_VID)
if (adapter->vlan_tag[i])
vids[num++] = cpu_to_le16(i); vids[num++] = cpu_to_le16(i);
status = be_cmd_vlan_config(adapter, adapter->if_handle, status = be_cmd_vlan_config(adapter, adapter->if_handle, vids, num);
vids, num, 0);
if (status) { if (status) {
/* Set to VLAN promisc mode as setting VLAN filter failed */ /* Set to VLAN promisc mode as setting VLAN filter failed */
if (status == MCC_ADDL_STS_INSUFFICIENT_RESOURCES) if (status == MCC_ADDL_STS_INSUFFICIENT_RESOURCES)
...@@ -1160,16 +1153,16 @@ static int be_vlan_add_vid(struct net_device *netdev, __be16 proto, u16 vid) ...@@ -1160,16 +1153,16 @@ static int be_vlan_add_vid(struct net_device *netdev, __be16 proto, u16 vid)
if (lancer_chip(adapter) && vid == 0) if (lancer_chip(adapter) && vid == 0)
return status; return status;
if (adapter->vlan_tag[vid]) if (test_bit(vid, adapter->vids))
return status; return status;
adapter->vlan_tag[vid] = 1; set_bit(vid, adapter->vids);
adapter->vlans_added++; adapter->vlans_added++;
status = be_vid_config(adapter); status = be_vid_config(adapter);
if (status) { if (status) {
adapter->vlans_added--; adapter->vlans_added--;
adapter->vlan_tag[vid] = 0; clear_bit(vid, adapter->vids);
} }
return status; return status;
...@@ -1184,12 +1177,12 @@ static int be_vlan_rem_vid(struct net_device *netdev, __be16 proto, u16 vid) ...@@ -1184,12 +1177,12 @@ static int be_vlan_rem_vid(struct net_device *netdev, __be16 proto, u16 vid)
if (lancer_chip(adapter) && vid == 0) if (lancer_chip(adapter) && vid == 0)
goto ret; goto ret;
adapter->vlan_tag[vid] = 0; clear_bit(vid, adapter->vids);
status = be_vid_config(adapter); status = be_vid_config(adapter);
if (!status) if (!status)
adapter->vlans_added--; adapter->vlans_added--;
else else
adapter->vlan_tag[vid] = 1; set_bit(vid, adapter->vids);
ret: ret:
return status; return status;
} }
...@@ -1254,8 +1247,10 @@ static void be_set_rx_mode(struct net_device *netdev) ...@@ -1254,8 +1247,10 @@ static void be_set_rx_mode(struct net_device *netdev)
/* Set to MCAST promisc mode if setting MULTICAST address fails */ /* Set to MCAST promisc mode if setting MULTICAST address fails */
if (status) { if (status) {
dev_info(&adapter->pdev->dev, "Exhausted multicast HW filters.\n"); dev_info(&adapter->pdev->dev,
dev_info(&adapter->pdev->dev, "Disabling HW multicast filtering.\n"); "Exhausted multicast HW filters.\n");
dev_info(&adapter->pdev->dev,
"Disabling HW multicast filtering.\n");
be_cmd_rx_filter(adapter, IFF_ALLMULTI, ON); be_cmd_rx_filter(adapter, IFF_ALLMULTI, ON);
} }
done: done:
...@@ -1316,8 +1311,7 @@ static int be_get_vf_config(struct net_device *netdev, int vf, ...@@ -1316,8 +1311,7 @@ static int be_get_vf_config(struct net_device *netdev, int vf,
return 0; return 0;
} }
static int be_set_vf_vlan(struct net_device *netdev, static int be_set_vf_vlan(struct net_device *netdev, int vf, u16 vlan, u8 qos)
int vf, u16 vlan, u8 qos)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf]; struct be_vf_cfg *vf_cfg = &adapter->vf_cfg[vf];
...@@ -1348,8 +1342,7 @@ static int be_set_vf_vlan(struct net_device *netdev, ...@@ -1348,8 +1342,7 @@ static int be_set_vf_vlan(struct net_device *netdev,
return status; return status;
} }
static int be_set_vf_tx_rate(struct net_device *netdev, static int be_set_vf_tx_rate(struct net_device *netdev, int vf, int rate)
int vf, int rate)
{ {
struct be_adapter *adapter = netdev_priv(netdev); struct be_adapter *adapter = netdev_priv(netdev);
int status = 0; int status = 0;
...@@ -1566,7 +1559,8 @@ static void skb_fill_rx_data(struct be_rx_obj *rxo, struct sk_buff *skb, ...@@ -1566,7 +1559,8 @@ static void skb_fill_rx_data(struct be_rx_obj *rxo, struct sk_buff *skb,
skb_frag_set_page(skb, 0, page_info->page); skb_frag_set_page(skb, 0, page_info->page);
skb_shinfo(skb)->frags[0].page_offset = skb_shinfo(skb)->frags[0].page_offset =
page_info->page_offset + hdr_len; page_info->page_offset + hdr_len;
skb_frag_size_set(&skb_shinfo(skb)->frags[0], curr_frag_len - hdr_len); skb_frag_size_set(&skb_shinfo(skb)->frags[0],
curr_frag_len - hdr_len);
skb->data_len = curr_frag_len - hdr_len; skb->data_len = curr_frag_len - hdr_len;
skb->truesize += rx_frag_size; skb->truesize += rx_frag_size;
skb->tail += hdr_len; skb->tail += hdr_len;
...@@ -1725,8 +1719,8 @@ static void be_parse_rx_compl_v1(struct be_eth_rx_compl *compl, ...@@ -1725,8 +1719,8 @@ static void be_parse_rx_compl_v1(struct be_eth_rx_compl *compl,
if (rxcp->vlanf) { if (rxcp->vlanf) {
rxcp->qnq = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, qnq, rxcp->qnq = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, qnq,
compl); compl);
rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, vlan_tag, rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v1,
compl); vlan_tag, compl);
} }
rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, port, compl); rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v1, port, compl);
rxcp->tunneled = rxcp->tunneled =
...@@ -1757,8 +1751,8 @@ static void be_parse_rx_compl_v0(struct be_eth_rx_compl *compl, ...@@ -1757,8 +1751,8 @@ static void be_parse_rx_compl_v0(struct be_eth_rx_compl *compl,
if (rxcp->vlanf) { if (rxcp->vlanf) {
rxcp->qnq = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, qnq, rxcp->qnq = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, qnq,
compl); compl);
rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, vlan_tag, rxcp->vlan_tag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0,
compl); vlan_tag, compl);
} }
rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl); rxcp->port = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, port, compl);
rxcp->ip_frag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0, rxcp->ip_frag = AMAP_GET_BITS(struct amap_eth_rx_compl_v0,
...@@ -1799,7 +1793,7 @@ static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo) ...@@ -1799,7 +1793,7 @@ static struct be_rx_compl_info *be_rx_compl_get(struct be_rx_obj *rxo)
rxcp->vlan_tag = swab16(rxcp->vlan_tag); rxcp->vlan_tag = swab16(rxcp->vlan_tag);
if (adapter->pvid == (rxcp->vlan_tag & VLAN_VID_MASK) && if (adapter->pvid == (rxcp->vlan_tag & VLAN_VID_MASK) &&
!adapter->vlan_tag[rxcp->vlan_tag]) !test_bit(rxcp->vlan_tag, adapter->vids))
rxcp->vlanf = 0; rxcp->vlanf = 0;
} }
...@@ -2405,7 +2399,8 @@ static bool be_process_tx(struct be_adapter *adapter, struct be_tx_obj *txo, ...@@ -2405,7 +2399,8 @@ static bool be_process_tx(struct be_adapter *adapter, struct be_tx_obj *txo,
if (!txcp) if (!txcp)
break; break;
num_wrbs += be_tx_compl_process(adapter, txo, num_wrbs += be_tx_compl_process(adapter, txo,
AMAP_GET_BITS(struct amap_eth_tx_compl, AMAP_GET_BITS(struct
amap_eth_tx_compl,
wrb_index, txcp)); wrb_index, txcp));
} }
...@@ -2821,8 +2816,7 @@ static int be_rx_qs_create(struct be_adapter *adapter) ...@@ -2821,8 +2816,7 @@ static int be_rx_qs_create(struct be_adapter *adapter)
} }
get_random_bytes(rss_hkey, RSS_HASH_KEY_LEN); get_random_bytes(rss_hkey, RSS_HASH_KEY_LEN);
rc = be_cmd_rss_config(adapter, rss->rsstable, rc = be_cmd_rss_config(adapter, rss->rsstable, rss->rss_flags,
rss->rss_flags,
128, rss_hkey); 128, rss_hkey);
if (rc) { if (rc) {
rss->rss_flags = RSS_ENABLE_NONE; rss->rss_flags = RSS_ENABLE_NONE;
...@@ -2903,7 +2897,8 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable) ...@@ -2903,7 +2897,8 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable)
if (enable) { if (enable) {
status = pci_write_config_dword(adapter->pdev, status = pci_write_config_dword(adapter->pdev,
PCICFG_PM_CONTROL_OFFSET, PCICFG_PM_CONTROL_MASK); PCICFG_PM_CONTROL_OFFSET,
PCICFG_PM_CONTROL_MASK);
if (status) { if (status) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"Could not enable Wake-on-lan\n"); "Could not enable Wake-on-lan\n");
...@@ -2912,7 +2907,8 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable) ...@@ -2912,7 +2907,8 @@ static int be_setup_wol(struct be_adapter *adapter, bool enable)
return status; return status;
} }
status = be_cmd_enable_magic_wol(adapter, status = be_cmd_enable_magic_wol(adapter,
adapter->netdev->dev_addr, &cmd); adapter->netdev->dev_addr,
&cmd);
pci_enable_wake(adapter->pdev, PCI_D3hot, 1); pci_enable_wake(adapter->pdev, PCI_D3hot, 1);
pci_enable_wake(adapter->pdev, PCI_D3cold, 1); pci_enable_wake(adapter->pdev, PCI_D3cold, 1);
} else { } else {
...@@ -2951,7 +2947,8 @@ static int be_vf_eth_addr_config(struct be_adapter *adapter) ...@@ -2951,7 +2947,8 @@ static int be_vf_eth_addr_config(struct be_adapter *adapter)
if (status) if (status)
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"Mac address assignment failed for VF %d\n", vf); "Mac address assignment failed for VF %d\n",
vf);
else else
memcpy(vf_cfg->mac_addr, mac, ETH_ALEN); memcpy(vf_cfg->mac_addr, mac, ETH_ALEN);
...@@ -3093,8 +3090,10 @@ static int be_vfs_if_create(struct be_adapter *adapter) ...@@ -3093,8 +3090,10 @@ static int be_vfs_if_create(struct be_adapter *adapter)
/* If a FW profile exists, then cap_flags are updated */ /* If a FW profile exists, then cap_flags are updated */
en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED | en_flags = cap_flags & (BE_IF_FLAGS_UNTAGGED |
BE_IF_FLAGS_BROADCAST | BE_IF_FLAGS_MULTICAST); BE_IF_FLAGS_BROADCAST |
status = be_cmd_if_create(adapter, cap_flags, en_flags, BE_IF_FLAGS_MULTICAST);
status =
be_cmd_if_create(adapter, cap_flags, en_flags,
&vf_cfg->if_handle, vf + 1); &vf_cfg->if_handle, vf + 1);
if (status) if (status)
goto err; goto err;
...@@ -3612,8 +3611,7 @@ static bool be_flash_redboot(struct be_adapter *adapter, ...@@ -3612,8 +3611,7 @@ static bool be_flash_redboot(struct be_adapter *adapter,
p += crc_offset; p += crc_offset;
status = be_cmd_get_flash_crc(adapter, flashed_crc, status = be_cmd_get_flash_crc(adapter, flashed_crc, (image_size - 4));
(image_size - 4));
if (status) { if (status) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"could not get crc from flash, not flashing redboot\n"); "could not get crc from flash, not flashing redboot\n");
...@@ -3716,9 +3714,7 @@ static int be_flash(struct be_adapter *adapter, const u8 *img, ...@@ -3716,9 +3714,7 @@ static int be_flash(struct be_adapter *adapter, const u8 *img,
/* For BE2, BE3 and BE3-R */ /* For BE2, BE3 and BE3-R */
static int be_flash_BEx(struct be_adapter *adapter, static int be_flash_BEx(struct be_adapter *adapter,
const struct firmware *fw, const struct firmware *fw,
struct be_dma_mem *flash_cmd, struct be_dma_mem *flash_cmd, int num_of_images)
int num_of_images)
{ {
int status = 0, i, filehdr_size = 0; int status = 0, i, filehdr_size = 0;
int img_hdrs_size = (num_of_images * sizeof(struct image_hdr)); int img_hdrs_size = (num_of_images * sizeof(struct image_hdr));
...@@ -3800,8 +3796,10 @@ static int be_flash_BEx(struct be_adapter *adapter, ...@@ -3800,8 +3796,10 @@ static int be_flash_BEx(struct be_adapter *adapter,
if (pflashcomp[i].optype == OPTYPE_REDBOOT) { if (pflashcomp[i].optype == OPTYPE_REDBOOT) {
redboot = be_flash_redboot(adapter, fw->data, redboot = be_flash_redboot(adapter, fw->data,
pflashcomp[i].offset, pflashcomp[i].size, pflashcomp[i].offset,
filehdr_size + img_hdrs_size); pflashcomp[i].size,
filehdr_size +
img_hdrs_size);
if (!redboot) if (!redboot)
continue; continue;
} }
...@@ -3874,7 +3872,8 @@ static int be_flash_skyhawk(struct be_adapter *adapter, ...@@ -3874,7 +3872,8 @@ static int be_flash_skyhawk(struct be_adapter *adapter,
if (img_optype == OPTYPE_REDBOOT) { if (img_optype == OPTYPE_REDBOOT) {
redboot = be_flash_redboot(adapter, fw->data, redboot = be_flash_redboot(adapter, fw->data,
img_offset, img_size, img_offset, img_size,
filehdr_size + img_hdrs_size); filehdr_size +
img_hdrs_size);
if (!redboot) if (!redboot)
continue; continue;
} }
...@@ -3984,8 +3983,7 @@ static int lancer_fw_download(struct be_adapter *adapter, ...@@ -3984,8 +3983,7 @@ static int lancer_fw_download(struct be_adapter *adapter,
} }
} else if (change_status != LANCER_NO_RESET_NEEDED) { } else if (change_status != LANCER_NO_RESET_NEEDED) {
dev_err(&adapter->pdev->dev, dev_err(&adapter->pdev->dev,
"System reboot required for new FW" "System reboot required for new FW to be active\n");
" to be active\n");
} }
dev_info(&adapter->pdev->dev, "Firmware flashed successfully\n"); dev_info(&adapter->pdev->dev, "Firmware flashed successfully\n");
...@@ -4119,8 +4117,7 @@ int be_load_fw(struct be_adapter *adapter, u8 *fw_file) ...@@ -4119,8 +4117,7 @@ int be_load_fw(struct be_adapter *adapter, u8 *fw_file)
return status; return status;
} }
static int be_ndo_bridge_setlink(struct net_device *dev, static int be_ndo_bridge_setlink(struct net_device *dev, struct nlmsghdr *nlh)
struct nlmsghdr *nlh)
{ {
struct be_adapter *adapter = netdev_priv(dev); struct be_adapter *adapter = netdev_priv(dev);
struct nlattr *attr, *br_spec; struct nlattr *attr, *br_spec;
...@@ -4162,8 +4159,7 @@ static int be_ndo_bridge_setlink(struct net_device *dev, ...@@ -4162,8 +4159,7 @@ static int be_ndo_bridge_setlink(struct net_device *dev,
} }
static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, static int be_ndo_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
struct net_device *dev, struct net_device *dev, u32 filter_mask)
u32 filter_mask)
{ {
struct be_adapter *adapter = netdev_priv(dev); struct be_adapter *adapter = netdev_priv(dev);
int status = 0; int status = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment