Commit 3da7611f authored by David S. Miller's avatar David S. Miller

Merge branch 'qed-misc'

Yuval Mintz says:

====================
qed*: Driver updates

Usually I try to provide a sensible description of the patch set even if
it lacks a general 'motif', but this simply contains several small,
unrelated and self-explenatory tweaks and additions.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 016c0bba 5abd7e92
...@@ -29,10 +29,10 @@ ...@@ -29,10 +29,10 @@
#include "qed_mcp.h" #include "qed_mcp.h"
#include "qed_hw.h" #include "qed_hw.h"
static const char version[] = static char version[] =
"QLogic QL4xxx 40G/100G Ethernet Driver qed " DRV_MODULE_VERSION "\n"; "QLogic FastLinQ 4xxxx Core Module qed " DRV_MODULE_VERSION "\n";
MODULE_DESCRIPTION("QLogic 25G/40G/50G/100G Core Module"); MODULE_DESCRIPTION("QLogic FastLinQ 4xxxx Core Module");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_MODULE_VERSION); MODULE_VERSION(DRV_MODULE_VERSION);
...@@ -45,6 +45,8 @@ MODULE_VERSION(DRV_MODULE_VERSION); ...@@ -45,6 +45,8 @@ MODULE_VERSION(DRV_MODULE_VERSION);
#define QED_FW_FILE_NAME \ #define QED_FW_FILE_NAME \
"qed/qed_init_values_zipped-" FW_FILE_VERSION ".bin" "qed/qed_init_values_zipped-" FW_FILE_VERSION ".bin"
MODULE_FIRMWARE(QED_FW_FILE_NAME);
static int __init qed_init(void) static int __init qed_init(void)
{ {
pr_notice("qed_init called\n"); pr_notice("qed_init called\n");
...@@ -97,12 +99,15 @@ static void qed_free_pci(struct qed_dev *cdev) ...@@ -97,12 +99,15 @@ static void qed_free_pci(struct qed_dev *cdev)
pci_disable_device(pdev); pci_disable_device(pdev);
} }
#define PCI_REVISION_ID_ERROR_VAL 0xff
/* Performs PCI initializations as well as initializing PCI-related parameters /* Performs PCI initializations as well as initializing PCI-related parameters
* in the device structrue. Returns 0 in case of success. * in the device structrue. Returns 0 in case of success.
*/ */
static int qed_init_pci(struct qed_dev *cdev, static int qed_init_pci(struct qed_dev *cdev,
struct pci_dev *pdev) struct pci_dev *pdev)
{ {
u8 rev_id;
int rc; int rc;
cdev->pdev = pdev; cdev->pdev = pdev;
...@@ -136,6 +141,14 @@ static int qed_init_pci(struct qed_dev *cdev, ...@@ -136,6 +141,14 @@ static int qed_init_pci(struct qed_dev *cdev,
pci_save_state(pdev); pci_save_state(pdev);
} }
pci_read_config_byte(pdev, PCI_REVISION_ID, &rev_id);
if (rev_id == PCI_REVISION_ID_ERROR_VAL) {
DP_NOTICE(cdev,
"Detected PCI device error [rev_id 0x%x]. Probably due to prior indication. Aborting.\n",
rev_id);
rc = -ENODEV;
goto err2;
}
if (!pci_is_pcie(pdev)) { if (!pci_is_pcie(pdev)) {
DP_NOTICE(cdev, "The bus is not PCI Express\n"); DP_NOTICE(cdev, "The bus is not PCI Express\n");
rc = -EIO; rc = -EIO;
......
...@@ -39,10 +39,10 @@ ...@@ -39,10 +39,10 @@
#include "qede.h" #include "qede.h"
static const char version[] = "QLogic QL4xxx 40G/100G Ethernet Driver qede " static char version[] =
DRV_MODULE_VERSION "\n"; "QLogic FastLinQ 4xxxx Ethernet Driver qede " DRV_MODULE_VERSION "\n";
MODULE_DESCRIPTION("QLogic 40G/100G Ethernet Driver"); MODULE_DESCRIPTION("QLogic FastLinQ 4xxxx Ethernet Driver");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_VERSION(DRV_MODULE_VERSION); MODULE_VERSION(DRV_MODULE_VERSION);
...@@ -53,7 +53,7 @@ MODULE_PARM_DESC(debug, " Default debug msglevel"); ...@@ -53,7 +53,7 @@ MODULE_PARM_DESC(debug, " Default debug msglevel");
static const struct qed_eth_ops *qed_ops; static const struct qed_eth_ops *qed_ops;
#define CHIP_NUM_57980S_40 0x1634 #define CHIP_NUM_57980S_40 0x1634
#define CHIP_NUM_57980S_10 0x1635 #define CHIP_NUM_57980S_10 0x1666
#define CHIP_NUM_57980S_MF 0x1636 #define CHIP_NUM_57980S_MF 0x1636
#define CHIP_NUM_57980S_100 0x1644 #define CHIP_NUM_57980S_100 0x1644
#define CHIP_NUM_57980S_50 0x1654 #define CHIP_NUM_57980S_50 0x1654
...@@ -380,6 +380,28 @@ static int map_frag_to_bd(struct qede_dev *edev, ...@@ -380,6 +380,28 @@ static int map_frag_to_bd(struct qede_dev *edev,
return 0; return 0;
} }
/* +2 for 1st BD for headers and 2nd BD for headlen (if required) */
#if ((MAX_SKB_FRAGS + 2) > ETH_TX_MAX_BDS_PER_NON_LSO_PACKET)
static bool qede_pkt_req_lin(struct qede_dev *edev, struct sk_buff *skb,
u8 xmit_type)
{
int allowed_frags = ETH_TX_MAX_BDS_PER_NON_LSO_PACKET - 1;
if (xmit_type & XMIT_LSO) {
int hlen;
hlen = skb_transport_header(skb) +
tcp_hdrlen(skb) - skb->data;
/* linear payload would require its own BD */
if (skb_headlen(skb) > hlen)
allowed_frags--;
}
return (skb_shinfo(skb)->nr_frags > allowed_frags);
}
#endif
/* Main transmit function */ /* Main transmit function */
static static
netdev_tx_t qede_start_xmit(struct sk_buff *skb, netdev_tx_t qede_start_xmit(struct sk_buff *skb,
...@@ -407,16 +429,22 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb, ...@@ -407,16 +429,22 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb,
txq = QEDE_TX_QUEUE(edev, txq_index); txq = QEDE_TX_QUEUE(edev, txq_index);
netdev_txq = netdev_get_tx_queue(ndev, txq_index); netdev_txq = netdev_get_tx_queue(ndev, txq_index);
/* Current code doesn't support SKB linearization, since the max number
* of skb frags can be passed in the FW HSI.
*/
BUILD_BUG_ON(MAX_SKB_FRAGS > ETH_TX_MAX_BDS_PER_NON_LSO_PACKET);
WARN_ON(qed_chain_get_elem_left(&txq->tx_pbl) < WARN_ON(qed_chain_get_elem_left(&txq->tx_pbl) <
(MAX_SKB_FRAGS + 1)); (MAX_SKB_FRAGS + 1));
xmit_type = qede_xmit_type(edev, skb, &ipv6_ext); xmit_type = qede_xmit_type(edev, skb, &ipv6_ext);
#if ((MAX_SKB_FRAGS + 2) > ETH_TX_MAX_BDS_PER_NON_LSO_PACKET)
if (qede_pkt_req_lin(edev, skb, xmit_type)) {
if (skb_linearize(skb)) {
DP_NOTICE(edev,
"SKB linearization failed - silently dropping this SKB\n");
dev_kfree_skb_any(skb);
return NETDEV_TX_OK;
}
}
#endif
/* Fill the entry in the SW ring and the BDs in the FW ring */ /* Fill the entry in the SW ring and the BDs in the FW ring */
idx = txq->sw_tx_prod & NUM_TX_BDS_MAX; idx = txq->sw_tx_prod & NUM_TX_BDS_MAX;
txq->sw_tx_ring[idx].skb = skb; txq->sw_tx_ring[idx].skb = skb;
...@@ -2752,14 +2780,18 @@ static void qede_link_update(void *dev, struct qed_link_output *link) ...@@ -2752,14 +2780,18 @@ static void qede_link_update(void *dev, struct qed_link_output *link)
} }
if (link->link_up) { if (link->link_up) {
if (!netif_carrier_ok(edev->ndev)) {
DP_NOTICE(edev, "Link is up\n"); DP_NOTICE(edev, "Link is up\n");
netif_tx_start_all_queues(edev->ndev); netif_tx_start_all_queues(edev->ndev);
netif_carrier_on(edev->ndev); netif_carrier_on(edev->ndev);
}
} else { } else {
if (netif_carrier_ok(edev->ndev)) {
DP_NOTICE(edev, "Link is down\n"); DP_NOTICE(edev, "Link is down\n");
netif_tx_disable(edev->ndev); netif_tx_disable(edev->ndev);
netif_carrier_off(edev->ndev); netif_carrier_off(edev->ndev);
} }
}
} }
static int qede_set_mac_addr(struct net_device *ndev, void *p) static int qede_set_mac_addr(struct net_device *ndev, void *p)
......
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