ipa_gsi.c 1.5 KB

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