[dpdk-dev,v6,1/2] eal: rename IPC sync request to pending request
Checks
Commit Message
Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Suggested-by: Jianfeng Tan <jianfeng.tan@intel.com>
Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
---
lib/librte_eal/common/eal_common_proc.c | 38 ++++++++++++++++-----------------
1 file changed, 19 insertions(+), 19 deletions(-)
Comments
27/03/2018 15:59, Anatoly Burakov:
> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> Suggested-by: Jianfeng Tan <jianfeng.tan@intel.com>
> Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
You probably have a good explanation for this change.
Please explain in the commit message.
Generally speaking, every commits should have an explanation,
it is a basic quality rule.
Thanks
On 27-Mar-18 5:27 PM, Thomas Monjalon wrote:
> 27/03/2018 15:59, Anatoly Burakov:
>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>> Suggested-by: Jianfeng Tan <jianfeng.tan@intel.com>
>> Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
>
> You probably have a good explanation for this change.
> Please explain in the commit message.
>
> Generally speaking, every commits should have an explanation,
> it is a basic quality rule.
> Thanks
>
This is just to reduce noise in the following patch.
28/03/2018 11:15, Burakov, Anatoly:
> On 27-Mar-18 5:27 PM, Thomas Monjalon wrote:
> > 27/03/2018 15:59, Anatoly Burakov:
> >> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
> >> Suggested-by: Jianfeng Tan <jianfeng.tan@intel.com>
> >> Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
> >
> > You probably have a good explanation for this change.
> > Please explain in the commit message.
> >
> > Generally speaking, every commits should have an explanation,
> > it is a basic quality rule.
> > Thanks
> >
>
> This is just to reduce noise in the following patch.
No Anatoly, you should explain why a rename is needed.
On 28-Mar-18 11:08 AM, Thomas Monjalon wrote:
> 28/03/2018 11:15, Burakov, Anatoly:
>> On 27-Mar-18 5:27 PM, Thomas Monjalon wrote:
>>> 27/03/2018 15:59, Anatoly Burakov:
>>>> Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
>>>> Suggested-by: Jianfeng Tan <jianfeng.tan@intel.com>
>>>> Acked-by: Jianfeng Tan <jianfeng.tan@intel.com>
>>>
>>> You probably have a good explanation for this change.
>>> Please explain in the commit message.
>>>
>>> Generally speaking, every commits should have an explanation,
>>> it is a basic quality rule.
>>> Thanks
>>>
>>
>> This is just to reduce noise in the following patch.
>
> No Anatoly, you should explain why a rename is needed.
>
I know :) I'm going to be submitting a v7 with function renames anyway,
so i'll fix this as well.
@@ -60,8 +60,8 @@ struct mp_msg_internal {
struct rte_mp_msg msg;
};
-struct sync_request {
- TAILQ_ENTRY(sync_request) next;
+struct pending_request {
+ TAILQ_ENTRY(pending_request) next;
int reply_received;
char dst[PATH_MAX];
struct rte_mp_msg *request;
@@ -69,13 +69,13 @@ struct sync_request {
pthread_cond_t cond;
};
-TAILQ_HEAD(sync_request_list, sync_request);
+TAILQ_HEAD(pending_request_list, pending_request);
static struct {
- struct sync_request_list requests;
+ struct pending_request_list requests;
pthread_mutex_t lock;
-} sync_requests = {
- .requests = TAILQ_HEAD_INITIALIZER(sync_requests.requests),
+} pending_requests = {
+ .requests = TAILQ_HEAD_INITIALIZER(pending_requests.requests),
.lock = PTHREAD_MUTEX_INITIALIZER
};
@@ -84,12 +84,12 @@ static int
mp_send(struct rte_mp_msg *msg, const char *peer, int type);
-static struct sync_request *
+static struct pending_request *
find_sync_request(const char *dst, const char *act_name)
{
- struct sync_request *r;
+ struct pending_request *r;
- TAILQ_FOREACH(r, &sync_requests.requests, next) {
+ TAILQ_FOREACH(r, &pending_requests.requests, next) {
if (!strcmp(r->dst, dst) &&
!strcmp(r->request->name, act_name))
break;
@@ -259,7 +259,7 @@ read_msg(struct mp_msg_internal *m, struct sockaddr_un *s)
static void
process_msg(struct mp_msg_internal *m, struct sockaddr_un *s)
{
- struct sync_request *sync_req;
+ struct pending_request *sync_req;
struct action_entry *entry;
struct rte_mp_msg *msg = &m->msg;
rte_mp_t action = NULL;
@@ -267,7 +267,7 @@ process_msg(struct mp_msg_internal *m, struct sockaddr_un *s)
RTE_LOG(DEBUG, EAL, "msg: %s\n", msg->name);
if (m->type == MP_REP || m->type == MP_IGN) {
- pthread_mutex_lock(&sync_requests.lock);
+ pthread_mutex_lock(&pending_requests.lock);
sync_req = find_sync_request(s->sun_path, msg->name);
if (sync_req) {
memcpy(sync_req->reply, msg, sizeof(*msg));
@@ -276,7 +276,7 @@ process_msg(struct mp_msg_internal *m, struct sockaddr_un *s)
pthread_cond_signal(&sync_req->cond);
} else
RTE_LOG(ERR, EAL, "Drop mp reply: %s\n", msg->name);
- pthread_mutex_unlock(&sync_requests.lock);
+ pthread_mutex_unlock(&pending_requests.lock);
return;
}
@@ -607,7 +607,7 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
{
int ret;
struct rte_mp_msg msg, *tmp;
- struct sync_request sync_req, *exist;
+ struct pending_request sync_req, *exist;
sync_req.reply_received = 0;
strcpy(sync_req.dst, dst);
@@ -615,14 +615,14 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
sync_req.reply = &msg;
pthread_cond_init(&sync_req.cond, NULL);
- pthread_mutex_lock(&sync_requests.lock);
+ pthread_mutex_lock(&pending_requests.lock);
exist = find_sync_request(dst, req->name);
if (!exist)
- TAILQ_INSERT_TAIL(&sync_requests.requests, &sync_req, next);
+ TAILQ_INSERT_TAIL(&pending_requests.requests, &sync_req, next);
if (exist) {
RTE_LOG(ERR, EAL, "A pending request %s:%s\n", dst, req->name);
rte_errno = EEXIST;
- pthread_mutex_unlock(&sync_requests.lock);
+ pthread_mutex_unlock(&pending_requests.lock);
return -1;
}
@@ -638,12 +638,12 @@ mp_request_one(const char *dst, struct rte_mp_msg *req,
do {
ret = pthread_cond_timedwait(&sync_req.cond,
- &sync_requests.lock, ts);
+ &pending_requests.lock, ts);
} while (ret != 0 && ret != ETIMEDOUT);
/* We got the lock now */
- TAILQ_REMOVE(&sync_requests.requests, &sync_req, next);
- pthread_mutex_unlock(&sync_requests.lock);
+ TAILQ_REMOVE(&pending_requests.requests, &sync_req, next);
+ pthread_mutex_unlock(&pending_requests.lock);
if (sync_req.reply_received == 0) {
RTE_LOG(ERR, EAL, "Fail to recv reply for request %s:%s\n",