Skip to content

Commit b32cddd

Browse files
nciosekxanguy11
authored andcommitted
i40e: Fix endianness conversions
Fixes the following sparse warnings: i40e_main.c:5953:32: warning: cast from restricted __le16 i40e_main.c:8008:29: warning: incorrect type in assignment (different base types) i40e_main.c:8008:29: expected unsigned int [assigned] [usertype] ipa i40e_main.c:8008:29: got restricted __le32 [usertype] i40e_main.c:8008:29: warning: incorrect type in assignment (different base types) i40e_main.c:8008:29: expected unsigned int [assigned] [usertype] ipa i40e_main.c:8008:29: got restricted __le32 [usertype] i40e_txrx.c:1950:59: warning: incorrect type in initializer (different base types) i40e_txrx.c:1950:59: expected unsigned short [usertype] vlan_tag i40e_txrx.c:1950:59: got restricted __le16 [usertype] l2tag1 i40e_txrx.c:1953:40: warning: cast to restricted __le16 i40e_xsk.c:448:38: warning: invalid assignment: |= i40e_xsk.c:448:38: left side has type restricted __le64 i40e_xsk.c:448:38: right side has type int Fixes: 2f4b411 ("i40e: Enable cloud filters via tc-flower") Fixes: 2a508c6 ("i40e: fix VLAN.TCI == 0 RX HW offload") Fixes: 3106c58 ("i40e: Use batched xsk Tx interfaces to increase performance") Fixes: 8f88b30 ("i40e: Add infrastructure for queue channel support") Signed-off-by: Norbert Ciosek <[email protected]> Tested-by: Tony Brelinski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 61c1e0e commit b32cddd

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5920,7 +5920,7 @@ static int i40e_add_channel(struct i40e_pf *pf, u16 uplink_seid,
59205920
ch->enabled_tc = !i40e_is_channel_macvlan(ch) && enabled_tc;
59215921
ch->seid = ctxt.seid;
59225922
ch->vsi_number = ctxt.vsi_number;
5923-
ch->stat_counter_idx = cpu_to_le16(ctxt.info.stat_counter_idx);
5923+
ch->stat_counter_idx = le16_to_cpu(ctxt.info.stat_counter_idx);
59245924

59255925
/* copy just the sections touched not the entire info
59265926
* since not all sections are valid as returned by
@@ -7599,8 +7599,8 @@ static inline void
75997599
i40e_set_cld_element(struct i40e_cloud_filter *filter,
76007600
struct i40e_aqc_cloud_filters_element_data *cld)
76017601
{
7602-
int i, j;
76037602
u32 ipa;
7603+
int i;
76047604

76057605
memset(cld, 0, sizeof(*cld));
76067606
ether_addr_copy(cld->outer_mac, filter->dst_mac);
@@ -7611,14 +7611,14 @@ i40e_set_cld_element(struct i40e_cloud_filter *filter,
76117611

76127612
if (filter->n_proto == ETH_P_IPV6) {
76137613
#define IPV6_MAX_INDEX (ARRAY_SIZE(filter->dst_ipv6) - 1)
7614-
for (i = 0, j = 0; i < ARRAY_SIZE(filter->dst_ipv6);
7615-
i++, j += 2) {
7614+
for (i = 0; i < ARRAY_SIZE(filter->dst_ipv6); i++) {
76167615
ipa = be32_to_cpu(filter->dst_ipv6[IPV6_MAX_INDEX - i]);
7617-
ipa = cpu_to_le32(ipa);
7618-
memcpy(&cld->ipaddr.raw_v6.data[j], &ipa, sizeof(ipa));
7616+
7617+
*(__le32 *)&cld->ipaddr.raw_v6.data[i * 2] = cpu_to_le32(ipa);
76197618
}
76207619
} else {
76217620
ipa = be32_to_cpu(filter->dst_ipv4);
7621+
76227622
memcpy(&cld->ipaddr.v4.data, &ipa, sizeof(ipa));
76237623
}
76247624

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1793,7 +1793,7 @@ void i40e_process_skb_fields(struct i40e_ring *rx_ring,
17931793
skb_record_rx_queue(skb, rx_ring->queue_index);
17941794

17951795
if (qword & BIT(I40E_RX_DESC_STATUS_L2TAG1P_SHIFT)) {
1796-
u16 vlan_tag = rx_desc->wb.qword0.lo_dword.l2tag1;
1796+
__le16 vlan_tag = rx_desc->wb.qword0.lo_dword.l2tag1;
17971797

17981798
__vlan_hwaccel_put_tag(skb, htons(ETH_P_8021Q),
17991799
le16_to_cpu(vlan_tag));

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -444,7 +444,7 @@ static void i40e_set_rs_bit(struct i40e_ring *xdp_ring)
444444
struct i40e_tx_desc *tx_desc;
445445

446446
tx_desc = I40E_TX_DESC(xdp_ring, ntu);
447-
tx_desc->cmd_type_offset_bsz |= (I40E_TX_DESC_CMD_RS << I40E_TXD_QW1_CMD_SHIFT);
447+
tx_desc->cmd_type_offset_bsz |= cpu_to_le64(I40E_TX_DESC_CMD_RS << I40E_TXD_QW1_CMD_SHIFT);
448448
}
449449

450450
/**

0 commit comments

Comments
 (0)