Commit 5aa1959d authored by David S. Miller's avatar David S. Miller

Merge branch 'ionic-fixes'

Shannon Nelson says:

====================
ionic: bug fixes

Fix a thread race in rx_mode, remove unnecessary log message,
fix dynamic coalescing issues, and count all csum_none cases.
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 0506c93f f07f9815
...@@ -108,7 +108,6 @@ struct ionic_deferred_work { ...@@ -108,7 +108,6 @@ struct ionic_deferred_work {
struct list_head list; struct list_head list;
enum ionic_deferred_work_type type; enum ionic_deferred_work_type type;
union { union {
unsigned int rx_mode;
u8 addr[ETH_ALEN]; u8 addr[ETH_ALEN];
u8 fw_status; u8 fw_status;
}; };
...@@ -179,6 +178,7 @@ struct ionic_lif { ...@@ -179,6 +178,7 @@ struct ionic_lif {
unsigned int index; unsigned int index;
unsigned int hw_index; unsigned int hw_index;
struct mutex queue_lock; /* lock for queue structures */ struct mutex queue_lock; /* lock for queue structures */
struct mutex config_lock; /* lock for config actions */
spinlock_t adminq_lock; /* lock for AdminQ operations */ spinlock_t adminq_lock; /* lock for AdminQ operations */
struct ionic_qcq *adminqcq; struct ionic_qcq *adminqcq;
struct ionic_qcq *notifyqcq; struct ionic_qcq *notifyqcq;
...@@ -199,7 +199,7 @@ struct ionic_lif { ...@@ -199,7 +199,7 @@ struct ionic_lif {
unsigned int nrxq_descs; unsigned int nrxq_descs;
u32 rx_copybreak; u32 rx_copybreak;
u64 rxq_features; u64 rxq_features;
unsigned int rx_mode; u16 rx_mode;
u64 hw_features; u64 hw_features;
bool registered; bool registered;
bool mc_overflow; bool mc_overflow;
...@@ -302,7 +302,7 @@ int ionic_lif_identify(struct ionic *ionic, u8 lif_type, ...@@ -302,7 +302,7 @@ int ionic_lif_identify(struct ionic *ionic, u8 lif_type,
int ionic_lif_size(struct ionic *ionic); int ionic_lif_size(struct ionic *ionic);
#if IS_ENABLED(CONFIG_PTP_1588_CLOCK) #if IS_ENABLED(CONFIG_PTP_1588_CLOCK)
int ionic_lif_hwstamp_replay(struct ionic_lif *lif); void ionic_lif_hwstamp_replay(struct ionic_lif *lif);
int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr); int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr);
int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr); int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr);
ktime_t ionic_lif_phc_ktime(struct ionic_lif *lif, u64 counter); ktime_t ionic_lif_phc_ktime(struct ionic_lif *lif, u64 counter);
...@@ -311,10 +311,7 @@ void ionic_lif_unregister_phc(struct ionic_lif *lif); ...@@ -311,10 +311,7 @@ void ionic_lif_unregister_phc(struct ionic_lif *lif);
void ionic_lif_alloc_phc(struct ionic_lif *lif); void ionic_lif_alloc_phc(struct ionic_lif *lif);
void ionic_lif_free_phc(struct ionic_lif *lif); void ionic_lif_free_phc(struct ionic_lif *lif);
#else #else
static inline int ionic_lif_hwstamp_replay(struct ionic_lif *lif) static inline void ionic_lif_hwstamp_replay(struct ionic_lif *lif) {}
{
return -EOPNOTSUPP;
}
static inline int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr) static inline int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr)
{ {
......
...@@ -188,6 +188,9 @@ int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr) ...@@ -188,6 +188,9 @@ int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr)
struct hwtstamp_config config; struct hwtstamp_config config;
int err; int err;
if (!lif->phc || !lif->phc->ptp)
return -EOPNOTSUPP;
if (copy_from_user(&config, ifr->ifr_data, sizeof(config))) if (copy_from_user(&config, ifr->ifr_data, sizeof(config)))
return -EFAULT; return -EFAULT;
...@@ -203,15 +206,16 @@ int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr) ...@@ -203,15 +206,16 @@ int ionic_lif_hwstamp_set(struct ionic_lif *lif, struct ifreq *ifr)
return 0; return 0;
} }
int ionic_lif_hwstamp_replay(struct ionic_lif *lif) void ionic_lif_hwstamp_replay(struct ionic_lif *lif)
{ {
int err; int err;
if (!lif->phc || !lif->phc->ptp)
return;
err = ionic_lif_hwstamp_set_ts_config(lif, NULL); err = ionic_lif_hwstamp_set_ts_config(lif, NULL);
if (err) if (err)
netdev_info(lif->netdev, "hwstamp replay failed: %d\n", err); netdev_info(lif->netdev, "hwstamp replay failed: %d\n", err);
return err;
} }
int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr) int ionic_lif_hwstamp_get(struct ionic_lif *lif, struct ifreq *ifr)
......
...@@ -274,12 +274,11 @@ static void ionic_rx_clean(struct ionic_queue *q, ...@@ -274,12 +274,11 @@ static void ionic_rx_clean(struct ionic_queue *q,
} }
} }
if (likely(netdev->features & NETIF_F_RXCSUM)) { if (likely(netdev->features & NETIF_F_RXCSUM) &&
if (comp->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC) { (comp->csum_flags & IONIC_RXQ_COMP_CSUM_F_CALC)) {
skb->ip_summed = CHECKSUM_COMPLETE; skb->ip_summed = CHECKSUM_COMPLETE;
skb->csum = (__force __wsum)le16_to_cpu(comp->csum); skb->csum = (__force __wsum)le16_to_cpu(comp->csum);
stats->csum_complete++; stats->csum_complete++;
}
} else { } else {
stats->csum_none++; stats->csum_none++;
} }
...@@ -451,11 +450,12 @@ void ionic_rx_empty(struct ionic_queue *q) ...@@ -451,11 +450,12 @@ void ionic_rx_empty(struct ionic_queue *q)
q->tail_idx = 0; q->tail_idx = 0;
} }
static void ionic_dim_update(struct ionic_qcq *qcq) static void ionic_dim_update(struct ionic_qcq *qcq, int napi_mode)
{ {
struct dim_sample dim_sample; struct dim_sample dim_sample;
struct ionic_lif *lif; struct ionic_lif *lif;
unsigned int qi; unsigned int qi;
u64 pkts, bytes;
if (!qcq->intr.dim_coal_hw) if (!qcq->intr.dim_coal_hw)
return; return;
...@@ -463,14 +463,23 @@ static void ionic_dim_update(struct ionic_qcq *qcq) ...@@ -463,14 +463,23 @@ static void ionic_dim_update(struct ionic_qcq *qcq)
lif = qcq->q.lif; lif = qcq->q.lif;
qi = qcq->cq.bound_q->index; qi = qcq->cq.bound_q->index;
ionic_intr_coal_init(lif->ionic->idev.intr_ctrl, switch (napi_mode) {
lif->rxqcqs[qi]->intr.index, case IONIC_LIF_F_TX_DIM_INTR:
qcq->intr.dim_coal_hw); pkts = lif->txqstats[qi].pkts;
bytes = lif->txqstats[qi].bytes;
break;
case IONIC_LIF_F_RX_DIM_INTR:
pkts = lif->rxqstats[qi].pkts;
bytes = lif->rxqstats[qi].bytes;
break;
default:
pkts = lif->txqstats[qi].pkts + lif->rxqstats[qi].pkts;
bytes = lif->txqstats[qi].bytes + lif->rxqstats[qi].bytes;
break;
}
dim_update_sample(qcq->cq.bound_intr->rearm_count, dim_update_sample(qcq->cq.bound_intr->rearm_count,
lif->txqstats[qi].pkts, pkts, bytes, &dim_sample);
lif->txqstats[qi].bytes,
&dim_sample);
net_dim(&qcq->dim, dim_sample); net_dim(&qcq->dim, dim_sample);
} }
...@@ -491,7 +500,7 @@ int ionic_tx_napi(struct napi_struct *napi, int budget) ...@@ -491,7 +500,7 @@ int ionic_tx_napi(struct napi_struct *napi, int budget)
ionic_tx_service, NULL, NULL); ionic_tx_service, NULL, NULL);
if (work_done < budget && napi_complete_done(napi, work_done)) { if (work_done < budget && napi_complete_done(napi, work_done)) {
ionic_dim_update(qcq); ionic_dim_update(qcq, IONIC_LIF_F_TX_DIM_INTR);
flags |= IONIC_INTR_CRED_UNMASK; flags |= IONIC_INTR_CRED_UNMASK;
cq->bound_intr->rearm_count++; cq->bound_intr->rearm_count++;
} }
...@@ -530,7 +539,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget) ...@@ -530,7 +539,7 @@ int ionic_rx_napi(struct napi_struct *napi, int budget)
ionic_rx_fill(cq->bound_q); ionic_rx_fill(cq->bound_q);
if (work_done < budget && napi_complete_done(napi, work_done)) { if (work_done < budget && napi_complete_done(napi, work_done)) {
ionic_dim_update(qcq); ionic_dim_update(qcq, IONIC_LIF_F_RX_DIM_INTR);
flags |= IONIC_INTR_CRED_UNMASK; flags |= IONIC_INTR_CRED_UNMASK;
cq->bound_intr->rearm_count++; cq->bound_intr->rearm_count++;
} }
...@@ -576,7 +585,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget) ...@@ -576,7 +585,7 @@ int ionic_txrx_napi(struct napi_struct *napi, int budget)
ionic_rx_fill(rxcq->bound_q); ionic_rx_fill(rxcq->bound_q);
if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) { if (rx_work_done < budget && napi_complete_done(napi, rx_work_done)) {
ionic_dim_update(qcq); ionic_dim_update(qcq, 0);
flags |= IONIC_INTR_CRED_UNMASK; flags |= IONIC_INTR_CRED_UNMASK;
rxcq->bound_intr->rearm_count++; rxcq->bound_intr->rearm_count++;
} }
......
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