Skip to content

Commit c3f398b

Browse files
Alex Elderdavem330
authored andcommitted
soc: qcom: ipa: IPA interface to GSI
This patch provides interface functions supplied by the IPA layer that are called from the GSI layer. One function is called when a GSI transaction has completed. The others allow the GSI layer to inform the IPA layer when the hardware has been told it has new TREs to execute, and when the hardware has indicated transactions have completed. Signed-off-by: Alex Elder <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 650d160 commit c3f398b

File tree

2 files changed

+114
-0
lines changed

2 files changed

+114
-0
lines changed

drivers/net/ipa/ipa_gsi.c

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
3+
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4+
* Copyright (C) 2019-2020 Linaro Ltd.
5+
*/
6+
7+
#include <linux/types.h>
8+
9+
#include "gsi_trans.h"
10+
#include "ipa.h"
11+
#include "ipa_endpoint.h"
12+
#include "ipa_data.h"
13+
14+
void ipa_gsi_trans_complete(struct gsi_trans *trans)
15+
{
16+
struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
17+
18+
ipa_endpoint_trans_complete(ipa->channel_map[trans->channel_id], trans);
19+
}
20+
21+
void ipa_gsi_trans_release(struct gsi_trans *trans)
22+
{
23+
struct ipa *ipa = container_of(trans->gsi, struct ipa, gsi);
24+
25+
ipa_endpoint_trans_release(ipa->channel_map[trans->channel_id], trans);
26+
}
27+
28+
void ipa_gsi_channel_tx_queued(struct gsi *gsi, u32 channel_id, u32 count,
29+
u32 byte_count)
30+
{
31+
struct ipa *ipa = container_of(gsi, struct ipa, gsi);
32+
struct ipa_endpoint *endpoint;
33+
34+
endpoint = ipa->channel_map[channel_id];
35+
if (endpoint->netdev)
36+
netdev_sent_queue(endpoint->netdev, byte_count);
37+
}
38+
39+
void ipa_gsi_channel_tx_completed(struct gsi *gsi, u32 channel_id, u32 count,
40+
u32 byte_count)
41+
{
42+
struct ipa *ipa = container_of(gsi, struct ipa, gsi);
43+
struct ipa_endpoint *endpoint;
44+
45+
endpoint = ipa->channel_map[channel_id];
46+
if (endpoint->netdev)
47+
netdev_completed_queue(endpoint->netdev, count, byte_count);
48+
}
49+
50+
/* Indicate whether an endpoint config data entry is "empty" */
51+
bool ipa_gsi_endpoint_data_empty(const struct ipa_gsi_endpoint_data *data)
52+
{
53+
return data->ee_id == GSI_EE_AP && !data->channel.tlv_count;
54+
}

drivers/net/ipa/ipa_gsi.h

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
3+
/* Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
4+
* Copyright (C) 2019-2020 Linaro Ltd.
5+
*/
6+
#ifndef _IPA_GSI_TRANS_H_
7+
#define _IPA_GSI_TRANS_H_
8+
9+
#include <linux/types.h>
10+
11+
struct gsi_trans;
12+
13+
/**
14+
* ipa_gsi_trans_complete() - GSI transaction completion callback
15+
* @trans: Transaction that has completed
16+
*
17+
* This called from the GSI layer to notify the IPA layer that a
18+
* transaction has completed.
19+
*/
20+
void ipa_gsi_trans_complete(struct gsi_trans *trans);
21+
22+
/**
23+
* ipa_gsi_trans_release() - GSI transaction release callback
24+
* @trans: Transaction whose resources should be freed
25+
*
26+
* This called from the GSI layer to notify the IPA layer that a
27+
* transaction is about to be freed, so any resources associated
28+
* with it should be released.
29+
*/
30+
void ipa_gsi_trans_release(struct gsi_trans *trans);
31+
32+
/**
33+
* ipa_gsi_channel_tx_queued() - GSI queued to hardware notification
34+
* @gsi: GSI pointer
35+
* @channel_id: Channel number
36+
* @count: Number of transactions queued
37+
* @byte_count: Number of bytes to transfer represented by transactions
38+
*
39+
* This called from the GSI layer to notify the IPA layer that some
40+
* number of transactions have been queued to hardware for execution.
41+
*/
42+
void ipa_gsi_channel_tx_queued(struct gsi *gsi, u32 channel_id, u32 count,
43+
u32 byte_count);
44+
/**
45+
* ipa_gsi_trans_complete() - GSI transaction completion callback
46+
ipa_gsi_channel_tx_completed()
47+
* @gsi: GSI pointer
48+
* @channel_id: Channel number
49+
* @count: Number of transactions completed since last report
50+
* @byte_count: Number of bytes transferred represented by transactions
51+
*
52+
* This called from the GSI layer to notify the IPA layer that the hardware
53+
* has reported the completion of some number of transactions.
54+
*/
55+
void ipa_gsi_channel_tx_completed(struct gsi *gsi, u32 channel_id, u32 count,
56+
u32 byte_count);
57+
58+
bool ipa_gsi_endpoint_data_empty(const struct ipa_gsi_endpoint_data *data);
59+
60+
#endif /* _IPA_GSI_TRANS_H_ */

0 commit comments

Comments
 (0)