Skip to content

Commit e9e9187

Browse files
committed
Merge branch '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue
Tony Nguyen says: ==================== libie: commonize adminq structure Michal Swiatkowski says: It is a prework to allow reusing some specific Intel code (eq. fwlog). Move common *_aq_desc structure to libie header and changing it in ice, ixgbe, i40e and iavf. Only generic adminq commands can be easily moved to common header, as rest is slightly different. Format remains the same. It will be better to correctly move it when it will be needed to commonize other part of the code. Move *_aq_str() to new libie module (libie_adminq) and use it across drivers. The functions are exactly the same in each driver. Some more adminq helpers/functions can be moved to libie_adminq when needed. * '100GbE' of git://git.kernel.org/pub/scm/linux/kernel/git/tnguy/next-queue: i40e: use libie_aq_str iavf: use libie_aq_str ice: use libie_aq_str libie: add adminq helper for converting err to str iavf: use libie adminq descriptors i40e: use libie adminq descriptors ixgbe: use libie adminq descriptors ice, libie: move generic adminq descriptors to lib ==================== Link: https://patch.msgid.link/20250724182826.3758850-1-anthony.l.nguyen@intel.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2 parents bf3c032 + 026cea3 commit e9e9187

59 files changed

Lines changed: 1575 additions & 2142 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

drivers/net/ethernet/intel/Kconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ config I40E
231231
depends on PCI
232232
select AUXILIARY_BUS
233233
select LIBIE
234+
select LIBIE_ADMINQ
234235
select NET_DEVLINK
235236
help
236237
This driver supports Intel(R) Ethernet Controller XL710 Family of
@@ -260,6 +261,7 @@ config I40E_DCB
260261
config IAVF
261262
tristate
262263
select LIBIE
264+
select LIBIE_ADMINQ
263265
select NET_SHAPER
264266

265267
config I40EVF
@@ -294,6 +296,7 @@ config ICE
294296
select AUXILIARY_BUS
295297
select DIMLIB
296298
select LIBIE
299+
select LIBIE_ADMINQ
297300
select NET_DEVLINK
298301
select PACKING
299302
select PLDMFW

drivers/net/ethernet/intel/i40e/i40e_adminq.c

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ static int i40e_alloc_adminq_asq_ring(struct i40e_hw *hw)
1818

1919
ret_code = i40e_allocate_dma_mem(hw, &hw->aq.asq.desc_buf,
2020
(hw->aq.num_asq_entries *
21-
sizeof(struct i40e_aq_desc)),
21+
sizeof(struct libie_aq_desc)),
2222
I40E_ADMINQ_DESC_ALIGNMENT);
2323
if (ret_code)
2424
return ret_code;
@@ -44,7 +44,7 @@ static int i40e_alloc_adminq_arq_ring(struct i40e_hw *hw)
4444

4545
ret_code = i40e_allocate_dma_mem(hw, &hw->aq.arq.desc_buf,
4646
(hw->aq.num_arq_entries *
47-
sizeof(struct i40e_aq_desc)),
47+
sizeof(struct libie_aq_desc)),
4848
I40E_ADMINQ_DESC_ALIGNMENT);
4949

5050
return ret_code;
@@ -80,7 +80,7 @@ static void i40e_free_adminq_arq(struct i40e_hw *hw)
8080
**/
8181
static int i40e_alloc_arq_bufs(struct i40e_hw *hw)
8282
{
83-
struct i40e_aq_desc *desc;
83+
struct libie_aq_desc *desc;
8484
struct i40e_dma_mem *bi;
8585
int ret_code;
8686
int i;
@@ -108,9 +108,9 @@ static int i40e_alloc_arq_bufs(struct i40e_hw *hw)
108108
/* now configure the descriptors for use */
109109
desc = I40E_ADMINQ_DESC(hw->aq.arq, i);
110110

111-
desc->flags = cpu_to_le16(I40E_AQ_FLAG_BUF);
111+
desc->flags = cpu_to_le16(LIBIE_AQ_FLAG_BUF);
112112
if (hw->aq.arq_buf_size > I40E_AQ_LARGE_BUF)
113-
desc->flags |= cpu_to_le16(I40E_AQ_FLAG_LB);
113+
desc->flags |= cpu_to_le16(LIBIE_AQ_FLAG_LB);
114114
desc->opcode = 0;
115115
/* This is in accordance with Admin queue design, there is no
116116
* register for buffer size configuration
@@ -119,12 +119,12 @@ static int i40e_alloc_arq_bufs(struct i40e_hw *hw)
119119
desc->retval = 0;
120120
desc->cookie_high = 0;
121121
desc->cookie_low = 0;
122-
desc->params.external.addr_high =
122+
desc->params.generic.addr_high =
123123
cpu_to_le32(upper_32_bits(bi->pa));
124-
desc->params.external.addr_low =
124+
desc->params.generic.addr_low =
125125
cpu_to_le32(lower_32_bits(bi->pa));
126-
desc->params.external.param0 = 0;
127-
desc->params.external.param1 = 0;
126+
desc->params.generic.param0 = 0;
127+
desc->params.generic.param1 = 0;
128128
}
129129

130130
alloc_arq_bufs:
@@ -691,8 +691,8 @@ static u16 i40e_clean_asq(struct i40e_hw *hw)
691691
struct i40e_adminq_ring *asq = &(hw->aq.asq);
692692
struct i40e_asq_cmd_details *details;
693693
u16 ntc = asq->next_to_clean;
694-
struct i40e_aq_desc desc_cb;
695-
struct i40e_aq_desc *desc;
694+
struct libie_aq_desc desc_cb;
695+
struct libie_aq_desc *desc;
696696

697697
desc = I40E_ADMINQ_DESC(*asq, ntc);
698698
details = I40E_ADMINQ_DETAILS(*asq, ntc);
@@ -750,15 +750,15 @@ static bool i40e_asq_done(struct i40e_hw *hw)
750750
**/
751751
static int
752752
i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
753-
struct i40e_aq_desc *desc,
753+
struct libie_aq_desc *desc,
754754
void *buff, /* can be NULL */
755755
u16 buff_size,
756756
struct i40e_asq_cmd_details *cmd_details,
757757
bool is_atomic_context)
758758
{
759759
struct i40e_dma_mem *dma_buff = NULL;
760760
struct i40e_asq_cmd_details *details;
761-
struct i40e_aq_desc *desc_on_ring;
761+
struct libie_aq_desc *desc_on_ring;
762762
bool cmd_completed = false;
763763
u16 retval = 0;
764764
int status = 0;
@@ -771,7 +771,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
771771
goto asq_send_command_error;
772772
}
773773

774-
hw->aq.asq_last_status = I40E_AQ_RC_OK;
774+
hw->aq.asq_last_status = LIBIE_AQ_RC_OK;
775775

776776
val = rd32(hw, I40E_PF_ATQH);
777777
if (val >= hw->aq.num_asq_entries) {
@@ -851,9 +851,9 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
851851
/* Update the address values in the desc with the pa value
852852
* for respective buffer
853853
*/
854-
desc_on_ring->params.external.addr_high =
854+
desc_on_ring->params.generic.addr_high =
855855
cpu_to_le32(upper_32_bits(dma_buff->pa));
856-
desc_on_ring->params.external.addr_low =
856+
desc_on_ring->params.generic.addr_low =
857857
cpu_to_le32(lower_32_bits(dma_buff->pa));
858858
}
859859

@@ -905,13 +905,13 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
905905
retval &= 0xff;
906906
}
907907
cmd_completed = true;
908-
if ((enum i40e_admin_queue_err)retval == I40E_AQ_RC_OK)
908+
if ((enum libie_aq_err)retval == LIBIE_AQ_RC_OK)
909909
status = 0;
910-
else if ((enum i40e_admin_queue_err)retval == I40E_AQ_RC_EBUSY)
910+
else if ((enum libie_aq_err)retval == LIBIE_AQ_RC_EBUSY)
911911
status = -EBUSY;
912912
else
913913
status = -EIO;
914-
hw->aq.asq_last_status = (enum i40e_admin_queue_err)retval;
914+
hw->aq.asq_last_status = (enum libie_aq_err)retval;
915915
}
916916

917917
i40e_debug(hw, I40E_DEBUG_AQ_COMMAND,
@@ -954,7 +954,7 @@ i40e_asq_send_command_atomic_exec(struct i40e_hw *hw,
954954
**/
955955
int
956956
i40e_asq_send_command_atomic(struct i40e_hw *hw,
957-
struct i40e_aq_desc *desc,
957+
struct libie_aq_desc *desc,
958958
void *buff, /* can be NULL */
959959
u16 buff_size,
960960
struct i40e_asq_cmd_details *cmd_details,
@@ -972,7 +972,7 @@ i40e_asq_send_command_atomic(struct i40e_hw *hw,
972972
}
973973

974974
int
975-
i40e_asq_send_command(struct i40e_hw *hw, struct i40e_aq_desc *desc,
975+
i40e_asq_send_command(struct i40e_hw *hw, struct libie_aq_desc *desc,
976976
void *buff, /* can be NULL */ u16 buff_size,
977977
struct i40e_asq_cmd_details *cmd_details)
978978
{
@@ -996,12 +996,12 @@ i40e_asq_send_command(struct i40e_hw *hw, struct i40e_aq_desc *desc,
996996
**/
997997
int
998998
i40e_asq_send_command_atomic_v2(struct i40e_hw *hw,
999-
struct i40e_aq_desc *desc,
999+
struct libie_aq_desc *desc,
10001000
void *buff, /* can be NULL */
10011001
u16 buff_size,
10021002
struct i40e_asq_cmd_details *cmd_details,
10031003
bool is_atomic_context,
1004-
enum i40e_admin_queue_err *aq_status)
1004+
enum libie_aq_err *aq_status)
10051005
{
10061006
int status;
10071007

@@ -1023,13 +1023,13 @@ i40e_asq_send_command_atomic_v2(struct i40e_hw *hw,
10231023
*
10241024
* Fill the desc with default values
10251025
**/
1026-
void i40e_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc,
1026+
void i40e_fill_default_direct_cmd_desc(struct libie_aq_desc *desc,
10271027
u16 opcode)
10281028
{
10291029
/* zero out the desc */
1030-
memset((void *)desc, 0, sizeof(struct i40e_aq_desc));
1030+
memset((void *)desc, 0, sizeof(struct libie_aq_desc));
10311031
desc->opcode = cpu_to_le16(opcode);
1032-
desc->flags = cpu_to_le16(I40E_AQ_FLAG_SI);
1032+
desc->flags = cpu_to_le16(LIBIE_AQ_FLAG_SI);
10331033
}
10341034

10351035
/**
@@ -1047,7 +1047,7 @@ int i40e_clean_arq_element(struct i40e_hw *hw,
10471047
u16 *pending)
10481048
{
10491049
u16 ntc = hw->aq.arq.next_to_clean;
1050-
struct i40e_aq_desc *desc;
1050+
struct libie_aq_desc *desc;
10511051
struct i40e_dma_mem *bi;
10521052
int ret_code = 0;
10531053
u16 desc_idx;
@@ -1081,9 +1081,9 @@ int i40e_clean_arq_element(struct i40e_hw *hw,
10811081
desc_idx = ntc;
10821082

10831083
hw->aq.arq_last_status =
1084-
(enum i40e_admin_queue_err)le16_to_cpu(desc->retval);
1084+
(enum libie_aq_err)le16_to_cpu(desc->retval);
10851085
flags = le16_to_cpu(desc->flags);
1086-
if (flags & I40E_AQ_FLAG_ERR) {
1086+
if (flags & LIBIE_AQ_FLAG_ERR) {
10871087
ret_code = -EIO;
10881088
i40e_debug(hw,
10891089
I40E_DEBUG_AQ_MESSAGE,
@@ -1107,14 +1107,14 @@ int i40e_clean_arq_element(struct i40e_hw *hw,
11071107
* size
11081108
*/
11091109
bi = &hw->aq.arq.r.arq_bi[ntc];
1110-
memset((void *)desc, 0, sizeof(struct i40e_aq_desc));
1110+
memset((void *)desc, 0, sizeof(struct libie_aq_desc));
11111111

1112-
desc->flags = cpu_to_le16(I40E_AQ_FLAG_BUF);
1112+
desc->flags = cpu_to_le16(LIBIE_AQ_FLAG_BUF);
11131113
if (hw->aq.arq_buf_size > I40E_AQ_LARGE_BUF)
1114-
desc->flags |= cpu_to_le16(I40E_AQ_FLAG_LB);
1114+
desc->flags |= cpu_to_le16(LIBIE_AQ_FLAG_LB);
11151115
desc->datalen = cpu_to_le16((u16)bi->size);
1116-
desc->params.external.addr_high = cpu_to_le32(upper_32_bits(bi->pa));
1117-
desc->params.external.addr_low = cpu_to_le32(lower_32_bits(bi->pa));
1116+
desc->params.generic.addr_high = cpu_to_le32(upper_32_bits(bi->pa));
1117+
desc->params.generic.addr_low = cpu_to_le32(lower_32_bits(bi->pa));
11181118

11191119
/* set tail = the last cleaned desc index. */
11201120
wr32(hw, I40E_PF_ARQT, ntc);

drivers/net/ethernet/intel/i40e/i40e_adminq.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
#include "i40e_adminq_cmd.h"
1010

1111
#define I40E_ADMINQ_DESC(R, i) \
12-
(&(((struct i40e_aq_desc *)((R).desc_buf.va))[i]))
12+
(&(((struct libie_aq_desc *)((R).desc_buf.va))[i]))
1313

1414
#define I40E_ADMINQ_DESC_ALIGNMENT 4096
1515

@@ -39,15 +39,15 @@ struct i40e_asq_cmd_details {
3939
u16 flags_dis;
4040
bool async;
4141
bool postpone;
42-
struct i40e_aq_desc *wb_desc;
42+
struct libie_aq_desc *wb_desc;
4343
};
4444

4545
#define I40E_ADMINQ_DETAILS(R, i) \
4646
(&(((struct i40e_asq_cmd_details *)((R).cmd_buf.va))[i]))
4747

4848
/* ARQ event information */
4949
struct i40e_arq_event_info {
50-
struct i40e_aq_desc desc;
50+
struct libie_aq_desc desc;
5151
u16 msg_len;
5252
u16 buf_len;
5353
u8 *msg_buf;
@@ -72,8 +72,8 @@ struct i40e_adminq_info {
7272
struct mutex arq_mutex; /* Receive queue lock */
7373

7474
/* last status values on send and receive queues */
75-
enum i40e_admin_queue_err asq_last_status;
76-
enum i40e_admin_queue_err arq_last_status;
75+
enum libie_aq_err asq_last_status;
76+
enum libie_aq_err arq_last_status;
7777
};
7878

7979
/**
@@ -119,7 +119,7 @@ static inline int i40e_aq_rc_to_posix(int aq_ret, int aq_rc)
119119
#define I40E_AQ_LARGE_BUF 512
120120
#define I40E_ASQ_CMD_TIMEOUT 250000 /* usecs */
121121

122-
void i40e_fill_default_direct_cmd_desc(struct i40e_aq_desc *desc,
122+
void i40e_fill_default_direct_cmd_desc(struct libie_aq_desc *desc,
123123
u16 opcode);
124124

125125
#endif /* _I40E_ADMINQ_H_ */

0 commit comments

Comments
 (0)