Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 
0003 /* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
0004  * Copyright (C) 2019-2020 Linaro Ltd.
0005  */
0006 
0007 #include <linux/types.h>
0008 
0009 #include "ipa_gsi.h"
0010 #include "gsi_trans.h"
0011 #include "ipa.h"
0012 #include "ipa_endpoint.h"
0013 #include "ipa_data.h"
0014 
0015 void ipa_gsi_trans_complete(struct gsi_trans *trans)
0016 {
0017     struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
0018 
0019     ipa_endpoint_trans_complete(ipa->channel_map[trans->channel_id], trans);
0020 }
0021 
0022 void ipa_gsi_trans_release(struct gsi_trans *trans)
0023 {
0024     struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
0025 
0026     ipa_endpoint_trans_release(ipa->channel_map[trans->channel_id], trans);
0027 }
0028 
0029 void ipa_gsi_channel_tx_queued(struct gsi *gsi, u32 channel_id, u32 count,
0030                    u32 byte_count)
0031 {
0032     struct ipa *ipa = container_of(gsi, struct ipa, gsi);
0033     struct ipa_endpoint *endpoint;
0034 
0035     endpoint = ipa->channel_map[channel_id];
0036     if (endpoint->netdev)
0037         netdev_sent_queue(endpoint->netdev, byte_count);
0038 }
0039 
0040 void ipa_gsi_channel_tx_completed(struct gsi *gsi, u32 channel_id, u32 count,
0041                   u32 byte_count)
0042 {
0043     struct ipa *ipa = container_of(gsi, struct ipa, gsi);
0044     struct ipa_endpoint *endpoint;
0045 
0046     endpoint = ipa->channel_map[channel_id];
0047     if (endpoint->netdev)
0048         netdev_completed_queue(endpoint->netdev, count, byte_count);
0049 }
0050 
0051 /* Indicate whether an endpoint config data entry is "empty" */
0052 bool ipa_gsi_endpoint_data_empty(const struct ipa_gsi_endpoint_data *data)
0053 {
0054     return data->ee_id == GSI_EE_AP && !data->channel.tlv_count;
0055 }