Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dbb6654c authored by Winkler, Tomas's avatar Winkler, Tomas Committed by John W. Linville
Browse files

iwl3945: rearrange 3945 tfd



This patch moves 3945 TFD structures to iwl-3945-fh.h. It renames them
similarly to AGN naming. This patch also eliminates iwl3945_tx_info and
fixes endianity issue in iwl3945_tx_skb and iwl3945_enqueue_hcmd caused
by ugly casting.

Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
Signed-off-by: default avatarZhu Yi <yi.zhu@intel.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 8cd812bc
Loading
Loading
Loading
Loading
+11 −1
Original line number Diff line number Diff line
@@ -172,7 +172,17 @@

#define FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE			(0x01000000)

#define TFD_QUEUE_SIZE_MAX      (256)
struct iwl3945_tfd_tb {
	__le32 addr;
	__le32 len;
} __attribute__ ((packed));

struct iwl3945_tfd {
	__le32 control_flags;
	struct iwl3945_tfd_tb tbs[4];
	u8 __pad[28];
} __attribute__ ((packed));


#endif /* __iwl_3945_fh_h__ */
+0 −11
Original line number Diff line number Diff line
@@ -304,17 +304,6 @@ struct iwl3945_shared {
	__le32 tx_base_ptr[8];
} __attribute__ ((packed));

struct iwl3945_tfd_frame_data {
	__le32 addr;
	__le32 len;
} __attribute__ ((packed));

struct iwl3945_tfd_frame {
	__le32 control_flags;
	struct iwl3945_tfd_frame_data pa[4];
	u8 reserved[28];
} __attribute__ ((packed));

static inline u8 iwl3945_hw_get_rate(__le16 rate_n_flags)
{
	return le16_to_cpu(rate_n_flags) & 0xFF;
+10 −9
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@
#include <asm/unaligned.h>
#include <net/mac80211.h>

#include "iwl-fh.h"
#include "iwl-3945-fh.h"
#include "iwl-commands.h"
#include "iwl-3945.h"
@@ -307,7 +308,7 @@ static void iwl3945_tx_queue_reclaim(struct iwl_priv *priv,
{
	struct iwl3945_tx_queue *txq = &priv->txq39[txq_id];
	struct iwl_queue *q = &txq->q;
	struct iwl3945_tx_info *tx_info;
	struct iwl_tx_info *tx_info;

	BUG_ON(txq_id == IWL_CMD_QUEUE_NUM);

@@ -728,7 +729,7 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
{
	int count;
	u32 pad;
	struct iwl3945_tfd_frame *tfd = (struct iwl3945_tfd_frame *)ptr;
	struct iwl3945_tfd *tfd = (struct iwl3945_tfd *)ptr;

	count = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
	pad = TFD_CTL_PAD_GET(le32_to_cpu(tfd->control_flags));
@@ -739,8 +740,8 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
		return -EINVAL;
	}

	tfd->pa[count].addr = cpu_to_le32(addr);
	tfd->pa[count].len = cpu_to_le32(len);
	tfd->tbs[count].addr = cpu_to_le32(addr);
	tfd->tbs[count].len = cpu_to_le32(len);

	count++;

@@ -757,8 +758,8 @@ int iwl3945_hw_txq_attach_buf_to_tfd(struct iwl_priv *priv, void *ptr,
 */
int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
{
	struct iwl3945_tfd_frame *bd_tmp = (struct iwl3945_tfd_frame *)&txq->bd[0];
	struct iwl3945_tfd_frame *bd = &bd_tmp[txq->q.read_ptr];
	struct iwl3945_tfd *tfd_tmp = (struct iwl3945_tfd *)&txq->tfds[0];
	struct iwl3945_tfd *tfd = &tfd_tmp[txq->q.read_ptr];
	struct pci_dev *dev = priv->pci_dev;
	int i;
	int counter;
@@ -769,7 +770,7 @@ int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
		return 0;

	/* sanity check */
	counter = TFD_CTL_COUNT_GET(le32_to_cpu(bd->control_flags));
	counter = TFD_CTL_COUNT_GET(le32_to_cpu(tfd->control_flags));
	if (counter > NUM_TFD_CHUNKS) {
		IWL_ERR(priv, "Too many chunks: %i\n", counter);
		/* @todo issue fatal error, it is quite serious situation */
@@ -779,8 +780,8 @@ int iwl3945_hw_txq_free_tfd(struct iwl_priv *priv, struct iwl3945_tx_queue *txq)
	/* unmap chunks if any */

	for (i = 1; i < counter; i++) {
		pci_unmap_single(dev, le32_to_cpu(bd->pa[i].addr),
				 le32_to_cpu(bd->pa[i].len), PCI_DMA_TODEVICE);
		pci_unmap_single(dev, le32_to_cpu(tfd->tbs[i].addr),
			 le32_to_cpu(tfd->tbs[i].len), PCI_DMA_TODEVICE);
		if (txq->txb[txq->q.read_ptr].skb[0]) {
			struct sk_buff *skb = txq->txb[txq->q.read_ptr].skb[0];
			if (txq->txb[txq->q.read_ptr].skb[0]) {
+1 −7
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@ extern struct pci_device_id iwl3945_hw_card_ids[];

#include "iwl-csr.h"
#include "iwl-prph.h"
#include "iwl-fh.h"
#include "iwl-3945-hw.h"
#include "iwl-debug.h"
#include "iwl-power.h"
@@ -107,13 +108,6 @@ enum iwl3945_antenna {

int iwl3945_x2_queue_used(const struct iwl_queue *q, int i);

#define MAX_NUM_OF_TBS          (20)

/* One for each TFD */
struct iwl3945_tx_info {
	struct sk_buff *skb[MAX_NUM_OF_TBS];
};

#include "iwl-agn-rs.h"

#define IWL_TX_FIFO_AC0	0
+7 −6
Original line number Diff line number Diff line
@@ -36,14 +36,15 @@
#include <linux/kernel.h>
#include <net/ieee80211_radiotap.h>

#include "iwl-rfkill.h"
#include "iwl-eeprom.h"
#include "iwl-4965-hw.h"
#include "iwl-3945-hw.h"
#include "iwl-3945-led.h"
#include "iwl-csr.h"
#include "iwl-prph.h"
#include "iwl-fh.h"
#include "iwl-debug.h"
#include "iwl-rfkill.h"
#include "iwl-4965-hw.h"
#include "iwl-3945-hw.h"
#include "iwl-3945-led.h"
#include "iwl-led.h"
#include "iwl-power.h"
#include "iwl-agn-rs.h"
@@ -239,10 +240,10 @@ struct iwl_channel_info {
 */
struct iwl3945_tx_queue {
	struct iwl_queue q;
	struct iwl3945_tfd_frame *bd;
	struct iwl3945_tfd *tfds;
	struct iwl_cmd *cmd;
	dma_addr_t dma_addr_cmd;
	struct iwl3945_tx_info *txb;
	struct iwl_tx_info *txb;
	int need_update;
	int active;
};
Loading