144
141
/* When link status changes, link speed must be re-queried from FW */
145
142
adapter->phy.link_speed = -1;
144
/* Ignore physical link event */
145
if (lancer_chip(adapter) &&
146
!(evt->port_link_status & LOGICAL_LINK_STATUS_MASK))
147
149
/* For the initial link status do not rely on the ASYNC event as
148
150
* it may not be received in some cases.
166
/* Grp5 QOS Speed evt */
168
/* Grp5 QOS Speed evt: qos_link_speed is in units of 10 Mbps */
167
169
static void be_async_grp5_qos_speed_process(struct be_adapter *adapter,
168
170
struct be_async_event_grp5_qos_link_speed *evt)
170
if (evt->physical_port == adapter->port_num) {
171
/* qos_link_speed is in units of 10 Mbps */
172
adapter->phy.link_speed = evt->qos_link_speed * 10;
172
if (adapter->phy.link_speed >= 0 &&
173
evt->physical_port == adapter->port_num)
174
adapter->phy.link_speed = le16_to_cpu(evt->qos_link_speed) * 10;
176
177
/*Grp5 PVID evt*/
257
258
int num = 0, status = 0;
258
259
struct be_mcc_obj *mcc_obj = &adapter->mcc_obj;
260
spin_lock_bh(&adapter->mcc_cq_lock);
261
spin_lock(&adapter->mcc_cq_lock);
261
262
while ((compl = be_mcc_compl_get(adapter))) {
262
263
if (compl->flags & CQE_FLAGS_ASYNC_MASK) {
263
264
/* Interpret flags as an async trailer */
279
280
be_cq_notify(adapter, mcc_obj->cq.id, mcc_obj->rearm_cq, num);
281
spin_unlock_bh(&adapter->mcc_cq_lock);
282
spin_unlock(&adapter->mcc_cq_lock);
352
355
if (msecs > 4000) {
353
356
dev_err(&adapter->pdev->dev, "FW not responding\n");
354
357
adapter->fw_timeout = true;
355
be_detect_dump_ue(adapter);
358
be_detect_error(adapter);
432
int be_cmd_POST(struct be_adapter *adapter)
435
int lancer_wait_ready(struct be_adapter *adapter)
437
#define SLIPORT_READY_TIMEOUT 30
441
for (i = 0; i < SLIPORT_READY_TIMEOUT; i++) {
442
sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET);
443
if (sliport_status & SLIPORT_STATUS_RDY_MASK)
449
if (i == SLIPORT_READY_TIMEOUT)
455
int lancer_test_and_set_rdy_state(struct be_adapter *adapter)
458
u32 sliport_status, err, reset_needed;
459
status = lancer_wait_ready(adapter);
461
sliport_status = ioread32(adapter->db + SLIPORT_STATUS_OFFSET);
462
err = sliport_status & SLIPORT_STATUS_ERR_MASK;
463
reset_needed = sliport_status & SLIPORT_STATUS_RN_MASK;
464
if (err && reset_needed) {
465
iowrite32(SLI_PORT_CONTROL_IP_MASK,
466
adapter->db + SLIPORT_CONTROL_OFFSET);
468
/* check adapter has corrected the error */
469
status = lancer_wait_ready(adapter);
470
sliport_status = ioread32(adapter->db +
471
SLIPORT_STATUS_OFFSET);
472
sliport_status &= (SLIPORT_STATUS_ERR_MASK |
473
SLIPORT_STATUS_RN_MASK);
474
if (status || sliport_status)
476
} else if (err || reset_needed) {
483
int be_fw_wait_ready(struct be_adapter *adapter)
435
486
int status, timeout = 0;
436
487
struct device *dev = &adapter->pdev->dev;
489
if (lancer_chip(adapter)) {
490
status = lancer_wait_ready(adapter);
439
495
status = be_POST_stage_get(adapter, &stage);
1134
1197
int be_cmd_if_create(struct be_adapter *adapter, u32 cap_flags, u32 en_flags,
1135
u8 *mac, u32 *if_handle, u32 *pmac_id, u32 domain)
1198
u32 *if_handle, u32 domain)
1137
1200
struct be_mcc_wrb *wrb;
1138
1201
struct be_cmd_req_if_create *req;
1152
1215
req->hdr.domain = domain;
1153
1216
req->capability_flags = cpu_to_le32(cap_flags);
1154
1217
req->enable_flags = cpu_to_le32(en_flags);
1156
memcpy(req->mac_addr, mac, ETH_ALEN);
1158
req->pmac_invalid = true;
1219
req->pmac_invalid = true;
1160
1221
status = be_mcc_notify_wait(adapter);
1162
1223
struct be_cmd_resp_if_create *resp = embedded_payload(wrb);
1163
1224
*if_handle = le32_to_cpu(resp->interface_id);
1165
*pmac_id = le32_to_cpu(resp->pmac_id);
1210
1269
struct be_cmd_req_hdr *hdr;
1211
1270
int status = 0;
1213
if (MODULO(adapter->work_counter, be_get_temp_freq) == 0)
1214
be_cmd_get_die_temperature(adapter);
1216
1272
spin_lock_bh(&adapter->mcc_lock);
1218
1274
wrb = wrb_from_mccq(adapter);
1272
/* Uses synchronous mcc */
1273
int be_cmd_link_status_query(struct be_adapter *adapter, u8 *mac_speed,
1274
u16 *link_speed, u8 *link_status, u32 dom)
1328
static int be_mac_to_link_speed(int mac_speed)
1330
switch (mac_speed) {
1331
case PHY_LINK_SPEED_ZERO:
1333
case PHY_LINK_SPEED_10MBPS:
1335
case PHY_LINK_SPEED_100MBPS:
1337
case PHY_LINK_SPEED_1GBPS:
1339
case PHY_LINK_SPEED_10GBPS:
1345
/* Uses synchronous mcc
1346
* Returns link_speed in Mbps
1348
int be_cmd_link_status_query(struct be_adapter *adapter, u16 *link_speed,
1349
u8 *link_status, u32 dom)
1276
1351
struct be_mcc_wrb *wrb;
1277
1352
struct be_cmd_req_link_status *req;
1300
1375
status = be_mcc_notify_wait(adapter);
1302
1377
struct be_cmd_resp_link_status *resp = embedded_payload(wrb);
1303
if (resp->mac_speed != PHY_LINK_SPEED_ZERO) {
1305
*link_speed = le16_to_cpu(resp->link_speed);
1307
*mac_speed = resp->mac_speed;
1379
*link_speed = resp->link_speed ?
1380
le16_to_cpu(resp->link_speed) * 10 :
1381
be_mac_to_link_speed(resp->mac_speed);
1383
if (!resp->logical_link_status)
1309
1386
if (link_status)
1310
1387
*link_status = resp->logical_link_status;
1581
1658
/* Reset mcast promisc mode if already set by setting mask
1582
1659
* and not setting flags field
1584
req->if_flags_mask |=
1661
if (!lancer_chip(adapter) || be_physfn(adapter))
1662
req->if_flags_mask |=
1585
1663
cpu_to_le32(BE_IF_FLAGS_MCAST_PROMISCUOUS);
1587
1665
req->mcast_num = cpu_to_le32(netdev_mc_count(adapter->netdev));
1692
1770
struct be_cmd_req_hdr *req;
1773
if (lancer_chip(adapter)) {
1774
status = lancer_wait_ready(adapter);
1776
iowrite32(SLI_PORT_CONTROL_IP_MASK,
1777
adapter->db + SLIPORT_CONTROL_OFFSET);
1778
status = lancer_test_and_set_rdy_state(adapter);
1781
dev_err(&adapter->pdev->dev,
1782
"Adapter in non recoverable error\n");
1695
1787
if (mutex_lock_interruptible(&adapter->mbox_lock))
1728
1820
req->if_id = cpu_to_le32(adapter->if_handle);
1729
1821
req->enable_rss = cpu_to_le16(RSS_ENABLE_TCP_IPV4 | RSS_ENABLE_IPV4 |
1730
1822
RSS_ENABLE_TCP_IPV6 | RSS_ENABLE_IPV6);
1824
if (lancer_chip(adapter) || skyhawk_chip(adapter)) {
1825
req->hdr.version = 1;
1826
req->enable_rss |= cpu_to_le16(RSS_ENABLE_UDP_IPV4 |
1827
RSS_ENABLE_UDP_IPV6);
1731
1830
req->cpu_table_size_log2 = cpu_to_le16(fls(table_size) - 1);
1732
1831
memcpy(req->cpu_table, rsstable, table_size);
1733
1832
memcpy(req->hash, myhash, sizeof(myhash));
1807
1906
int lancer_cmd_write_object(struct be_adapter *adapter, struct be_dma_mem *cmd,
1808
u32 data_size, u32 data_offset, const char *obj_name,
1809
u32 *data_written, u8 *addn_status)
1907
u32 data_size, u32 data_offset,
1908
const char *obj_name, u32 *data_written,
1909
u8 *change_status, u8 *addn_status)
1811
1911
struct be_mcc_wrb *wrb;
1812
1912
struct lancer_cmd_req_write_object *req;
1862
1962
status = adapter->flash_status;
1864
1964
resp = embedded_payload(wrb);
1866
1966
*data_written = le32_to_cpu(resp->actual_write_len);
1967
*change_status = resp->change_status;
1868
1969
*addn_status = resp->additional_status;
2332
2434
/* Uses synchronous MCCQ */
2333
int be_cmd_get_mac_from_list(struct be_adapter *adapter, u32 domain,
2334
bool *pmac_id_active, u32 *pmac_id, u8 *mac)
2435
int be_cmd_get_mac_from_list(struct be_adapter *adapter, u8 *mac,
2436
bool *pmac_id_active, u32 *pmac_id, u8 domain)
2336
2438
struct be_mcc_wrb *wrb;
2337
2439
struct be_cmd_req_get_mac_list *req;
2376
2478
get_mac_list_cmd.va;
2377
2479
mac_count = resp->true_mac_count + resp->pseudo_mac_count;
2378
2480
/* Mac list returned could contain one or more active mac_ids
2379
* or one or more pseudo permanant mac addresses. If an active
2380
* mac_id is present, return first active mac_id found
2481
* or one or more true or pseudo permanant mac addresses.
2482
* If an active mac_id is present, return first active mac_id
2382
2485
for (i = 0; i < mac_count; i++) {
2383
2486
struct get_list_macaddr *mac_entry;
2399
/* If no active mac_id found, return first pseudo mac addr */
2502
/* If no active mac_id found, return first mac addr */
2400
2503
*pmac_id_active = false;
2401
2504
memcpy(mac, resp->macaddr_list[0].mac_addr_id.macaddr,