Print this page
9724 qede needs updates for newer GCC

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/qede/qede_gld.c
          +++ new/usr/src/uts/common/io/qede/qede_gld.c
↓ open down ↓ 25 lines elided ↑ open up ↑
  26   26  
  27   27  * You may not use this file except in compliance with the License.
  28   28  
  29   29  * You can obtain a copy of the License at available 
  30   30  * at http://opensource.org/licenses/CDDL-1.0
  31   31  
  32   32  * See the License for the specific language governing permissions and 
  33   33  * limitations under the License.
  34   34  */
  35   35  
       36 +/*
       37 + * Copyright 2018 Joyent, Inc.
       38 + */
  36   39  
  37   40  #include "qede.h"
  38   41  
  39   42  #define FP_LOCK(ptr)    \
  40   43  mutex_enter(&ptr->fp_lock);
  41   44  #define FP_UNLOCK(ptr)  \
  42   45  mutex_exit(&ptr->fp_lock);
  43   46  
  44   47  int
  45   48  qede_ucst_find(qede_t *qede, const uint8_t *mac_addr)
↓ open down ↓ 1210 lines elided ↑ open up ↑
1256 1259          { external,     "external",     QEDE_LOOP_EXTERNAL            },
1257 1260  };
1258 1261  
1259 1262  /* 
1260 1263   * Set Loopback mode 
1261 1264   */
1262 1265  
1263 1266  static enum ioc_reply
1264 1267  qede_set_loopback_mode(qede_t *qede, uint32_t mode)
1265 1268  {
1266      -        int ret, i = 0;
     1269 +        int i = 0;
1267 1270          struct ecore_dev *edev = &qede->edev;
1268 1271          struct ecore_hwfn *hwfn;
1269 1272          struct ecore_ptt *ptt = NULL;
1270 1273          struct ecore_mcp_link_params *link_params;
1271 1274  
1272 1275          hwfn = &edev->hwfns[0];
1273 1276          link_params = ecore_mcp_get_link_params(hwfn);
1274 1277          ptt = ecore_ptt_acquire(hwfn);
1275 1278  
1276 1279          switch(mode) {
↓ open down ↓ 6 lines elided ↑ open up ↑
1283 1286                  ecore_mcp_set_link(hwfn, ptt, 0);
1284 1287  
1285 1288                  while (qede->params.link_state && i < 5000) {
1286 1289                          OSAL_MSLEEP(1);
1287 1290                          i++;
1288 1291                  }
1289 1292                  i = 0;
1290 1293  
1291 1294                  link_params->loopback_mode = ETH_LOOPBACK_NONE;
1292 1295                  qede->loop_back_mode = QEDE_LOOP_NONE;
1293      -                ret = ecore_mcp_set_link(hwfn, ptt, 1);
     1296 +                (void) ecore_mcp_set_link(hwfn, ptt, 1);
1294 1297                  ecore_ptt_release(hwfn, ptt);
1295 1298  
1296 1299                  while (!qede->params.link_state && i < 5000) {
1297 1300                          OSAL_MSLEEP(1);
1298 1301                          i++;
1299 1302                  }
1300 1303                  return IOC_REPLY;
1301 1304  
1302 1305          case QEDE_LOOP_INTERNAL:
1303 1306                  qede_print("!%s(%d) : loopback mode (INTERNAL) is set!",
1304 1307                      __func__, qede->instance);
1305 1308                      ecore_mcp_set_link(hwfn, ptt, 0);
1306 1309  
1307 1310                  while(qede->params.link_state && i < 5000) {
1308 1311                          OSAL_MSLEEP(1);
1309 1312                          i++;
1310 1313                  }
1311 1314                  i = 0;
1312 1315                  link_params->loopback_mode = ETH_LOOPBACK_INT_PHY;
1313 1316                  qede->loop_back_mode = QEDE_LOOP_INTERNAL;
1314      -                ret = ecore_mcp_set_link(hwfn, ptt, 1);
     1317 +                (void) ecore_mcp_set_link(hwfn, ptt, 1);
1315 1318                  ecore_ptt_release(hwfn, ptt);
1316 1319  
1317 1320                  while(!qede->params.link_state && i < 5000) {
1318 1321                          OSAL_MSLEEP(1);
1319 1322                          i++;
1320 1323                  }
1321 1324                  return IOC_REPLY;
1322 1325  
1323 1326          case QEDE_LOOP_EXTERNAL:
1324 1327                  qede_print("!%s(%d) : External loopback mode is not supported",
↓ open down ↓ 132 lines elided ↑ open up ↑
1457 1460          }
1458 1461          return (ret);
1459 1462  }
1460 1463  
1461 1464  static int
1462 1465  qede_ioctl_rd_wr_nvram(qede_t *qede, mblk_t *mp)
1463 1466  {
1464 1467          qede_nvram_data_t *data1 = (qede_nvram_data_t *)(mp->b_cont->b_rptr); 
1465 1468          qede_nvram_data_t *data2, *next_data;
1466 1469          struct ecore_dev *edev = &qede->edev;
1467      -        uint32_t ret = 0, hdr_size = 24, bytes_to_copy, copy_len = 0;
     1470 +        uint32_t hdr_size = 24, bytes_to_copy, copy_len = 0;
1468 1471          uint32_t copy_len1 = 0;
1469 1472          uint32_t addr = data1->off;
1470 1473          uint32_t size = data1->size, i, buf_size;
1471 1474          uint8_t cmd, cmd2;
1472 1475          uint8_t *buf, *tmp_buf;
1473 1476          mblk_t *mp1;
1474 1477  
1475 1478          cmd = (uint8_t)data1->unused1;
1476 1479  
1477 1480          switch(cmd) {
1478 1481          case QEDE_NVRAM_CMD_READ:
1479 1482                  buf = kmem_zalloc(size, GFP_KERNEL);
1480 1483                  if(buf == NULL) {
1481 1484                          cmn_err(CE_WARN, "memory allocation failed" 
1482 1485                          " in nvram read ioctl\n");
1483 1486                          return (DDI_FAILURE);
1484 1487                  }
1485      -                ret = ecore_mcp_nvm_read(edev, addr, buf, data1->size);
     1488 +                (void) ecore_mcp_nvm_read(edev, addr, buf, data1->size);
1486 1489  
1487 1490                  copy_len = (MBLKL(mp->b_cont)) - hdr_size;
1488 1491                  if(copy_len > size) {
1489 1492                          (void) memcpy(data1->uabc, buf, size);
1490 1493                          kmem_free(buf, size);
1491 1494                          //OSAL_FREE(edev, buf);
1492      -                        ret = 0;
1493 1495                          break;
1494 1496                  }
1495 1497                  (void) memcpy(data1->uabc, buf, copy_len);
1496 1498                  bytes_to_copy = size - copy_len;
1497 1499                  tmp_buf = ((uint8_t *)buf) + copy_len;
1498 1500                  copy_len1 = copy_len;
1499 1501                  mp1 = mp->b_cont;
1500 1502                  mp1 = mp1->b_cont;
1501 1503  
1502 1504                  while (mp1) {
↓ open down ↓ 19 lines elided ↑ open up ↑
1522 1524                  kmem_free(buf, size);
1523 1525                  //OSAL_FREE(edev, buf);
1524 1526                  break;
1525 1527          
1526 1528          case QEDE_NVRAM_CMD_WRITE:
1527 1529                  cmd2 = (uint8_t )data1->cmd2;
1528 1530                  size = data1->size;
1529 1531                  addr = data1->off;
1530 1532                  buf_size =  size; //data1->buf_size;
1531 1533                  //buf_size =  data1->buf_size;
1532      -                ret = 0;
1533 1534  
1534 1535                  switch(cmd2){
1535 1536                  case START_NVM_WRITE:
1536 1537                          buf = kmem_zalloc(size, GFP_KERNEL);
1537 1538                          //buf = qede->reserved_buf;
1538 1539                          qede->nvm_buf_size = data1->size;
1539 1540                          if(buf == NULL) {
1540 1541                                  cmn_err(CE_WARN, 
1541 1542                                  "memory allocation failed in START_NVM_WRITE\n");
1542 1543                                  return DDI_FAILURE;
1543 1544                          }
1544 1545                          qede->nvm_buf_start = buf;
1545 1546                          cmn_err(CE_NOTE, 
1546 1547                              "buf = %p, size = %x\n", qede->nvm_buf_start, size);
1547 1548                          qede->nvm_buf = buf;
1548 1549                          qede->copy_len = 0;
1549 1550                          //tmp_buf = buf + addr;
1550      -                        ret = 0;
1551 1551                          break;
1552 1552                          
1553 1553                  case ACCUMULATE_NVM_BUF:
1554 1554                          tmp_buf = qede->nvm_buf;
1555 1555                          copy_len = MBLKL(mp->b_cont) - hdr_size;
1556 1556                          if(copy_len > buf_size) {
1557 1557                                  if (buf_size < qede->nvm_buf_size) {
1558 1558                                  (void) memcpy(tmp_buf, data1->uabc, buf_size);
1559 1559                                          qede->copy_len = qede->copy_len + 
1560 1560                                              buf_size;
↓ open down ↓ 1 lines elided ↑ open up ↑
1562 1562                                          (void) memcpy(tmp_buf, 
1563 1563                                              data1->uabc, qede->nvm_buf_size);
1564 1564                                          qede->copy_len = 
1565 1565                                              qede->copy_len + qede->nvm_buf_size;
1566 1566                                  }
1567 1567                                  tmp_buf = tmp_buf + buf_size;
1568 1568                                  qede->nvm_buf = tmp_buf;
1569 1569                                  //qede->copy_len = qede->copy_len + buf_size;
1570 1570                                  cmn_err(CE_NOTE, 
1571 1571                                      "buf_size from app = %x\n", copy_len);
1572      -                                ret = 0;
1573 1572                                  break;
1574 1573                          }
1575 1574                          (void) memcpy(tmp_buf, data1->uabc, copy_len);
1576 1575                          tmp_buf = tmp_buf + copy_len;
1577 1576                          bytes_to_copy = buf_size - copy_len;
1578 1577                          mp1 = mp->b_cont;
1579 1578                          mp1 = mp1->b_cont;
1580 1579                          copy_len1 = copy_len;
1581 1580                          
1582 1581                          while (mp1) {
1583 1582                                  copy_len = MBLKL(mp1);
1584 1583                                  if (mp1->b_cont == NULL) {
1585 1584                                          copy_len = MBLKL(mp1) - 4;
1586 1585                                  }
1587 1586                                  next_data = (qede_nvram_data_t *) mp1->b_rptr;
1588 1587                                  if (copy_len > bytes_to_copy){
1589 1588                                          (void) memcpy(tmp_buf, next_data->uabc,
1590 1589                                              bytes_to_copy);
1591 1590                                          qede->copy_len = qede->copy_len + 
1592 1591                                              bytes_to_copy;
1593      -                                        ret = 0;
1594 1592                                          break;
1595 1593                                  }
1596 1594                                  (void) memcpy(tmp_buf, next_data->uabc, 
1597 1595                                      copy_len);
1598 1596                                  qede->copy_len = qede->copy_len + copy_len;
1599 1597                                  tmp_buf = tmp_buf + copy_len;
1600 1598                                  copy_len = copy_len1 + copy_len;
1601 1599                                  bytes_to_copy = bytes_to_copy - copy_len;
1602 1600                                  mp1 = mp1->b_cont;
1603 1601                          }
1604 1602                          qede->nvm_buf = tmp_buf;
1605      -                        ret = 0;
1606 1603                          break;
1607 1604  
1608 1605                  case STOP_NVM_WRITE:
1609 1606                          //qede->nvm_buf = tmp_buf;
1610      -                        ret = 0;
1611 1607                          break;
1612 1608                  case READ_BUF:
1613 1609                          tmp_buf = (uint8_t *)qede->nvm_buf_start;
1614 1610                          for(i = 0; i < size ; i++){
1615 1611                                  cmn_err(CE_NOTE, 
1616 1612                                      "buff (%d) : %d\n", i, *tmp_buf);
1617 1613                                  tmp_buf ++;
1618 1614                          }
1619      -                        ret = 0;
1620 1615                          break;
1621 1616                  }
1622 1617                  break;
1623 1618          case QEDE_NVRAM_CMD_PUT_FILE_DATA:
1624 1619                  tmp_buf = qede->nvm_buf_start;  
1625      -                ret = ecore_mcp_nvm_write(edev, ECORE_PUT_FILE_DATA,
     1620 +                (void) ecore_mcp_nvm_write(edev, ECORE_PUT_FILE_DATA,
1626 1621                            addr, tmp_buf, size);
1627 1622                  kmem_free(qede->nvm_buf_start, size);
1628 1623                  //OSAL_FREE(edev, tmp_buf);
1629 1624                  cmn_err(CE_NOTE, "total size = %x, copied size = %x\n",
1630 1625                      qede->nvm_buf_size, qede->copy_len);
1631 1626                  tmp_buf = NULL;
1632 1627                  qede->nvm_buf = NULL;
1633 1628                  qede->nvm_buf_start = NULL;
1634      -                ret = 0;
1635 1629                  break;
1636 1630  
1637 1631          case QEDE_NVRAM_CMD_SET_SECURE_MODE:
1638      -                ret = ecore_mcp_nvm_set_secure_mode(edev, addr);
     1632 +                (void) ecore_mcp_nvm_set_secure_mode(edev, addr);
1639 1633                  break;
1640 1634  
1641 1635          case QEDE_NVRAM_CMD_DEL_FILE:
1642      -                ret = ecore_mcp_nvm_del_file(edev, addr);
     1636 +                (void) ecore_mcp_nvm_del_file(edev, addr);
1643 1637                  break;
1644 1638  
1645 1639          case QEDE_NVRAM_CMD_PUT_FILE_BEGIN:
1646      -                ret = ecore_mcp_nvm_put_file_begin(edev, addr);
     1640 +                (void) ecore_mcp_nvm_put_file_begin(edev, addr);
1647 1641                  break;
1648 1642  
1649 1643          case QEDE_NVRAM_CMD_GET_NVRAM_RESP:
1650 1644                  buf = kmem_zalloc(size, KM_SLEEP);
1651      -                ret = ecore_mcp_nvm_resp(edev, buf);
     1645 +                (void) ecore_mcp_nvm_resp(edev, buf);
1652 1646                  (void)memcpy(data1->uabc, buf, size);
1653 1647                  kmem_free(buf, size);
1654 1648                  break;
1655 1649  
1656 1650          default:
1657 1651                  cmn_err(CE_WARN, 
1658 1652                      "wrong command in NVRAM read/write from application\n");
1659 1653                  break;
1660 1654          }
1661 1655          return (DDI_SUCCESS);   
↓ open down ↓ 907 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX