mirror of
https://github.com/corundum/corundum.git
synced 2025-01-16 08:12:53 +08:00
modules/mqnic: Associate messages with netdev
Signed-off-by: Alex Forencich <alex@alexforencich.com>
This commit is contained in:
parent
335c731ef0
commit
aef62af18c
@ -137,8 +137,8 @@ static int mqnic_set_ringparam(struct net_device *ndev,
|
||||
if (rx_ring_size == priv->rx_ring_size && tx_ring_size == priv->tx_ring_size)
|
||||
return 0;
|
||||
|
||||
dev_info(priv->dev, "New TX ring size: %d", tx_ring_size);
|
||||
dev_info(priv->dev, "New RX ring size: %d", rx_ring_size);
|
||||
netdev_info(ndev, "New TX ring size: %d", tx_ring_size);
|
||||
netdev_info(ndev, "New RX ring size: %d", rx_ring_size);
|
||||
|
||||
mutex_lock(&priv->mdev->state_lock);
|
||||
|
||||
@ -152,8 +152,7 @@ static int mqnic_set_ringparam(struct net_device *ndev,
|
||||
ret = mqnic_start_port(ndev);
|
||||
|
||||
if (ret)
|
||||
dev_err(priv->dev, "%s: Failed to start port on interface %d netdev %d: %d",
|
||||
__func__, priv->interface->index, priv->index, ret);
|
||||
netdev_err(ndev, "%s: Failed to start port: %d", __func__, ret);
|
||||
}
|
||||
|
||||
mutex_unlock(&priv->mdev->state_lock);
|
||||
@ -261,8 +260,8 @@ static int mqnic_set_channels(struct net_device *ndev,
|
||||
if (rxq_count == priv->rxq_count && txq_count == priv->txq_count)
|
||||
return 0;
|
||||
|
||||
dev_info(priv->dev, "New TX channel count: %d", txq_count);
|
||||
dev_info(priv->dev, "New RX channel count: %d", rxq_count);
|
||||
netdev_info(ndev, "New TX channel count: %d", txq_count);
|
||||
netdev_info(ndev, "New RX channel count: %d", rxq_count);
|
||||
|
||||
if (rxq_count != priv->rxq_count)
|
||||
for (k = 0; k < priv->rx_queue_map_indir_table_size; k++)
|
||||
@ -280,8 +279,7 @@ static int mqnic_set_channels(struct net_device *ndev,
|
||||
ret = mqnic_start_port(ndev);
|
||||
|
||||
if (ret)
|
||||
dev_err(priv->dev, "%s: Failed to start port on interface %d netdev %d: %d",
|
||||
__func__, priv->interface->index, priv->index, ret);
|
||||
netdev_err(ndev, "%s: Failed to start port: %d", __func__, ret);
|
||||
}
|
||||
|
||||
mutex_unlock(&priv->mdev->state_lock);
|
||||
@ -357,14 +355,13 @@ static int mqnic_query_module_id(struct net_device *ndev)
|
||||
static int mqnic_query_module_eeprom_by_page(struct net_device *ndev,
|
||||
u8 i2c_addr, u16 page, u16 bank, u16 offset, u16 len, u8 *data)
|
||||
{
|
||||
struct mqnic_priv *priv = netdev_priv(ndev);
|
||||
int module_id;
|
||||
u8 d;
|
||||
|
||||
module_id = mqnic_query_module_id(ndev);
|
||||
|
||||
if (module_id < 0) {
|
||||
dev_err(priv->dev, "%s: Failed to read module ID (%d)", __func__, module_id);
|
||||
netdev_err(ndev, "%s: Failed to read module ID (%d)", __func__, module_id);
|
||||
return module_id;
|
||||
}
|
||||
|
||||
@ -380,7 +377,7 @@ static int mqnic_query_module_eeprom_by_page(struct net_device *ndev,
|
||||
return -EINVAL;
|
||||
break;
|
||||
default:
|
||||
dev_err(priv->dev, "%s: Unknown module ID (0x%x)", __func__, module_id);
|
||||
netdev_err(ndev, "%s: Unknown module ID (0x%x)", __func__, module_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -402,7 +399,7 @@ static int mqnic_query_module_eeprom_by_page(struct net_device *ndev,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dev_err(priv->dev, "%s: Unknown module ID (0x%x)", __func__, module_id);
|
||||
netdev_err(ndev, "%s: Unknown module ID (0x%x)", __func__, module_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -413,7 +410,6 @@ static int mqnic_query_module_eeprom_by_page(struct net_device *ndev,
|
||||
static int mqnic_query_module_eeprom(struct net_device *ndev,
|
||||
u16 offset, u16 len, u8 *data)
|
||||
{
|
||||
struct mqnic_priv *priv = netdev_priv(ndev);
|
||||
int module_id;
|
||||
u8 i2c_addr = 0x50;
|
||||
u16 page = 0;
|
||||
@ -422,7 +418,7 @@ static int mqnic_query_module_eeprom(struct net_device *ndev,
|
||||
module_id = mqnic_query_module_id(ndev);
|
||||
|
||||
if (module_id < 0) {
|
||||
dev_err(priv->dev, "%s: Failed to read module ID (%d)", __func__, module_id);
|
||||
netdev_err(ndev, "%s: Failed to read module ID (%d)", __func__, module_id);
|
||||
return module_id;
|
||||
}
|
||||
|
||||
@ -447,7 +443,7 @@ static int mqnic_query_module_eeprom(struct net_device *ndev,
|
||||
}
|
||||
break;
|
||||
default:
|
||||
dev_err(priv->dev, "%s: Unknown module ID (0x%x)", __func__, module_id);
|
||||
netdev_err(ndev, "%s: Unknown module ID (0x%x)", __func__, module_id);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -462,7 +458,6 @@ static int mqnic_query_module_eeprom(struct net_device *ndev,
|
||||
static int mqnic_get_module_info(struct net_device *ndev,
|
||||
struct ethtool_modinfo *modinfo)
|
||||
{
|
||||
struct mqnic_priv *priv = netdev_priv(ndev);
|
||||
int read_len = 0;
|
||||
u8 data[16];
|
||||
|
||||
@ -500,7 +495,7 @@ static int mqnic_get_module_info(struct net_device *ndev,
|
||||
modinfo->eeprom_len = ETH_MODULE_SFF_8636_LEN;
|
||||
break;
|
||||
default:
|
||||
dev_err(priv->dev, "%s: Unknown module ID (0x%x)", __func__, data[0]);
|
||||
netdev_err(ndev, "%s: Unknown module ID (0x%x)", __func__, data[0]);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
@ -510,7 +505,6 @@ static int mqnic_get_module_info(struct net_device *ndev,
|
||||
static int mqnic_get_module_eeprom(struct net_device *ndev,
|
||||
struct ethtool_eeprom *eeprom, u8 *data)
|
||||
{
|
||||
struct mqnic_priv *priv = netdev_priv(ndev);
|
||||
int i = 0;
|
||||
int read_len;
|
||||
|
||||
@ -527,7 +521,7 @@ static int mqnic_get_module_eeprom(struct net_device *ndev,
|
||||
return 0;
|
||||
|
||||
if (read_len < 0) {
|
||||
dev_err(priv->dev, "%s: Failed to read module EEPROM (%d)", __func__, read_len);
|
||||
netdev_err(ndev, "%s: Failed to read module EEPROM (%d)", __func__, read_len);
|
||||
return read_len;
|
||||
}
|
||||
|
||||
@ -542,7 +536,6 @@ static int mqnic_get_module_eeprom_by_page(struct net_device *ndev,
|
||||
const struct ethtool_module_eeprom *eeprom,
|
||||
struct netlink_ext_ack *extack)
|
||||
{
|
||||
struct mqnic_priv *priv = netdev_priv(ndev);
|
||||
int i = 0;
|
||||
int read_len;
|
||||
|
||||
@ -560,7 +553,7 @@ static int mqnic_get_module_eeprom_by_page(struct net_device *ndev,
|
||||
return 0;
|
||||
|
||||
if (read_len < 0) {
|
||||
dev_err(priv->dev, "%s: Failed to read module EEPROM (%d)", __func__, read_len);
|
||||
netdev_err(ndev, "%s: Failed to read module EEPROM (%d)", __func__, read_len);
|
||||
return read_len;
|
||||
}
|
||||
|
||||
|
@ -40,7 +40,6 @@
|
||||
int mqnic_start_port(struct net_device *ndev)
|
||||
{
|
||||
struct mqnic_priv *priv = netdev_priv(ndev);
|
||||
struct mqnic_dev *mdev = priv->mdev;
|
||||
struct mqnic_if *iface = priv->interface;
|
||||
struct mqnic_ring *q;
|
||||
struct mqnic_cq *cq;
|
||||
@ -50,7 +49,7 @@ int mqnic_start_port(struct net_device *ndev)
|
||||
int ret;
|
||||
u32 desc_block_size;
|
||||
|
||||
dev_info(mdev->dev, "%s on interface %d netdev %d", __func__,
|
||||
netdev_info(ndev, "%s on interface %d netdev %d", __func__,
|
||||
priv->interface->index, priv->index);
|
||||
|
||||
netif_set_real_num_tx_queues(ndev, priv->txq_count);
|
||||
@ -214,13 +213,12 @@ fail:
|
||||
void mqnic_stop_port(struct net_device *ndev)
|
||||
{
|
||||
struct mqnic_priv *priv = netdev_priv(ndev);
|
||||
struct mqnic_dev *mdev = priv->mdev;
|
||||
struct mqnic_cq *cq;
|
||||
struct radix_tree_iter iter;
|
||||
void **slot;
|
||||
int k;
|
||||
|
||||
dev_info(mdev->dev, "%s on interface %d netdev %d", __func__,
|
||||
netdev_info(ndev, "%s on interface %d netdev %d", __func__,
|
||||
priv->interface->index, priv->index);
|
||||
|
||||
if (mqnic_link_status_poll)
|
||||
@ -307,7 +305,7 @@ static int mqnic_open(struct net_device *ndev)
|
||||
ret = mqnic_start_port(ndev);
|
||||
|
||||
if (ret)
|
||||
dev_err(mdev->dev, "Failed to start port on interface %d netdev %d: %d",
|
||||
netdev_err(ndev, "Failed to start port on interface %d netdev %d: %d",
|
||||
priv->interface->index, priv->index, ret);
|
||||
|
||||
mutex_unlock(&mdev->state_lock);
|
||||
@ -465,11 +463,11 @@ static int mqnic_change_mtu(struct net_device *ndev, int new_mtu)
|
||||
struct mqnic_dev *mdev = priv->mdev;
|
||||
|
||||
if (new_mtu < ndev->min_mtu || new_mtu > ndev->max_mtu) {
|
||||
dev_err(mdev->dev, "Bad MTU: %d", new_mtu);
|
||||
netdev_err(ndev, "Bad MTU: %d", new_mtu);
|
||||
return -EPERM;
|
||||
}
|
||||
|
||||
dev_info(mdev->dev, "New MTU: %d", new_mtu);
|
||||
netdev_info(ndev, "New MTU: %d", new_mtu);
|
||||
|
||||
ndev->mtu = new_mtu;
|
||||
|
||||
|
@ -342,7 +342,7 @@ int mqnic_process_rx_cq(struct mqnic_cq *cq, int napi_budget)
|
||||
page = rx_info->page;
|
||||
|
||||
if (unlikely(!page)) {
|
||||
dev_err(dev, "%s: ring %d null page at index %d",
|
||||
netdev_err(priv->ndev, "%s: ring %d null page at index %d",
|
||||
__func__, rx_ring->index, ring_index);
|
||||
print_hex_dump(KERN_ERR, "", DUMP_PREFIX_NONE, 16, 1,
|
||||
cpl, MQNIC_CPL_SIZE, true);
|
||||
@ -351,7 +351,7 @@ int mqnic_process_rx_cq(struct mqnic_cq *cq, int napi_budget)
|
||||
|
||||
skb = napi_get_frags(&cq->napi);
|
||||
if (unlikely(!skb)) {
|
||||
dev_err(dev, "%s: ring %d failed to allocate skb",
|
||||
netdev_err(priv->ndev, "%s: ring %d failed to allocate skb",
|
||||
__func__, rx_ring->index);
|
||||
break;
|
||||
}
|
||||
|
@ -288,7 +288,7 @@ int mqnic_process_tx_cq(struct mqnic_cq *cq, int napi_budget)
|
||||
|
||||
// TX hardware timestamp
|
||||
if (unlikely(tx_info->ts_requested)) {
|
||||
dev_info(interface->dev, "%s: TX TS requested", __func__);
|
||||
netdev_info(priv->ndev, "%s: TX TS requested", __func__);
|
||||
hwts.hwtstamp = mqnic_read_cpl_ts(interface->mdev, tx_ring, cpl);
|
||||
skb_tstamp_tx(tx_info->skb, &hwts);
|
||||
}
|
||||
@ -465,7 +465,7 @@ netdev_tx_t mqnic_start_xmit(struct sk_buff *skb, struct net_device *ndev)
|
||||
// TX hardware timestamp
|
||||
tx_info->ts_requested = 0;
|
||||
if (unlikely(priv->if_features & MQNIC_IF_FEATURE_PTP_TS && shinfo->tx_flags & SKBTX_HW_TSTAMP)) {
|
||||
dev_info(priv->dev, "%s: TX TS requested", __func__);
|
||||
netdev_info(ndev, "%s: TX TS requested", __func__);
|
||||
shinfo->tx_flags |= SKBTX_IN_PROGRESS;
|
||||
tx_info->ts_requested = 1;
|
||||
}
|
||||
@ -476,7 +476,7 @@ netdev_tx_t mqnic_start_xmit(struct sk_buff *skb, struct net_device *ndev)
|
||||
unsigned int csum_offset = skb->csum_offset;
|
||||
|
||||
if (csum_start > 255 || csum_offset > 127) {
|
||||
dev_info(priv->dev, "%s: Hardware checksum fallback start %d offset %d",
|
||||
netdev_info(ndev, "%s: Hardware checksum fallback start %d offset %d",
|
||||
__func__, csum_start, csum_offset);
|
||||
|
||||
// offset out of range, fall back on software checksum
|
||||
@ -514,7 +514,7 @@ netdev_tx_t mqnic_start_xmit(struct sk_buff *skb, struct net_device *ndev)
|
||||
|
||||
stop_queue = mqnic_is_tx_ring_full(ring);
|
||||
if (unlikely(stop_queue)) {
|
||||
dev_info(priv->dev, "%s: TX ring %d full on port %d",
|
||||
netdev_info(ndev, "%s: TX ring %d full on port %d",
|
||||
__func__, ring_index, priv->index);
|
||||
netif_tx_stop_queue(ring->tx_queue);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user