Commit 4034b81b authored by Tomas Winkler's avatar Tomas Winkler Committed by Greg Kroah-Hartman

mei: use consistent naming for TX control flow credits

With the introduction of the receive control flow credits prefixed with
rx_ we add tx_ prefix to the variables and function used for tracking
the transmit control flow credits.
Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 46978ada
...@@ -734,8 +734,8 @@ void mei_cl_set_disconnected(struct mei_cl *cl) ...@@ -734,8 +734,8 @@ void mei_cl_set_disconnected(struct mei_cl *cl)
mei_io_list_flush(&dev->ctrl_rd_list, cl); mei_io_list_flush(&dev->ctrl_rd_list, cl);
mei_io_list_flush(&dev->ctrl_wr_list, cl); mei_io_list_flush(&dev->ctrl_wr_list, cl);
mei_cl_wake_all(cl); mei_cl_wake_all(cl);
cl->mei_flow_ctrl_creds = 0;
cl->rx_flow_ctrl_creds = 0; cl->rx_flow_ctrl_creds = 0;
cl->tx_flow_ctrl_creds = 0;
cl->timer_count = 0; cl->timer_count = 0;
if (!cl->me_cl) if (!cl->me_cl)
...@@ -745,7 +745,7 @@ void mei_cl_set_disconnected(struct mei_cl *cl) ...@@ -745,7 +745,7 @@ void mei_cl_set_disconnected(struct mei_cl *cl)
cl->me_cl->connect_count--; cl->me_cl->connect_count--;
if (cl->me_cl->connect_count == 0) if (cl->me_cl->connect_count == 0)
cl->me_cl->mei_flow_ctrl_creds = 0; cl->me_cl->tx_flow_ctrl_creds = 0;
mei_me_cl_put(cl->me_cl); mei_me_cl_put(cl->me_cl);
cl->me_cl = NULL; cl->me_cl = NULL;
...@@ -1140,43 +1140,42 @@ struct mei_cl *mei_cl_alloc_linked(struct mei_device *dev) ...@@ -1140,43 +1140,42 @@ struct mei_cl *mei_cl_alloc_linked(struct mei_device *dev)
return ERR_PTR(ret); return ERR_PTR(ret);
} }
/** /**
* mei_cl_flow_ctrl_creds - checks flow_control credits for cl. * mei_cl_tx_flow_ctrl_creds - checks flow_control credits for cl.
* *
* @cl: host client * @cl: host client
* *
* Return: 1 if mei_flow_ctrl_creds >0, 0 - otherwise. * Return: 1 if tx_flow_ctrl_creds >0, 0 - otherwise.
*/ */
static int mei_cl_flow_ctrl_creds(struct mei_cl *cl) static int mei_cl_tx_flow_ctrl_creds(struct mei_cl *cl)
{ {
if (WARN_ON(!cl || !cl->me_cl)) if (WARN_ON(!cl || !cl->me_cl))
return -EINVAL; return -EINVAL;
if (cl->mei_flow_ctrl_creds > 0) if (cl->tx_flow_ctrl_creds > 0)
return 1; return 1;
if (mei_cl_is_fixed_address(cl)) if (mei_cl_is_fixed_address(cl))
return 1; return 1;
if (mei_cl_is_single_recv_buf(cl)) { if (mei_cl_is_single_recv_buf(cl)) {
if (cl->me_cl->mei_flow_ctrl_creds > 0) if (cl->me_cl->tx_flow_ctrl_creds > 0)
return 1; return 1;
} }
return 0; return 0;
} }
/** /**
* mei_cl_flow_ctrl_reduce - reduces flow_control. * mei_cl_tx_flow_ctrl_creds_reduce - reduces transmit flow control credits
* for a client
* *
* @cl: private data of the file object * @cl: host client
* *
* Return: * Return:
* 0 on success * 0 on success
* -EINVAL when ctrl credits are <= 0 * -EINVAL when ctrl credits are <= 0
*/ */
static int mei_cl_flow_ctrl_reduce(struct mei_cl *cl) static int mei_cl_tx_flow_ctrl_creds_reduce(struct mei_cl *cl)
{ {
if (WARN_ON(!cl || !cl->me_cl)) if (WARN_ON(!cl || !cl->me_cl))
return -EINVAL; return -EINVAL;
...@@ -1185,13 +1184,13 @@ static int mei_cl_flow_ctrl_reduce(struct mei_cl *cl) ...@@ -1185,13 +1184,13 @@ static int mei_cl_flow_ctrl_reduce(struct mei_cl *cl)
return 0; return 0;
if (mei_cl_is_single_recv_buf(cl)) { if (mei_cl_is_single_recv_buf(cl)) {
if (WARN_ON(cl->me_cl->mei_flow_ctrl_creds <= 0)) if (WARN_ON(cl->me_cl->tx_flow_ctrl_creds <= 0))
return -EINVAL; return -EINVAL;
cl->me_cl->mei_flow_ctrl_creds--; cl->me_cl->tx_flow_ctrl_creds--;
} else { } else {
if (WARN_ON(cl->mei_flow_ctrl_creds <= 0)) if (WARN_ON(cl->tx_flow_ctrl_creds <= 0))
return -EINVAL; return -EINVAL;
cl->mei_flow_ctrl_creds--; cl->tx_flow_ctrl_creds--;
} }
return 0; return 0;
} }
...@@ -1511,7 +1510,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -1511,7 +1510,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
first_chunk = cb->buf_idx == 0; first_chunk = cb->buf_idx == 0;
rets = first_chunk ? mei_cl_flow_ctrl_creds(cl) : 1; rets = first_chunk ? mei_cl_tx_flow_ctrl_creds(cl) : 1;
if (rets < 0) if (rets < 0)
return rets; return rets;
...@@ -1559,7 +1558,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb, ...@@ -1559,7 +1558,7 @@ int mei_cl_irq_write(struct mei_cl *cl, struct mei_cl_cb *cb,
cb->completed = mei_hdr.msg_complete == 1; cb->completed = mei_hdr.msg_complete == 1;
if (first_chunk) { if (first_chunk) {
if (mei_cl_flow_ctrl_reduce(cl)) if (mei_cl_tx_flow_ctrl_creds_reduce(cl))
return -EIO; return -EIO;
} }
...@@ -1617,7 +1616,7 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking) ...@@ -1617,7 +1616,7 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
mei_hdr.msg_complete = 0; mei_hdr.msg_complete = 0;
mei_hdr.internal = cb->internal; mei_hdr.internal = cb->internal;
rets = mei_cl_flow_ctrl_creds(cl); rets = mei_cl_tx_flow_ctrl_creds(cl);
if (rets < 0) if (rets < 0)
goto err; goto err;
...@@ -1645,7 +1644,7 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking) ...@@ -1645,7 +1644,7 @@ int mei_cl_write(struct mei_cl *cl, struct mei_cl_cb *cb, bool blocking)
if (rets) if (rets)
goto err; goto err;
rets = mei_cl_flow_ctrl_reduce(cl); rets = mei_cl_tx_flow_ctrl_creds_reduce(cl);
if (rets) if (rets)
goto err; goto err;
......
...@@ -340,7 +340,7 @@ static int mei_hbm_me_cl_add(struct mei_device *dev, ...@@ -340,7 +340,7 @@ static int mei_hbm_me_cl_add(struct mei_device *dev,
me_cl->props = res->client_properties; me_cl->props = res->client_properties;
me_cl->client_id = res->me_addr; me_cl->client_id = res->me_addr;
me_cl->mei_flow_ctrl_creds = 0; me_cl->tx_flow_ctrl_creds = 0;
mei_me_cl_add(dev, me_cl); mei_me_cl_add(dev, me_cl);
...@@ -637,23 +637,22 @@ int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl) ...@@ -637,23 +637,22 @@ int mei_hbm_cl_flow_control_req(struct mei_device *dev, struct mei_cl *cl)
} }
/** /**
* mei_hbm_add_single_flow_creds - adds single buffer credentials. * mei_hbm_add_single_tx_flow_ctrl_creds - adds single buffer credentials.
* *
* @dev: the device structure * @dev: the device structure
* @flow: flow control. * @fctrl: flow control response bus message
* *
* Return: 0 on success, < 0 otherwise * Return: 0 on success, < 0 otherwise
*/ */
static int mei_hbm_add_single_flow_creds(struct mei_device *dev, static int mei_hbm_add_single_tx_flow_ctrl_creds(struct mei_device *dev,
struct hbm_flow_control *flow) struct hbm_flow_control *fctrl)
{ {
struct mei_me_client *me_cl; struct mei_me_client *me_cl;
int rets; int rets;
me_cl = mei_me_cl_by_id(dev, flow->me_addr); me_cl = mei_me_cl_by_id(dev, fctrl->me_addr);
if (!me_cl) { if (!me_cl) {
dev_err(dev->dev, "no such me client %d\n", dev_err(dev->dev, "no such me client %d\n", fctrl->me_addr);
flow->me_addr);
return -ENOENT; return -ENOENT;
} }
...@@ -662,9 +661,9 @@ static int mei_hbm_add_single_flow_creds(struct mei_device *dev, ...@@ -662,9 +661,9 @@ static int mei_hbm_add_single_flow_creds(struct mei_device *dev,
goto out; goto out;
} }
me_cl->mei_flow_ctrl_creds++; me_cl->tx_flow_ctrl_creds++;
dev_dbg(dev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n", dev_dbg(dev->dev, "recv flow ctrl msg ME %d (single) creds = %d.\n",
flow->me_addr, me_cl->mei_flow_ctrl_creds); fctrl->me_addr, me_cl->tx_flow_ctrl_creds);
rets = 0; rets = 0;
out: out:
...@@ -676,24 +675,24 @@ static int mei_hbm_add_single_flow_creds(struct mei_device *dev, ...@@ -676,24 +675,24 @@ static int mei_hbm_add_single_flow_creds(struct mei_device *dev,
* mei_hbm_cl_flow_control_res - flow control response from me * mei_hbm_cl_flow_control_res - flow control response from me
* *
* @dev: the device structure * @dev: the device structure
* @flow_control: flow control response bus message * @fctrl: flow control response bus message
*/ */
static void mei_hbm_cl_flow_control_res(struct mei_device *dev, static void mei_hbm_cl_tx_flow_ctrl_creds_res(struct mei_device *dev,
struct hbm_flow_control *flow_control) struct hbm_flow_control *fctrl)
{ {
struct mei_cl *cl; struct mei_cl *cl;
if (!flow_control->host_addr) { if (!fctrl->host_addr) {
/* single receive buffer */ /* single receive buffer */
mei_hbm_add_single_flow_creds(dev, flow_control); mei_hbm_add_single_tx_flow_ctrl_creds(dev, fctrl);
return; return;
} }
cl = mei_hbm_cl_find_by_cmd(dev, flow_control); cl = mei_hbm_cl_find_by_cmd(dev, fctrl);
if (cl) { if (cl) {
cl->mei_flow_ctrl_creds++; cl->tx_flow_ctrl_creds++;
cl_dbg(dev, cl, "flow control creds = %d.\n", cl_dbg(dev, cl, "flow control creds = %d.\n",
cl->mei_flow_ctrl_creds); cl->tx_flow_ctrl_creds);
} }
} }
...@@ -1023,7 +1022,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) ...@@ -1023,7 +1022,7 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
struct mei_hbm_cl_cmd *cl_cmd; struct mei_hbm_cl_cmd *cl_cmd;
struct hbm_client_connect_request *disconnect_req; struct hbm_client_connect_request *disconnect_req;
struct hbm_flow_control *flow_control; struct hbm_flow_control *fctrl;
/* read the message to our buffer */ /* read the message to our buffer */
BUG_ON(hdr->length >= sizeof(dev->rd_msg_buf)); BUG_ON(hdr->length >= sizeof(dev->rd_msg_buf));
...@@ -1103,8 +1102,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr) ...@@ -1103,8 +1102,8 @@ int mei_hbm_dispatch(struct mei_device *dev, struct mei_msg_hdr *hdr)
case MEI_FLOW_CONTROL_CMD: case MEI_FLOW_CONTROL_CMD:
dev_dbg(dev->dev, "hbm: client flow control response: message received.\n"); dev_dbg(dev->dev, "hbm: client flow control response: message received.\n");
flow_control = (struct hbm_flow_control *) mei_msg; fctrl = (struct hbm_flow_control *)mei_msg;
mei_hbm_cl_flow_control_res(dev, flow_control); mei_hbm_cl_tx_flow_ctrl_creds_res(dev, fctrl);
break; break;
case MEI_PG_ISOLATION_ENTRY_RES_CMD: case MEI_PG_ISOLATION_ENTRY_RES_CMD:
......
...@@ -144,7 +144,7 @@ struct mei_fw_status { ...@@ -144,7 +144,7 @@ struct mei_fw_status {
* @refcnt: struct reference count * @refcnt: struct reference count
* @props: client properties * @props: client properties
* @client_id: me client id * @client_id: me client id
* @mei_flow_ctrl_creds: flow control credits * @tx_flow_ctrl_creds: flow control credits
* @connect_count: number connections to this client * @connect_count: number connections to this client
* @bus_added: added to bus * @bus_added: added to bus
*/ */
...@@ -153,7 +153,7 @@ struct mei_me_client { ...@@ -153,7 +153,7 @@ struct mei_me_client {
struct kref refcnt; struct kref refcnt;
struct mei_client_properties props; struct mei_client_properties props;
u8 client_id; u8 client_id;
u8 mei_flow_ctrl_creds; u8 tx_flow_ctrl_creds;
u8 connect_count; u8 connect_count;
u8 bus_added; u8 bus_added;
}; };
...@@ -202,7 +202,7 @@ struct mei_cl_cb { ...@@ -202,7 +202,7 @@ struct mei_cl_cb {
* @me_cl: fw client connected * @me_cl: fw client connected
* @fp: file associated with client * @fp: file associated with client
* @host_client_id: host id * @host_client_id: host id
* @mei_flow_ctrl_creds: transmit flow credentials * @tx_flow_ctrl_creds: transmit flow credentials
* @rx_flow_ctrl_creds: receive flow credentials * @rx_flow_ctrl_creds: receive flow credentials
* @timer_count: watchdog timer for operation completion * @timer_count: watchdog timer for operation completion
* @notify_en: notification - enabled/disabled * @notify_en: notification - enabled/disabled
...@@ -226,7 +226,7 @@ struct mei_cl { ...@@ -226,7 +226,7 @@ struct mei_cl {
struct mei_me_client *me_cl; struct mei_me_client *me_cl;
const struct file *fp; const struct file *fp;
u8 host_client_id; u8 host_client_id;
u8 mei_flow_ctrl_creds; u8 tx_flow_ctrl_creds;
u8 rx_flow_ctrl_creds; u8 rx_flow_ctrl_creds;
u8 timer_count; u8 timer_count;
u8 notify_en; u8 notify_en;
......
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