Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1717372

Re: [PATCH 10/18] rpmsg: glink: Add support for TX intents

From Sricharan R <sricharan@codeaurora.org>
Newsgroups linux.kernel
Subject Re: [PATCH 10/18] rpmsg: glink: Add support for TX intents
Date 2017-08-22 14:40 +0200
Message-ID <uhgDo-2ni-23@gated-at.bofh.it> (permalink)
References <ufa94-1so-21@gated-at.bofh.it> <ufaiL-1vO-29@gated-at.bofh.it> <uhdvP-jp-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Hi,

<snip>

> 
> spinlock intent_lock initialization is missed ?

 right, should add that.

>>       kref_init(&channel->refcount);
>>         return channel;
>> @@ -187,6 +215,7 @@ static void qcom_glink_channel_release(struct kref *ref)
>>       struct glink_channel *channel = container_of(ref, struct glink_channel,
>>                                refcount);
>>   +    idr_destroy(&channel->liids);
> 
> idr_destroy shouldn`t be covered by intent_lock ?
> 

 hmm, will fix this.

>>       kfree(channel->name);
>>       kfree(channel);
>>   }
>> @@ -423,6 +452,130 @@ static void qcom_glink_receive_version_ack(struct qcom_glink *glink,
>>       }
>>   }
>>   +/**
>> + * qcom_glink_send_intent_req_ack() - convert an rx intent request ack cmd to
>> +                      wire format and transmit
>> + * @glink:    The transport to transmit on.
>> + * @channel:    The glink channel
>> + * @granted:    The request response to encode.
>> + *
>> + * Return: 0 on success or standard Linux error code.
>> + */
>> +static int qcom_glink_send_intent_req_ack(struct qcom_glink *glink,
>> +                      struct glink_channel *channel,
>> +                      bool granted)
>> +{
>> +    struct glink_msg msg;
>> +
>> +    msg.cmd = cpu_to_le16(RPM_CMD_RX_INTENT_REQ_ACK);
>> +    msg.param1 = cpu_to_le16(channel->lcid);
>> +    msg.param2 = cpu_to_le32(granted);
>> +
>> +    qcom_glink_tx(glink, &msg, sizeof(msg), NULL, 0, true);
>> +
>> +    return 0;
>> +}
>> +
>> +/**
>> + * tx_cmd_local_rx_intent() - convert an rx intent cmd to wire format and
>> + *               transmit
> 
> copy-paste mistake

 ok.

>> + * @glink:    The transport to transmit on.
>> + * @channel:    The local channel
>> + * @size:    The intent to pass on to remote.
>> + *
>> + * Return: 0 on success or standard Linux error code.
>> + */
>> +static int qcom_glink_advertise_intent(struct qcom_glink *glink,
>> +                       struct glink_channel *channel,
>> +                       struct glink_core_rx_intent *intent)
>> +{
>> +    struct command {
>> +        u16 id;
>> +        u16 lcid;
>> +        u32 count;
>> +        u32 size;
>> +        u32 liid;
>> +    } __packed;
>> +    struct command cmd;
>> +
>> +    cmd.id = cpu_to_le16(RPM_CMD_INTENT);
>> +    cmd.lcid = cpu_to_le16(channel->lcid);
>> +    cmd.count = cpu_to_le32(1);
>> +    cmd.size = cpu_to_le32(intent->size);
>> +    cmd.liid = cpu_to_le32(intent->id);
>> +
>> +    qcom_glink_tx(glink, &cmd, sizeof(cmd), NULL, 0, true);
>> +
>> +    return 0;
>> +}
>> +
>> +static struct glink_core_rx_intent *
>> +qcom_glink_alloc_intent(struct qcom_glink *glink,
>> +            struct glink_channel *channel,
>> +            size_t size,
>> +            bool reuseable)
>> +{
>> +    struct glink_core_rx_intent *intent;
>> +    int ret;
>> +    unsigned long flags;
>> +
>> +    intent = kzalloc(sizeof(*intent), GFP_KERNEL);
>> +
>> +    if (!intent)
>> +        return NULL;
>> +
>> +    intent->data = kzalloc(size, GFP_KERNEL);
>> +    if (!intent->data)
>> +        return NULL;
>> +
>> +    spin_lock_irqsave(&channel->intent_lock, flags);
>> +    ret = idr_alloc_cyclic(&channel->liids, intent, 1, -1, GFP_ATOMIC);
>> +    if (ret < 0) {
>> +        spin_unlock_irqrestore(&channel->intent_lock, flags);
>> +        return NULL;
>> +    }
>> +    spin_unlock_irqrestore(&channel->intent_lock, flags);
>> +
>> +    intent->id = ret;
>> +    intent->size = size;
>> +    intent->reuse = reuseable;
>> +
>> +    return intent;
>> +}
>> +
>> +/**
>> + * glink_core_rx_cmd_remote_rx_intent_req() - Receive a request for rx_intent
>> + *                        from remote side
> 
> copy-paste mistake

 ok.

Regards,
 Sricharan

-- 
"QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation

---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 00/18] rpmsg: glink: Add glink smem based transport Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:20 +0200
  [PATCH 01/18] rpmsg: glink: Rename glink_rpm_xx functions to qcom_glink_xx Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:20 +0200
  [PATCH 02/18] rpmsg: glink: Associate indirections for pipe fifo accessor's Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
  [PATCH 03/18] rpmsg: glink: Split rpm_probe to reuse the common code Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
  [PATCH 16/18] rpmsg: glink: Use the intents passed by remote Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
  [PATCH 11/18] rpmsg: glink: Use the local intents when receiving data Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
    Re: [PATCH 11/18] rpmsg: glink: Use the local intents when receiving  data Arun Kumar Neelakantam <aneela@codeaurora.org> - 2017-08-22 11:30 +0200
      Re: [PATCH 11/18] rpmsg: glink: Use the local intents when receiving  data Sricharan R <sricharan@codeaurora.org> - 2017-08-22 14:40 +0200
  [PATCH 15/18] rpmsg: glink: Receive and store the remote intent buffers Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
    Re: [PATCH 15/18] rpmsg: glink: Receive and store the remote intent  buffers Arun Kumar Neelakantam <aneela@codeaurora.org> - 2017-08-22 12:50 +0200
  [PATCH 08/18] rpmsg: glink: Add support for transport version negotiation Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
  [PATCH 07/18] rpmsg: glink: Fix default case while handling received commands Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
  [PATCH 05/18] rpmsg: glink: Allow unaligned data access Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
  [PATCH 09/18] rpmsg: glink: Fix idr_lock from mutex to spinlock Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
  [PATCH 17/18] rpmsg: glink: Request for intents when unavailable Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
  [PATCH 10/18] rpmsg: glink: Add support for TX intents Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
    Re: [PATCH 10/18] rpmsg: glink: Add support for TX intents Arun Kumar Neelakantam <aneela@codeaurora.org> - 2017-08-22 11:20 +0200
      Re: [PATCH 10/18] rpmsg: glink: Add support for TX intents Sricharan R <sricharan@codeaurora.org> - 2017-08-22 14:40 +0200
  [PATCH 06/18] rpmsg: glink: Introduce glink smem based transport Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
  [PATCH 12/18] rpmsg: glink: Make RX FIFO peak accessor to take an offset Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
  [PATCH 18/18] rpmsg: glink: Handle remote rx done command Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
  [PATCH 13/18] rpmsg: glink: Add rx done command Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
    Re: [PATCH 13/18] rpmsg: glink: Add rx done command Arun Kumar Neelakantam <aneela@codeaurora.org> - 2017-08-22 12:30 +0200
      Re: [PATCH 13/18] rpmsg: glink: Add rx done command Sricharan R <sricharan@codeaurora.org> - 2017-08-22 16:20 +0200
        Re: [PATCH 13/18] rpmsg: glink: Add rx done command Arun Kumar Neelakantam <aneela@codeaurora.org> - 2017-08-23 06:50 +0200
  [PATCH 14/18] rpmsg: glink: Add announce_create ops and preallocate intents Sricharan R <sricharan@codeaurora.org> - 2017-08-16 19:30 +0200
  Re: [PATCH 04/18] rpmsg: glink: Move the common glink protocol  implementation to glink_native.c Arun Kumar Neelakantam <aneela@codeaurora.org> - 2017-08-22 08:00 +0200
    Re: [PATCH 04/18] rpmsg: glink: Move the common glink protocol  implementation to glink_native.c Sricharan R <sricharan@codeaurora.org> - 2017-08-22 14:30 +0200

csiph-web