Commit b5f0a3bf authored by Allen Pais's avatar Allen Pais Committed by David S. Miller

qed: convert tasklets to use new tasklet_setup() API

In preparation for unconditionally passing the
struct tasklet_struct pointer to all tasklet
callbacks, switch to using the new tasklet_setup()
and from_tasklet() to pass the tasklet pointer explicitly.
Signed-off-by: default avatarRomain Perier <romain.perier@gmail.com>
Signed-off-by: default avatarAllen Pais <apais@linux.microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent f246d129
...@@ -572,7 +572,7 @@ struct qed_hwfn { ...@@ -572,7 +572,7 @@ struct qed_hwfn {
struct qed_consq *p_consq; struct qed_consq *p_consq;
/* Slow-Path definitions */ /* Slow-Path definitions */
struct tasklet_struct *sp_dpc; struct tasklet_struct sp_dpc;
bool b_sp_dpc_enabled; bool b_sp_dpc_enabled;
struct qed_ptt *p_main_ptt; struct qed_ptt *p_main_ptt;
......
...@@ -1216,9 +1216,9 @@ static void qed_sb_ack_attn(struct qed_hwfn *p_hwfn, ...@@ -1216,9 +1216,9 @@ static void qed_sb_ack_attn(struct qed_hwfn *p_hwfn,
barrier(); barrier();
} }
void qed_int_sp_dpc(unsigned long hwfn_cookie) void qed_int_sp_dpc(struct tasklet_struct *t)
{ {
struct qed_hwfn *p_hwfn = (struct qed_hwfn *)hwfn_cookie; struct qed_hwfn *p_hwfn = from_tasklet(p_hwfn, t, sp_dpc);
struct qed_pi_info *pi_info = NULL; struct qed_pi_info *pi_info = NULL;
struct qed_sb_attn_info *sb_attn; struct qed_sb_attn_info *sb_attn;
struct qed_sb_info *sb_info; struct qed_sb_info *sb_info;
...@@ -2285,34 +2285,14 @@ u64 qed_int_igu_read_sisr_reg(struct qed_hwfn *p_hwfn) ...@@ -2285,34 +2285,14 @@ u64 qed_int_igu_read_sisr_reg(struct qed_hwfn *p_hwfn)
static void qed_int_sp_dpc_setup(struct qed_hwfn *p_hwfn) static void qed_int_sp_dpc_setup(struct qed_hwfn *p_hwfn)
{ {
tasklet_init(p_hwfn->sp_dpc, tasklet_setup(&p_hwfn->sp_dpc, qed_int_sp_dpc);
qed_int_sp_dpc, (unsigned long)p_hwfn);
p_hwfn->b_sp_dpc_enabled = true; p_hwfn->b_sp_dpc_enabled = true;
} }
static int qed_int_sp_dpc_alloc(struct qed_hwfn *p_hwfn)
{
p_hwfn->sp_dpc = kmalloc(sizeof(*p_hwfn->sp_dpc), GFP_KERNEL);
if (!p_hwfn->sp_dpc)
return -ENOMEM;
return 0;
}
static void qed_int_sp_dpc_free(struct qed_hwfn *p_hwfn)
{
kfree(p_hwfn->sp_dpc);
p_hwfn->sp_dpc = NULL;
}
int qed_int_alloc(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) int qed_int_alloc(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
{ {
int rc = 0; int rc = 0;
rc = qed_int_sp_dpc_alloc(p_hwfn);
if (rc)
return rc;
rc = qed_int_sp_sb_alloc(p_hwfn, p_ptt); rc = qed_int_sp_sb_alloc(p_hwfn, p_ptt);
if (rc) if (rc)
return rc; return rc;
...@@ -2326,7 +2306,6 @@ void qed_int_free(struct qed_hwfn *p_hwfn) ...@@ -2326,7 +2306,6 @@ void qed_int_free(struct qed_hwfn *p_hwfn)
{ {
qed_int_sp_sb_free(p_hwfn); qed_int_sp_sb_free(p_hwfn);
qed_int_sb_attn_free(p_hwfn); qed_int_sb_attn_free(p_hwfn);
qed_int_sp_dpc_free(p_hwfn);
} }
void qed_int_setup(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt) void qed_int_setup(struct qed_hwfn *p_hwfn, struct qed_ptt *p_ptt)
......
...@@ -140,7 +140,7 @@ int qed_int_sb_release(struct qed_hwfn *p_hwfn, ...@@ -140,7 +140,7 @@ int qed_int_sb_release(struct qed_hwfn *p_hwfn,
* @param p_hwfn - pointer to hwfn * @param p_hwfn - pointer to hwfn
* *
*/ */
void qed_int_sp_dpc(unsigned long hwfn_cookie); void qed_int_sp_dpc(struct tasklet_struct *t);
/** /**
* @brief qed_int_get_num_sbs - get the number of status * @brief qed_int_get_num_sbs - get the number of status
......
...@@ -734,7 +734,7 @@ static irqreturn_t qed_single_int(int irq, void *dev_instance) ...@@ -734,7 +734,7 @@ static irqreturn_t qed_single_int(int irq, void *dev_instance)
/* Slowpath interrupt */ /* Slowpath interrupt */
if (unlikely(status & 0x1)) { if (unlikely(status & 0x1)) {
tasklet_schedule(hwfn->sp_dpc); tasklet_schedule(&hwfn->sp_dpc);
status &= ~0x1; status &= ~0x1;
rc = IRQ_HANDLED; rc = IRQ_HANDLED;
} }
...@@ -780,7 +780,7 @@ int qed_slowpath_irq_req(struct qed_hwfn *hwfn) ...@@ -780,7 +780,7 @@ int qed_slowpath_irq_req(struct qed_hwfn *hwfn)
id, cdev->pdev->bus->number, id, cdev->pdev->bus->number,
PCI_SLOT(cdev->pdev->devfn), hwfn->abs_pf_id); PCI_SLOT(cdev->pdev->devfn), hwfn->abs_pf_id);
rc = request_irq(cdev->int_params.msix_table[id].vector, rc = request_irq(cdev->int_params.msix_table[id].vector,
qed_msix_sp_int, 0, hwfn->name, hwfn->sp_dpc); qed_msix_sp_int, 0, hwfn->name, &hwfn->sp_dpc);
} else { } else {
unsigned long flags = 0; unsigned long flags = 0;
...@@ -812,8 +812,8 @@ static void qed_slowpath_tasklet_flush(struct qed_hwfn *p_hwfn) ...@@ -812,8 +812,8 @@ static void qed_slowpath_tasklet_flush(struct qed_hwfn *p_hwfn)
* enable function makes this sequence a flush-like operation. * enable function makes this sequence a flush-like operation.
*/ */
if (p_hwfn->b_sp_dpc_enabled) { if (p_hwfn->b_sp_dpc_enabled) {
tasklet_disable(p_hwfn->sp_dpc); tasklet_disable(&p_hwfn->sp_dpc);
tasklet_enable(p_hwfn->sp_dpc); tasklet_enable(&p_hwfn->sp_dpc);
} }
} }
...@@ -842,7 +842,7 @@ static void qed_slowpath_irq_free(struct qed_dev *cdev) ...@@ -842,7 +842,7 @@ static void qed_slowpath_irq_free(struct qed_dev *cdev)
break; break;
synchronize_irq(cdev->int_params.msix_table[i].vector); synchronize_irq(cdev->int_params.msix_table[i].vector);
free_irq(cdev->int_params.msix_table[i].vector, free_irq(cdev->int_params.msix_table[i].vector,
cdev->hwfns[i].sp_dpc); &cdev->hwfns[i].sp_dpc);
} }
} else { } else {
if (QED_LEADING_HWFN(cdev)->b_int_requested) if (QED_LEADING_HWFN(cdev)->b_int_requested)
...@@ -861,11 +861,11 @@ static int qed_nic_stop(struct qed_dev *cdev) ...@@ -861,11 +861,11 @@ static int qed_nic_stop(struct qed_dev *cdev)
struct qed_hwfn *p_hwfn = &cdev->hwfns[i]; struct qed_hwfn *p_hwfn = &cdev->hwfns[i];
if (p_hwfn->b_sp_dpc_enabled) { if (p_hwfn->b_sp_dpc_enabled) {
tasklet_disable(p_hwfn->sp_dpc); tasklet_disable(&p_hwfn->sp_dpc);
p_hwfn->b_sp_dpc_enabled = false; p_hwfn->b_sp_dpc_enabled = false;
DP_VERBOSE(cdev, NETIF_MSG_IFDOWN, DP_VERBOSE(cdev, NETIF_MSG_IFDOWN,
"Disabled sp tasklet [hwfn %d] at %p\n", "Disabled sp tasklet [hwfn %d] at %p\n",
i, p_hwfn->sp_dpc); i, &p_hwfn->sp_dpc);
} }
} }
......
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