Skip to content

Commit

Permalink
sync up ixgbe code
Browse files Browse the repository at this point in the history
  • Loading branch information
laffer1 committed Dec 1, 2024
1 parent 93a48c6 commit 8a32cd3
Show file tree
Hide file tree
Showing 8 changed files with 830 additions and 627 deletions.
110 changes: 56 additions & 54 deletions sys/dev/ixgbe/if_bypass.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/******************************************************************************
/*****************************************************************************
Copyright (c) 2001-2017, Intel Corporation
All rights reserved.
Expand Down Expand Up @@ -29,7 +29,7 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
*****************************************************************************/


#include "ixgbe.h"
Expand Down Expand Up @@ -114,11 +114,11 @@ ixgbe_get_bypass_time(u32 *year, u32 *sec)
static int
ixgbe_bp_version(SYSCTL_HANDLER_ARGS)
{
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int version = 0;
u32 cmd;
int error = 0;
static int version = 0;
u32 cmd;

ixgbe_bypass_mutex_enter(sc);
cmd = BYPASS_PAGE_CTL2 | BYPASS_WE;
Expand Down Expand Up @@ -154,15 +154,14 @@ ixgbe_bp_version(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS)
{
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int state = 0;
int error = 0;
static int state = 0;

/* Get the current state */
ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw,
BYPASS_PAGE_CTL0, &state);
error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &state);
ixgbe_bypass_mutex_clear(sc);
if (error != 0)
return (error);
Expand Down Expand Up @@ -216,10 +215,10 @@ ixgbe_bp_set_state(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS)
{
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int timeout = 0;
int error = 0;
static int timeout = 0;

/* Get the current value */
ixgbe_bypass_mutex_enter(sc);
Expand Down Expand Up @@ -259,10 +258,10 @@ ixgbe_bp_timeout(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS)
{
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int main_on = 0;
int error = 0;
static int main_on = 0;

ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_on);
Expand Down Expand Up @@ -301,10 +300,10 @@ ixgbe_bp_main_on(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS)
{
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int main_off = 0;
int error = 0;
static int main_off = 0;

ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &main_off);
Expand Down Expand Up @@ -343,10 +342,10 @@ ixgbe_bp_main_off(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS)
{
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int aux_on = 0;
int error = 0;
static int aux_on = 0;

ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_on);
Expand Down Expand Up @@ -385,10 +384,10 @@ ixgbe_bp_aux_on(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS)
{
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_hw *hw = &sc->hw;
int error = 0;
static int aux_off = 0;
int error = 0;
static int aux_off = 0;

ixgbe_bypass_mutex_enter(sc);
error = hw->mac.ops.bypass_rw(hw, BYPASS_PAGE_CTL0, &aux_off);
Expand Down Expand Up @@ -432,11 +431,11 @@ ixgbe_bp_aux_off(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS)
{
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_hw *hw = &sc->hw;
int error, tmp;
static int timeout = 0;
u32 mask, arg;
int error, tmp;
static int timeout = 0;
u32 mask, arg;

/* Get the current hardware value */
ixgbe_bypass_mutex_enter(sc);
Expand Down Expand Up @@ -503,11 +502,11 @@ ixgbe_bp_wd_set(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS)
{
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_hw *hw = &sc->hw;
u32 sec, year;
int cmd, count = 0, error = 0;
int reset_wd = 0;
u32 sec, year;
int cmd, count = 0, error = 0;
int reset_wd = 0;

error = sysctl_handle_int(oidp, &reset_wd, 0, req);
if ((error) || (req->newptr == NULL))
Expand Down Expand Up @@ -549,14 +548,14 @@ ixgbe_bp_wd_reset(SYSCTL_HANDLER_ARGS)
static int
ixgbe_bp_log(SYSCTL_HANDLER_ARGS)
{
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_hw *hw = &sc->hw;
u32 cmd, base, head;
u32 log_off, count = 0;
static int status = 0;
u8 data;
struct ixgbe_softc *sc = (struct ixgbe_softc *) arg1;
struct ixgbe_hw *hw = &sc->hw;
u32 cmd, base, head;
u32 log_off, count = 0;
static int status = 0;
u8 data;
struct ixgbe_bypass_eeprom eeprom[BYPASS_MAX_LOGS];
int i, error = 0;
int i, error = 0;

error = sysctl_handle_int(oidp, &status, 0, req);
if ((error) || (req->newptr == NULL))
Expand Down Expand Up @@ -639,12 +638,15 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS)
BYPASS_LOG_EVENT_SHIFT;
u8 action = eeprom[count].actions & BYPASS_LOG_ACTION_M;
u16 day_mon[2][13] = {
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365},
{0, 31, 59, 91, 121, 152, 182, 213, 244, 274, 305, 335, 366}
{0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304,
334, 365},
{0, 31, 59, 91, 121, 152, 182, 213, 244, 274, 305,
335, 366}
};
char *event_str[] = {"unknown", "main on", "aux on",
"main off", "aux off", "WDT", "user" };
char *action_str[] = {"ignore", "normal", "bypass", "isolate",};
char *action_str[] =
{"ignore", "normal", "bypass", "isolate",};

/* verify vaild data 1 - 6 */
if (event < BYPASS_EVENT_MAIN_ON || event > BYPASS_EVENT_USR)
Expand Down Expand Up @@ -711,25 +713,25 @@ ixgbe_bp_log(SYSCTL_HANDLER_ARGS)
void
ixgbe_bypass_init(struct ixgbe_softc *sc)
{
struct ixgbe_hw *hw = &sc->hw;
device_t dev = sc->dev;
struct sysctl_oid *bp_node;
struct ixgbe_hw *hw = &sc->hw;
device_t dev = sc->dev;
struct sysctl_oid *bp_node;
struct sysctl_oid_list *bp_list;
u32 mask, value, sec, year;
u32 mask, value, sec, year;

if (!(sc->feat_cap & IXGBE_FEATURE_BYPASS))
return;

/* First set up time for the hardware */
ixgbe_get_bypass_time(&year, &sec);

mask = BYPASS_CTL1_TIME_M
| BYPASS_CTL1_VALID_M
| BYPASS_CTL1_OFFTRST_M;
mask = BYPASS_CTL1_TIME_M |
BYPASS_CTL1_VALID_M |
BYPASS_CTL1_OFFTRST_M;

value = (sec & BYPASS_CTL1_TIME_M)
| BYPASS_CTL1_VALID
| BYPASS_CTL1_OFFTRST;
value = (sec & BYPASS_CTL1_TIME_M) |
BYPASS_CTL1_VALID |
BYPASS_CTL1_OFFTRST;

ixgbe_bypass_mutex_enter(sc);
hw->mac.ops.bypass_set(hw, BYPASS_PAGE_CTL1, mask, value);
Expand Down
24 changes: 12 additions & 12 deletions sys/dev/ixgbe/if_fdir.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/******************************************************************************
/*****************************************************************************
Copyright (c) 2001-2017, Intel Corporation
All rights reserved.
Expand Down Expand Up @@ -29,7 +29,7 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
******************************************************************************/
*****************************************************************************/

#include "ixgbe.h"

Expand All @@ -51,9 +51,9 @@ ixgbe_init_fdir(struct ixgbe_softc *sc)
void
ixgbe_reinit_fdir(void *context)
{
if_ctx_t ctx = context;
if_ctx_t ctx = context;
struct ixgbe_softc *sc = iflib_get_softc(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);
struct ifnet *ifp = iflib_get_ifp(ctx);

if (!(sc->feat_en & IXGBE_FEATURE_FDIR))
return;
Expand All @@ -79,16 +79,16 @@ ixgbe_reinit_fdir(void *context)
void
ixgbe_atr(struct tx_ring *txr, struct mbuf *mp)
{
struct ixgbe_softc *sc = txr->sc;
struct ix_queue *que;
struct ip *ip;
struct tcphdr *th;
struct udphdr *uh;
struct ether_vlan_header *eh;
struct ixgbe_softc *sc = txr->sc;
struct ix_queue *que;
struct ip *ip;
struct tcphdr *th;
struct udphdr *uh;
struct ether_vlan_header *eh;
union ixgbe_atr_hash_dword input = {.dword = 0};
union ixgbe_atr_hash_dword common = {.dword = 0};
int ehdrlen, ip_hlen;
u16 etype;
int ehdrlen, ip_hlen;
u16 etype;

eh = mtod(mp, struct ether_vlan_header *);
if (eh->evl_encap_proto == htons(ETHERTYPE_VLAN)) {
Expand Down
Loading

0 comments on commit 8a32cd3

Please sign in to comment.