Merge "mhi: core: process incoming data based on event ring type"

This commit is contained in:
Linux Build Service Account 2017-03-19 12:40:30 -07:00 committed by Gerrit - the friendly Code Review server
commit f81cdebca6
2 changed files with 10 additions and 10 deletions

View file

@ -114,6 +114,7 @@ static int mhi_process_event_ring(
ev_index); ev_index);
spin_unlock_bh(&ring->ring_lock); spin_unlock_bh(&ring->ring_lock);
__pm_relax(&mhi_dev_ctxt->w_lock); __pm_relax(&mhi_dev_ctxt->w_lock);
event_quota--;
break; break;
} }
case MHI_PKT_TYPE_STATE_CHANGE_EVENT: case MHI_PKT_TYPE_STATE_CHANGE_EVENT:
@ -207,7 +208,6 @@ static int mhi_process_event_ring(
ev_ctxt->mhi_event_read_ptr); ev_ctxt->mhi_event_read_ptr);
spin_unlock_irqrestore(&local_ev_ctxt->ring_lock, flags); spin_unlock_irqrestore(&local_ev_ctxt->ring_lock, flags);
ret_val = 0; ret_val = 0;
--event_quota;
} }
read_lock_bh(&mhi_dev_ctxt->pm_xfer_lock); read_lock_bh(&mhi_dev_ctxt->pm_xfer_lock);
mhi_dev_ctxt->deassert_wake(mhi_dev_ctxt); mhi_dev_ctxt->deassert_wake(mhi_dev_ctxt);
@ -222,12 +222,10 @@ void mhi_ev_task(unsigned long data)
struct mhi_device_ctxt *mhi_dev_ctxt = struct mhi_device_ctxt *mhi_dev_ctxt =
mhi_ring->mhi_dev_ctxt; mhi_ring->mhi_dev_ctxt;
int ev_index = mhi_ring->index; int ev_index = mhi_ring->index;
struct mhi_event_ring_cfg *ring_props =
&mhi_dev_ctxt->ev_ring_props[ev_index];
mhi_log(mhi_dev_ctxt, MHI_MSG_VERBOSE, "Enter\n"); mhi_log(mhi_dev_ctxt, MHI_MSG_VERBOSE, "Enter\n");
/* Process event ring */ /* Process event ring */
mhi_process_event_ring(mhi_dev_ctxt, ev_index, ring_props->nr_desc); mhi_process_event_ring(mhi_dev_ctxt, ev_index, U32_MAX);
enable_irq(MSI_TO_IRQ(mhi_dev_ctxt, ev_index)); enable_irq(MSI_TO_IRQ(mhi_dev_ctxt, ev_index));
mhi_log(mhi_dev_ctxt, MHI_MSG_VERBOSE, "Exit\n"); mhi_log(mhi_dev_ctxt, MHI_MSG_VERBOSE, "Exit\n");
@ -240,12 +238,10 @@ void process_event_ring(struct work_struct *work)
struct mhi_device_ctxt *mhi_dev_ctxt = struct mhi_device_ctxt *mhi_dev_ctxt =
mhi_ring->mhi_dev_ctxt; mhi_ring->mhi_dev_ctxt;
int ev_index = mhi_ring->index; int ev_index = mhi_ring->index;
struct mhi_event_ring_cfg *ring_props =
&mhi_dev_ctxt->ev_ring_props[ev_index];
mhi_log(mhi_dev_ctxt, MHI_MSG_VERBOSE, "Enter\n"); mhi_log(mhi_dev_ctxt, MHI_MSG_VERBOSE, "Enter\n");
/* Process event ring */ /* Process event ring */
mhi_process_event_ring(mhi_dev_ctxt, ev_index, ring_props->nr_desc); mhi_process_event_ring(mhi_dev_ctxt, ev_index, U32_MAX);
enable_irq(MSI_TO_IRQ(mhi_dev_ctxt, ev_index)); enable_irq(MSI_TO_IRQ(mhi_dev_ctxt, ev_index));
mhi_log(mhi_dev_ctxt, MHI_MSG_VERBOSE, "Exit\n"); mhi_log(mhi_dev_ctxt, MHI_MSG_VERBOSE, "Exit\n");

View file

@ -1096,7 +1096,8 @@ static int parse_outbound(struct mhi_device_ctxt *mhi_dev_ctxt,
} }
static int parse_inbound(struct mhi_device_ctxt *mhi_dev_ctxt, static int parse_inbound(struct mhi_device_ctxt *mhi_dev_ctxt,
u32 chan, union mhi_xfer_pkt *local_ev_trb_loc, u16 xfer_len) u32 chan, union mhi_xfer_pkt *local_ev_trb_loc,
u16 xfer_len, unsigned ev_ring)
{ {
struct mhi_client_handle *client_handle; struct mhi_client_handle *client_handle;
struct mhi_client_config *client_config; struct mhi_client_config *client_config;
@ -1104,6 +1105,8 @@ static int parse_inbound(struct mhi_device_ctxt *mhi_dev_ctxt,
struct mhi_result *result; struct mhi_result *result;
struct mhi_cb_info cb_info; struct mhi_cb_info cb_info;
struct mhi_ring *bb_ctxt = &mhi_dev_ctxt->chan_bb_list[chan]; struct mhi_ring *bb_ctxt = &mhi_dev_ctxt->chan_bb_list[chan];
bool ev_managed = GET_EV_PROPS(EV_MANAGED,
mhi_dev_ctxt->ev_ring_props[ev_ring].flags);
int r; int r;
uintptr_t bb_index, ctxt_index_rp, ctxt_index_wp; uintptr_t bb_index, ctxt_index_rp, ctxt_index_wp;
@ -1117,7 +1120,7 @@ static int parse_inbound(struct mhi_device_ctxt *mhi_dev_ctxt,
result = &client_config->result; result = &client_config->result;
parse_inbound_bb(mhi_dev_ctxt, bb_ctxt, result, xfer_len); parse_inbound_bb(mhi_dev_ctxt, bb_ctxt, result, xfer_len);
if (unlikely(IS_SOFTWARE_CHANNEL(chan))) { if (ev_managed) {
MHI_TX_TRB_SET_LEN(TX_TRB_LEN, local_ev_trb_loc, xfer_len); MHI_TX_TRB_SET_LEN(TX_TRB_LEN, local_ev_trb_loc, xfer_len);
r = ctxt_del_element(local_chan_ctxt, NULL); r = ctxt_del_element(local_chan_ctxt, NULL);
BUG_ON(r); BUG_ON(r);
@ -1283,7 +1286,8 @@ int parse_xfer_event(struct mhi_device_ctxt *mhi_dev_ctxt,
} }
if (local_chan_ctxt->dir == MHI_IN) { if (local_chan_ctxt->dir == MHI_IN) {
parse_inbound(mhi_dev_ctxt, chan, parse_inbound(mhi_dev_ctxt, chan,
local_ev_trb_loc, xfer_len); local_ev_trb_loc, xfer_len,
event_id);
} else { } else {
parse_outbound(mhi_dev_ctxt, chan, parse_outbound(mhi_dev_ctxt, chan,
local_ev_trb_loc, xfer_len); local_ev_trb_loc, xfer_len);